Skip to content

The example value of the request body in swagger has a "string" value #4851

Open
@ignat233

Description

@ignat233

The example value of the request body in swagger has a "string" value.

looks like https://private-user-images.githubusercontent.com/78956054/253351022-15d7b5a8-1068-405c-b997-bccb3a8e4aa0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDExNTc3ODksIm5iZiI6MTc0MTE1NzQ4OSwicGF0aCI6Ii83ODk1NjA1NC8yNTMzNTEwMjItMTVkN2I1YTgtMTA2OC00MDVjLWI5OTctYmNjYjNhOGU0YWEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAzMDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMzA1VDA2NTEyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcxYjMzN2U0OTFiZWQxZjVjNzM1NzlhMjA1ZDZmY2U3Mjg4N2NiNGY0ZjJiM2VlNGZmMmE1MjNlNDAwNDE0MTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.sAR2C33d1St_mqW4E46-0Vci6HDVaIQs6mIudessriw

For some controllers, the Example value is correct, these controllers are at the top of the list alphabetically among other controllers, and for them the open api configuration occurs earlier, judging by what I see in io.swagger.v3.jaxrs2.Reader. If you change the name of the controller class for which the example request body is not configured, so that it becomes the first in the list of controllers alphabetically, then the body will be configured correctly for it, and for some requests that previously had a request body, the body will not be configured. It looks like the controller configuration is correct. Perhaps something needs to be configured additionally, as there may be some kind of limitation.
Swagger annotation and swagger-jaxrs2 have 2.2.27 version, springdoc.version with 1.8.0 version, springdoc-openapi-starter-webmvc-ui with 2.8.2 version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions