Bug Report Checklist
Description
Fields of type array which are not required fail to parse when absent.
E.g., the type IntegrationDto has an optional field dependencies:
"dependencies": {
"type": "array",
"items": {
"type": "object"
}
},
The generated OCaml field is
dependencies : Yojson.Safe.t list;
Thus, when parsing a JSON without this field, it fails.
openapi-generator version
7.10.0
OpenAPI declaration file content or url
https://api.integration.app/docs-json
Generation Details
$ openapi-generator-cli generate \
--generator-name ocaml \
--input-spec docs-json
Steps to reproduce
$ openapi-generator-cli generate \
--generator-name ocaml \
--input-spec docs-json
Related issues/PRs
N/a.
Suggest a fix
I think when the field is optional and of type 'a list, there should be a default value of [].
E.g.,
dependencies : Yojson.Safe.t list; [@default []]
Note that the create function already honors this optionality: the field dependencies is not an argument to this function.
Bug Report Checklist
Description
Fields of type
arraywhich are not required fail to parse when absent.E.g., the type
IntegrationDtohas an optional fielddependencies:The generated OCaml field is
Thus, when parsing a JSON without this field, it fails.
openapi-generator version
7.10.0OpenAPI declaration file content or url
https://api.integration.app/docs-json
Generation Details
Steps to reproduce
Related issues/PRs
N/a.
Suggest a fix
I think when the field is optional and of type
'a list, there should be a default value of[].E.g.,
Note that the
createfunction already honors this optionality: the fielddependenciesis not an argument to this function.