UNPKG

openapi-examples-validator

Version:
117 lines (116 loc) 2.86 kB
openapi: 3.0.0 info: version: 1.0.0 title: Swagger Petstore license: name: MIT servers: - url: 'http://petstore.swagger.io/v1' paths: '/pets/{petId}': get: summary: Info for a specific pet operationId: showPetById parameters: - name: petId in: path required: true description: The id of the pet to retrieve schema: type: string responses: '200': description: successful response content: application/json: schema: oneOf: - $ref: '#/components/schemas/Bird' - $ref: '#/components/schemas/Cat' - $ref: '#/components/schemas/Dog' examples: 'Dog example': value: name: 'Dog 1' bark: true breed: 'Dingo' 'Cat example': value: name: 'Cat 1' hunts: true age: 3 'Bird example': value: name: 'Birb' sizeWings: 'smol' '404': description: unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' example: code: 1000 message: 'could not find pet' extra_property: 'test' # not allowed and outside of JSON schema combiner, should be picked up components: schemas: Error: type: object properties: code: type: number message: type: string Pet: type: object required: - name properties: name: type: string Dog: allOf: - $ref: '#/components/schemas/Pet' - type: object required: - bark - breed properties: bark: type: boolean breed: type: string enum: [ Dingo, Husky, Retriever, Shepherd ] Cat: allOf: - $ref: '#/components/schemas/Pet' - type: object required: - hunts - age properties: hunts: type: boolean age: type: integer Bird: anyOf: - type: object required: - name - sizeWings properties: name: type: string sizeWings: type: string - type: object required: - name - eggSize properties: name: type: string sizeEggs: type: string