Is there any way to hide Schema from the Responses and Request body parts? We only need to show Example Value. We use OpenAPI 3.
Dependency:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.9</version>
</dependency>
We can hide listed schema part by using springdoc.swagger-ui.defaultModelsExpandDepth=-1 in application.properties file.
but we want to remove the API schema part from Request Body and Responses.
I tried content= @Content(schema = @Schema(hidden = true )) but it hides whole request body/Response.
Code for Response:
@ApiResponses({
@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(name = "Success response", example = "JsonResponse..."),
mediaType = MediaType.APPLICATION_JSON_VALUE)),
@ApiResponse(responseCode = "400", description = "BAD REQUEST", content = @Content(schema = @Schema(hidden = true)))
})
Code for Request Body:
@io.swagger.v3.oas.annotations.parameters.RequestBody(
content= @Content(schema = @Schema(example="JsonRequestBody...")))
Can anyone please suggest how we can do that?
UPDATE:
We can hide the Schema part from the response like below.
@ApiResponse(responseCode = IConstants.R_str_200, content = @Content(examples=
@ExampleObject(name="SUCCESS RESPONSE",value="Json response..."),
mediaType = IConstants.MEDIA_JSONVALUE))
but still can't able to hide Schema part from Request Body.





