Open danilopiazza opened 1 month ago
Given a [request body(https://spec.openapis.org/oas/v3.0.3#request-body-object) with "required": false:
"required": false
"paths": { "/request-body/optional": { "post": { "requestBody": { ... "required": false }, ... } }
when generating JAX-RS code with OpenApi2JaxRs, method parameters representing the request body have the @NotNull annotation, as if they were required:
OpenApi2JaxRs
@NotNull
@Path("/optional") @POST @Consumes("application/json") void optionalRequestBody(@NotNull Content data);
I believe the @NotNull annotation should only be present when the request body has the "required": true property.
"required": true
I don't know whether the code generator should add a @Nullable annotation when required is false (or missing), or no annotation at all.
@Nullable
required
false
Given a [request body(https://spec.openapis.org/oas/v3.0.3#request-body-object) with
"required": false
:when generating JAX-RS code with
OpenApi2JaxRs
, method parameters representing the request body have the@NotNull
annotation, as if they were required:I believe the
@NotNull
annotation should only be present when the request body has the"required": true
property.