UNPKG

openapi-examples-validator

Version:
90 lines (89 loc) 2.17 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/Cat' - $ref: '#/components/schemas/Dog' examples: 'Dog example': value: name: 'Dog 1' bark: true breed: 'Dingo' 'Cat example': value: name: 'Cat 1' hunts: true # This example don't have the optional property 'age' '404': description: unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' example: code: 1000 message: 'could not find pet' 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 properties: hunts: type: boolean age: type: integer