swagger-api / swagger-api/swagger-ui

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

Open
#10,343 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the request-body example with the affected controllers and compare it with controllers ordered first alphabetically. Start by tracing OpenAPI configuration through io.swagger.v3.jaxrs2.Reader and the listed springdoc and swagger-jaxrs2 versions. Done means the affected Swagger UI request-body examples are populated consistently without breaking controllers that already show bodies.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript, openapi, spring
Domain
api, documentation, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.