Swagger does not correctly show schema for nested response data
See original GitHub issueBug Report
Current behavior
Consider the Cat sample, but the cat entity contains a “preferredFood” field that is the cat’s preferred food as a “Food” entity and the Food entity, in turn, contains a field “vendor” that is a Vendor entity that supplies the food. When rendering swagger for the Cat API, we see the details of the preferredFood field’s object, but we see only that the “vendor” field is an object, but no details about that object.
Input Code
https://github.com/pvogel1967/11-swagger
Expected behavior
Cat > {
age , etc.
preferredFood > {
weight, etc.
vendor > {
name: string
example: Purina
The name of the vendor
address: string
example: 1600 Pennsylvania Ave, N.W., Washington, DC. 20500
The mailing address of the vendor
}
}
}
Possible Solution
Environment
Nest version: 7.6.15
For Tooling issues:
- Node version: 14.15.5
- Platform: Mac
Others:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Swashbuckle nested responses not showing up correctly
The issue I'm having is the response schema isn't showing up correctly if the response has another object within it. While using Swagger...
Read more >Solved: Defining Nested Data in Response Schema
Solved: I'm trying to define a schema for a response in the Yaml for my API and this includes a field being an...
Read more >Using $ref - Swagger
OAS 3 This guide is for OpenAPI 3.0. Using $ref. When you document an API, it is common to have some features which...
Read more >Swagger PUT/POST body value issue
However, when we PUT or POST data via the Swagger UI, we see issues where Swagger is missing an extra JSON wrapper around...
Read more >F.A.Q - Springdoc-openapi
How can I map Pageable (spring-data-commons) object to correct ... Otherwise, the swagger documentation will not show the fields of the annotated entity....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Something wrong with schemas. Temporary solution. You can use oneOf keyword and getSchemaPath method:
Docs: https://docs.nestjs.com/openapi/types-and-parameters
Would you like to create a PR for this issue?