Description
Few very minor bugs around how default values and required fields are handled in requestBodys and parameters. In particular in correct use of nullable types (?).
- Request bodies are not respecting the
required field when provided. Therefore types are not being correctly set as null-able in controller method signatures.
requestBodies:
MetaInfoBody:
required: true # no matter if set to true or false
content:
application/json:
schema:
$ref: "#/components/schemas/MetaInfo"
The above definition yields the below code no matter if required is set to true of false.
bodiesPost(@RequestBody metaInfo: MetaInfo)
- Request parameters that have default values, the types remain null-able. For example, a request parameter such as the following, which has required
false but has a default value, still set the types in the RequestParam as null-able.
components:
parameters:
Limit:
name: "limit"
in: query
required: false # required is false, but has a default
schema:
type: "integer"
minimum: 1
maximum: 50
default: 10
The above definition would yields:
@RequestParam(value = "limit", required = false, defaultValue = "10") limit: Int? // <-- still null-able
openapi-generator version
Latest release - org.openapitools:openapi-generator:2.3.2
Description
Few very minor bugs around how default values and required fields are handled in
requestBodys andparameters. In particular in correct use of nullable types (?).requiredfield when provided. Therefore types are not being correctly set as null-able in controller method signatures.The above definition yields the below code no matter if
requiredis set totrueoffalse.falsebut has a default value, still set the types in theRequestParamas null-able.The above definition would yields:
openapi-generator version
Latest release -
org.openapitools:openapi-generator:2.3.2