Reputation: 151
How can I access to an specific definition's property? I need in my 200's response to show an property in the "schema" node, not the whole "definition".
Here is the Yaml code:
paths:
/user/{user_id}:
get:
description: Devuelve un `user` pasándole su `user_id`.
produces:
- application/json
parameters:
- name: user_id
in: path
description: Identificador del `user`.
required: true
type: string
format: VarChar (255)
responses:
'200':
description: Ok
schema:
$ref: "#/definitions/User"
definitions:
User:
properties:
user_id:
type: integer
format: BigInt
description: Identificador del usuario.
email:
type: string
format: VarChar (255)
description: Email del usuario
pwd:
type: string
format: VarChar (255)
description: Password del usuario.
I mean, I just need something like this:
responses:
'200':
description: Ok
schema:
$ref: "#/definitions/User/user_id"
Any thought?
Upvotes: 0
Views: 546
Reputation: 6824
The response needs to be a proper schema. And your reference needs to follow the elements in the actual object.
If you do this:
'200':
description: Ok
schema:
$ref: "#/definitions/User/properties/user_id"
It should work fine.
Upvotes: 3