0
私はhttps://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-compositionのallOfの例をとり、parametersスキーマと応答スキーマに適用しました。しかし、私のallOfパラメーターと応答は、未定義として表示されます。 Catの代わりにPetを使うだけでうまくいきます。私はtype
フィールドがCat
定義オブジェクトに不足しているため、威張っ-エディタがundefined
を示しSWAGGERのALLOFSwaggerのallOfは定義されていないと表示されます
swagger: '2.0'
# This is your document metadata
info:
version: "0.0.0"
title: <enter your title>
# Describe your paths here
paths:
/test1:
# This is a HTTP operation
post:
description: bla bla
parameters:
- name: Pet
required: true
in: body
description: The Pet.
schema:
$ref: '#/definitions/Pet'
# Expected responses for this operation:
responses:
# Response code
200:
description: Successful response
schema:
$ref: '#/definitions/Pet'
/test2:
# This is a HTTP operation
post:
description: bla bla
parameters:
- name: Cat
required: true
in: body
description: The cat.
schema:
$ref: '#/definitions/Cat'
# Expected responses for this operation:
responses:
# Response code
200:
description: Successful response
schema:
$ref: '#/definitions/Cat'
definitions:
Pet:
type: object
discriminator: petType
properties:
name:
type: string
petType:
type: string
required:
- name
- petType
Cat:
description: A representation of a cat
allOf:
- $ref: '#/definitions/Pet'
- type: object
properties:
huntingSkill:
type: string
description: The measured skill for hunting
default: lazy
enum:
- clueless
- lazy
- adventurous
- aggressive
required:
- huntingSkill
ありがとうございました!それが私を夢中にさせていた。 – user1032531