簡體   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