Skip to content

Commit ac643b5

Browse files
committed
Fix: correctly mark non-required maps with default empty list
1 parent f5eaf8f commit ac643b5

51 files changed

Lines changed: 150 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/resources/ocaml/model-record.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type t = {
2828
{{^required}} option [@default None]{{/required}}
2929
{{/isContainer}}
3030
{{#isArray}}{{^required}} [@default []]{{/required}}{{/isArray}}
31+
{{#isMap}}{{^required}} [@default []]{{/required}}{{/isMap}}
3132
; [@key "{{{baseName}}}"]
3233
{{/isEnum}}
3334
{{/vars}}

samples/client/petstore/ocaml-fake-petstore/src/models/additional_properties_class.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
type t = {
1212
map_property: (string * string) list
1313

14+
[@default []]
1415
; [@key "map_property"]
1516
map_of_map_property: (string * (string * string) list) list
1617

18+
[@default []]
1719
; [@key "map_of_map_property"]
1820
} [@@deriving yojson { strict = false }, show, eq ];;
1921

samples/client/petstore/ocaml-fake-petstore/src/models/all_of_with_single_ref.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313

1414
option [@default None]
1515

16+
1617
; [@key "username"]
1718
single_ref_type: Enums.singlereftype
1819

1920
option [@default None]
2021

22+
2123
; [@key "SingleRefType"]
2224
} [@@deriving yojson { strict = false }, show, eq ];;
2325

samples/client/petstore/ocaml-fake-petstore/src/models/animal.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313

1414

1515

16+
1617
; [@key "className"]
1718
color: string
1819

1920
option [@default None]
2021

22+
2123
; [@key "color"]
2224
} [@@deriving yojson { strict = false }, show, eq ];;
2325

samples/client/petstore/ocaml-fake-petstore/src/models/api_response.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@
1313

1414
option [@default None]
1515

16+
1617
; [@key "code"]
1718
_type: string
1819

1920
option [@default None]
2021

22+
2123
; [@key "type"]
2224
message: string
2325

2426
option [@default None]
2527

28+
2629
; [@key "message"]
2730
} [@@deriving yojson { strict = false }, show, eq ];;
2831

samples/client/petstore/ocaml-fake-petstore/src/models/array_of_array_of_number_only.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
type t = {
1212
array_array_number: float list list
1313
[@default []]
14+
1415
; [@key "ArrayArrayNumber"]
1516
} [@@deriving yojson { strict = false }, show, eq ];;
1617

samples/client/petstore/ocaml-fake-petstore/src/models/array_of_number_only.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
type t = {
1212
array_number: float list
1313
[@default []]
14+
1415
; [@key "ArrayNumber"]
1516
} [@@deriving yojson { strict = false }, show, eq ];;
1617

samples/client/petstore/ocaml-fake-petstore/src/models/array_test.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@
1111
type t = {
1212
array_of_string: string list
1313
[@default []]
14+
1415
; [@key "array_of_string"]
1516
array_array_of_integer: int64 list list
1617
[@default []]
18+
1719
; [@key "array_array_of_integer"]
1820
array_array_of_model: Read_only_first.t list list
1921
[@default []]
22+
2023
; [@key "array_array_of_model"]
2124
} [@@deriving yojson { strict = false }, show, eq ];;
2225

samples/client/petstore/ocaml-fake-petstore/src/models/capitalization.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,38 @@
1313

1414
option [@default None]
1515

16+
1617
; [@key "smallCamel"]
1718
capital_camel: string
1819

1920
option [@default None]
2021

22+
2123
; [@key "CapitalCamel"]
2224
small_snake: string
2325

2426
option [@default None]
2527

28+
2629
; [@key "small_Snake"]
2730
capital_snake: string
2831

2932
option [@default None]
3033

34+
3135
; [@key "Capital_Snake"]
3236
sca_eth_flow_points: string
3337

3438
option [@default None]
3539

40+
3641
; [@key "SCA_ETH_Flow_Points"]
3742
(* Name of the pet *)
3843
att_name: string
3944

4045
option [@default None]
4146

47+
4248
; [@key "ATT_NAME"]
4349
} [@@deriving yojson { strict = false }, show, eq ];;
4450

samples/client/petstore/ocaml-fake-petstore/src/models/cat.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@
1313

1414

1515

16+
1617
; [@key "className"]
1718
color: string
1819

1920
option [@default None]
2021

22+
2123
; [@key "color"]
2224
declawed: bool
2325

2426
option [@default None]
2527

28+
2629
; [@key "declawed"]
2730
} [@@deriving yojson { strict = false }, show, eq ];;
2831

0 commit comments

Comments
 (0)