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
Annotating class with @Schema(additionalProperties = AdditionalPropertiesValue.FALSE) does not produce JSON/YAML with additionalProperties: false
#4316
Closed
Shiva-kss opened this issue
Nov 23, 2022
· 0 comments
I have this class with annotation: @Schema(additionalProperties = AdditionalPropertiesValue.FALSE)
public class AuditSearchCriteria implements Serializable {
To Reproduce
SpringBoot: 2.6.7
springdoc-openapi-ui, springdoc-openapi-hateoas, springdoc-openapi-data-rest, springdoc-openapi-security: all version 1.6.12
swagger-core : 2.2.4
MyController looks where I use AuditSearchCriteria
@RestController
@RequestMapping("/audit")
@Tag(name = "auditLog", description = "Audit Logging API")
@SecurityRequirements({@SecurityRequirement(name = "basicAuthN")})
public class AuditLogController {
....
@RequestMapping(value = "/search", method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
@PerformanceMetrics(sla = 500)
@Operation(summary = "Returns List of Audit Log records based on the matching search critera", description = "Returns list of Audit Log records matching the search critera. SLA:500", responses = {
@ApiResponse(responseCode = "200", description = "Successful retrieval of list of Audit Log records matching the search criteria", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = AuditLogDTO.class)) }),
@ApiResponse(responseCode = "400", description = "Invalid input provided", content = { @Content(mediaType = "application/json")}),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = { @Content(mediaType = "application/json")}),})
public List<AuditLogDTO> searchAuditLog(
@Parameter(description = "Page number for the search results", example = "1", required = false) @RequestParam(value = "page", defaultValue = "1", required = false) Integer page,
@Parameter(description = "Size of the page", example = "1", required = false) @RequestParam(value = "size", defaultValue = "100", required = false) Integer size,
@Parameter(description = "Audit Search criteria", example = "1", required = true) @RequestBody @Valid AuditSearchCriteria auditSearchCriteria,
BindingResult errors, HttpServletRequest request) throws BindException {
I have this class with annotation:
@Schema(additionalProperties = AdditionalPropertiesValue.FALSE)
public class AuditSearchCriteria implements Serializable {
When looking at JSON/YAML at my
http://localhost:8080/v3/api-docs/groupName
I expect that output for this component will include "additionalProperties: false"
e.g.
But I see
To Reproduce
SpringBoot: 2.6.7
springdoc-openapi-ui, springdoc-openapi-hateoas, springdoc-openapi-data-rest, springdoc-openapi-security: all version 1.6.12
swagger-core : 2.2.4
MyController looks where I use AuditSearchCriteria
Also to simplify things I just took demo project from here: https://github.com/springdoc/springdoc-openapi-demos
and picked this one: springdoc-openapi-book-service
And all I did is in Book.java file changed to this
And then run application, got to http://localhost:8080/v3/api-docs and expected this (when converting JSON to YAML)
But instead got the same thing w/o additionalProperties
The text was updated successfully, but these errors were encountered: