0
私はallOf
を使用して、このswagger API継承のものを理解しようとしています。これは私のすばらしいyamlファイルです。スワッガー:追加のプロパティは許可されていません:allOf
swagger: '2.0'
info:
title: Test API
version: '1'
basePath: /api/v1
schemes:
- https
produces:
- application/json
paths:
/users:
get:
summary: Collection of users
tags:
- users
responses:
200:
description: A list of Users
schema:
$ref: "#/definitions/Users"
500:
$ref: "#/responses/BadRequest"
definitions:
User:
required:
- username
properties:
firstName:
type: string
lastName:
type: string
username:
type: string
Users:
type: array
items:
$ref: "#/definitions/User"
responses:
NonSuccess:
description: Generic response for all non-success responses
schema:
type: object
required:
- code
- message
properties:
code:
type: integer
description: The success code, 0 or -1.
message:
type: string
description: The description message for this success code
errors:
type: array
description: A map of errors within the request. Keyed by the parameter name and the values are the error details
BadRequest:
description: Invalid request parameters
allOf:
- $ref: "#/responses/NonSuccess"
私はonline editorにこれを貼り付けるとき、私は私が把握しようと本当の苦労を抱えている、次のエラーが発生します。
✖ Swagger Error
Additional properties not allowed: allOf
Jump to line 60
✖ Swagger Error
Not a valid response definition
Jump to line 22
主な問題Additional properties not allowed: allOf
のようだと私は、私はこのケースでは間違ってやっているかを把握するように見えることはできません。私は基本的な不成功応答を宣言しようとしていたので、200以外のすべての応答が継承され、APIは非常に標準的な見えない不成功応答を持つようになりました。私はallOf
とこれを行うことができた印象の下にあったし、その応答からフィールドを追加または上書きします。私は間違って何をしているのですか?
ええと、これは私が終わった場所です。 – SynackSA