You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Since PR #15698, the generator assumes that a schema object without a type property means that the object is nullable. That assumption is as far as I can see not support by either OAS 3.0.3, OAS 3.1 or JSON Schema.
Not having a "type" property in a sub-schema is not the same as having
a `"type": null` property.
Using the YAML tag `null` in `"type"` and `"$ref"` properties to express a nullable
type is also not supported by either OAS or JSON Schema. `"type"` MUST be either a
string or an array of strings, `"$ref"` MUST be a string. The YAML tag `null` is
not the same as the string `"null"` and using it to convey the same meaning is not
supported by any of the specifications.
fixesOpenAPITools#16466
Bug Report Checklist
Description
Since PR #15698, the generator assumes that a schema object without a type property means that the object is nullable. That assumption is as far as I can see not support by either OAS 3.0.3, OAS 3.1 or JSON Schema.
For OAS 3.0.3 the situation is explicitly documented at https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#data-types, which states:
For OAS 3.1 the
null
type is supported, however there is nothing in OAS nor JSON Schema that mandates that a missingtype
equals thenull
type.openapi-generator version
OpenAPI declaration file content or url
A OpenAPI specification as input:
is translated in
openapi
generator to:Note the missing declarations in
oneOf
and the erroneously added"nullable": true
Generation Details
Steps to reproduce
run the
openapi
generator and check the output for missingoneOf
and wrongnullable
Related issues/PRs
Suggest a fix
https://github.com/karzang/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java#L678-L696 should be changed to something like e.g.:
The text was updated successfully, but these errors were encountered: