swagger-api / swagger-api/swagger-ui
OpenAPI 3.1.0 support: No $ref/name of nested schema but instead its showing `object` in swagger responses
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: chrome
- Version: 115.0.5790.114
- Method of installation: dist assets
- Swagger-UI version: swagger-ui-dist@5
- Swagger/OpenAPI version: OpenAPI 3.1.0
Content & configuration
Example Swagger/OpenAPI definition:
{"openapi":"3.1.0","info":{"title":"FastAPI","description":"This is a sample FastAPI application.","version":"1.0.0"},"paths":{"/items/":{"get":{"summary":"Read Items","description":"Retrieve items.","operationId":"read_items_items__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Item"}}}}}}}},"components":{"schemas":{"Item":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"integer","title":"Description"},"nested_item":{"$ref":"#/components/schemas/NestedItem"}},"type":"object","required":["name","description","nested_item"],"title":"Item"},"NestedItem":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"integer","title":"Description"}},"type":"object","required":["name","description"],"title":"NestedItem"}}}}
Describe the bug you're encountering
In the previous version of swagger with openapi 3.0.2, we used to see the reference of Nested Schema with the name of that nested schema. In the current version(5.*) with openapi 3.1.0 I can see object instead of Nested Schema reference
Expected behavior
It should show nested schema reference like below. Its working with OpenAPI 3.0.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files or tests are named. Start by loading the supplied OpenAPI 3.1.0 definition in Swagger UI 5 and compare nested $ref rendering with the reported OpenAPI 3.0.2 behavior; done means NestedItem is displayed by name rather than as object in the response schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- documentation, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100