繁体   English   中英

YAML针对单个状态码的多个响应

[英]YAML Multiple response for single status code

使用yaml格式的单个状态代码为我提供多个响应正文。

例如:

'401':
  description: Not Found
  headers:
    Content-Type :
      type: string
      default: application/json;charset=UTF-8
  examples:
    errorCode: '48'
    errorLabel: RONotAllowed
    errorDescription: Unable to execute the remote operation as it is not allowed for the vehicle
'401':
  description: Not Found
  headers:
    Content-Type :
      type: string
      default: application/json;charset=UTF-8
  examples:
    errorCode: '45'
    errorLabel: VehicleNotFound
    errorDescription: Vehicle could not be found using VIN provided  in request
'401':
  description: Not Found
  headers:
    Content-Type :
      type: string
      default: application/json;charset=UTF-8
  examples:
    errorCode: '49'
    errorLabel: VehicleAlreadyOnline
    errorDescription: Unable to execute the remote operation since   vehicle is already online

使用以上代码,我在第608行第9列“ 401”中发现了错误✖YAML语法错误重复的映射键

如果我对此理解正确,那么您正在尝试提供错误代码示例的列表。 为此,您需要:

'401':
  description: Not Found
  headers:
    Content-Type :
      type: string
      default: application/json;charset=UTF-8
  examples:
    - errorCode: '48'
      errorLabel: RONotAllowed
      errorDescription: 'Unable to execute the remote operation as it is not allowed for the vehicle'
    - errorCode: '45'
      errorLabel: VehicleNotFound
      errorDescription: 'Vehicle could not be found using VIN provided  in request'
    - errorCode: '49'
      errorLabel: VehicleAlreadyOnline
      errorDescription: 'Unable to execute the remote operation since   vehicle is already online'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM