File tree 5 files changed +64
-64
lines changed
5 files changed +64
-64
lines changed Original file line number Diff line number Diff line change @@ -11,16 +11,16 @@ type Image struct {
11
11
Description string `json:"description"`
12
12
ImageSize * float32 `json:"image_size"`
13
13
DiskSize float32 `json:"disk_size"`
14
- Created time.Time `json:"created"`
14
+ Created * time.Time `json:"created"`
15
15
CreatedFrom * ImageCreatedFrom `json:"created_from"`
16
16
BoundTo * int64 `json:"bound_to"`
17
17
OSFlavor string `json:"os_flavor"`
18
18
OSVersion * string `json:"os_version"`
19
19
Architecture string `json:"architecture"`
20
20
RapidDeploy bool `json:"rapid_deploy"`
21
21
Protection ImageProtection `json:"protection"`
22
- Deprecated time.Time `json:"deprecated"`
23
- Deleted time.Time `json:"deleted"`
22
+ Deprecated * time.Time `json:"deprecated"`
23
+ Deleted * time.Time `json:"deleted"`
24
24
Labels map [string ]string `json:"labels"`
25
25
}
26
26
Original file line number Diff line number Diff line change @@ -4,12 +4,12 @@ import "time"
4
4
5
5
// ISO defines the schema of an ISO image.
6
6
type ISO struct {
7
- ID int64 `json:"id"`
8
- Name string `json:"name"`
9
- Description string `json:"description"`
10
- Type string `json:"type"`
11
- Architecture * string `json:"architecture"`
12
- Deprecated time.Time `json:"deprecated"`
7
+ ID int64 `json:"id"`
8
+ Name string `json:"name"`
9
+ Description string `json:"description"`
10
+ Type string `json:"type"`
11
+ Architecture * string `json:"architecture"`
12
+ Deprecated * time.Time `json:"deprecated"`
13
13
DeprecatableResource
14
14
}
15
15
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ type ServerType struct {
13
13
Architecture string `json:"architecture"`
14
14
IncludedTraffic int64 `json:"included_traffic"`
15
15
Prices []PricingServerTypePrice `json:"prices"`
16
+ Deprecated bool `json:"deprecated"`
16
17
DeprecatableResource
17
18
}
18
19
Original file line number Diff line number Diff line change @@ -149,12 +149,17 @@ type converter interface {
149
149
ServerTypeFromSchema (schema.ServerType ) * ServerType
150
150
151
151
// goverter:map Pricings Prices
152
+ // goverter:map DeprecatableResource.Deprecation Deprecated | isDeprecationNotNil
152
153
SchemaFromServerType (* ServerType ) schema.ServerType
153
154
154
155
ImageFromSchema (schema.Image ) * Image
155
156
156
157
SchemaFromImage (* Image ) schema.Image
157
158
159
+ // Needed because of how goverter works internally, see https://github.com/jmattheis/goverter/issues/114
160
+ // goverter:map ImageSize | mapZeroFloat32ToNil
161
+ intSchemaFromImage (Image ) schema.Image
162
+
158
163
// goverter:ignore Currency
159
164
// goverter:ignore VATRate
160
165
PriceFromSchema (schema.Price ) Price
@@ -906,3 +911,15 @@ func rawSchemaFromErrorDetails(v interface{}) json.RawMessage {
906
911
msg , _ := json .Marshal (d )
907
912
return msg
908
913
}
914
+
915
+ func mapZeroFloat32ToNil (f float32 ) * float32 {
916
+ fmt .Println (f )
917
+ if f == 0 {
918
+ return nil
919
+ }
920
+ return & f
921
+ }
922
+
923
+ func isDeprecationNotNil (d * DeprecationInfo ) bool {
924
+ return d != nil
925
+ }
You can’t perform that action at this time.
0 commit comments