-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
So I'm trying to generate the swagger API from code with swagger annotations.
It all works well except Problem.statusType
field.
Description
I am describing my endpoint's responses like this:
@Operation(
description = "Retrieve entity by id",
responses = {
@ApiResponse(
responseCode = "404",
description = "Entity not found",
content = @Content(
schema = @Schema(implementation = Problem.class),
mediaType = APPLICATION_PROBLEM_JSON_VALUE))})
But because Problem.statusType
field is not an integer as per API specification, but a class – the generated swagger output is wrong.
Expected Behavior
The following component are generated for swagger yaml:
Problem:
type: object
properties:
instance:
type: string
format: uri
type:
type: string
format: uri
parameters:
type: object
additionalProperties:
type: object
title:
type: string
status:
type: integer # <------- this
detail:
type: string
Actual Behavior
The following components are generated for swagger yaml:
Problem:
type: object
properties:
...
status:
$ref: '#/components/schemas/StatusType'
StatusType:
type: object
properties:
statusCode:
type: integer
format: int32
reasonPhrase:
type: string
Possible Fix
Do you think this can be fixed at the library level? Or should I create a bug in problem spring web adapter better?
bushwakko and steam0