Yaml 在Swagger中访问定义的特定属性
如何访问特定定义的属性?我需要在200的响应中显示“schema”节点中的属性,而不是整个“definition” 以下是Yaml代码:Yaml 在Swagger中访问定义的特定属性,yaml,swagger,Yaml,Swagger,如何访问特定定义的属性?我需要在200的响应中显示“schema”节点中的属性,而不是整个“definition” 以下是Yaml代码: paths: /user/{user_id}: get: description: Devuelve un `user` pasándole su `user_id`. produces: - application/json
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.
我是说,我只需要这样的东西:
responses:
'200':
description: Ok
schema:
$ref: "#/definitions/User/user_id"
有什么想法吗?响应需要是一个正确的模式。引用需要遵循实际对象中的元素 如果您这样做:
'200':
description: Ok
schema:
$ref: "#/definitions/User/properties/user_id"
它应该可以正常工作。响应需要是一个正确的模式。引用需要遵循实际对象中的元素 如果您这样做:
'200':
description: Ok
schema:
$ref: "#/definitions/User/properties/user_id"
它应该很好用