KinnarChowdhury
5 years agoNew Contributor
How do i define a nested class json body in a swagger file version 3.0.1
Sample of a response body Response body {
"admn_user_id": 55,
"admindetails": {
"userdetail_id": 02,
"firstname": "example1",
"lastname": "example2",
"contact_phon...
- 5 years ago
KinnarChowdhury wrote:Can I pass a schema model inside another using $ref?
Yes! Here's how:
components: schemas:
ParentSchema: type: object properties: admn_user_id: type: object example: 55 admindetails: $ref: '#/components/schemas/AdminDetails' # <------- ...
AdminDetails: type: object properties: userdetail_id: type: integer example: 2 firstname: type: string ...