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
In the generation of Cookie type parameters, the required option is not being taken into account and when generating the code the @CookieValue is always required.
openapi-generator version
5.4.0, 6.0.0
OpenAPI declaration file content or url
/v1/product/{id}:
get:
tags:
- productsummary: 'Find product by given id'description: 'The user must have any permission in the application.'operationId: 'findProductById'parameters:
- name: 'id'in: 'path'description: 'ID of product to return'schema:
type: stringrequired: true
- in: 'cookie'name: CookieFalserequired: falseschema:
type: string
- in: 'cookie'name: CookieTruerequired: trueschema:
type: string
- in: 'cookie'name: CookieDefaultschema:
type: string
Generation Details
Actual
@ApiOperation(value = "Find product by given id", nickname = "findProductById",
notes = "The user must have any permission in the application.", response = ProductDTO.class, authorizations = {
@Authorization(value = "ItxApiKey")
}, tags = {"product",})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ProductDTO.class)})
@RequestMapping(
method = RequestMethod.GET,
value = "/v1/product/{id}",
produces = {"application/json"})
publicResponseEntity<ProductDTO> findProductById2(
@ApiParam(value = "ID of product to return", required = true) @PathVariable("id") Stringid,
@NotNull@ApiParam(value = "", required = true) @CookieValue("CookieTrue") StringcookieTrue,
@ApiParam(value = "") @CookieValue("CookieFalse") StringcookieFalse,
@ApiParam(value = "") @CookieValue("CookieDefault") StringcookieDefault) {
returnnewResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
Expected
@ApiOperation(value = "Find product by given id", nickname = "findProductById",
notes = "The user must have any permission in the application.", response = ProductDTO.class, authorizations = {
@Authorization(value = "ItxApiKey")
}, tags = {"product",})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ProductDTO.class)})
@RequestMapping(
method = RequestMethod.GET,
value = "/v1/product/{id}",
produces = {"application/json"})
publicResponseEntity<ProductDTO> findProductById2(
@ApiParam(value = "ID of product to return", required = true) @PathVariable("id") Stringid,
@NotNull@ApiParam(value = "", required = true) @CookieValue("CookieTrue") StringcookieTrue,
@ApiParam(value = "") @CookieValue(name = "CookieFalse", required = false) StringcookieFalse,
@ApiParam(value = "") @CookieValue(name = "CookieDefault", required = false) StringcookieDefault) {
returnnewResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
Suggest a fix
Modify cookieParams.mustache to take into account the required field.
The text was updated successfully, but these errors were encountered:
jorgerod
changed the title
[BUG] [JAVA | Spring] Fix cookie in parameters are always generated as required
[BUG][Spring] Fix cookie in parameters are always generated as required
Jun 15, 2022
Bug Report Checklist
Description
In the generation of Cookie type parameters, the
required
option is not being taken into account and when generating the code the @CookieValue is always required.openapi-generator version
5.4.0, 6.0.0
OpenAPI declaration file content or url
Generation Details
Actual
Expected
Suggest a fix
Modify cookieParams.mustache to take into account the
required
field.The text was updated successfully, but these errors were encountered: