Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples aren't supported #93

Closed
gouyou opened this issue Aug 10, 2018 · 2 comments
Closed

examples aren't supported #93

gouyou opened this issue Aug 10, 2018 · 2 comments

Comments

@gouyou
Copy link

gouyou commented Aug 10, 2018

I'm trying to use multiple examples in my OpenAPI definition but it doesn't seem to work:

openapi: 3.0.0
info:
  title: examples test
  version: 0.0.1
paths:
components:
  schemas:
    Test:
      type: object
      properties:
        test:
          type: string
      examples:
        A:
          value:
            test: a
        B:
          value:
            test: b
$ swagger-cli validate examples.yaml 
Swagger schema validation failed. 
  Data does not match any schemas from 'oneOf' at #/components/schemas/Test
    Additional properties not allowed: examples at #/components/schemas/Test
    Missing required property: $ref at #/components/schemas/Test
  Expected type object but found type null at #/paths
 
JSON_OBJECT_VALIDATION_FAILED
@JamesMessinger
Copy link
Member

The Schema object in OAS 3 doesn't support multiple examples. Only a single example property is allowed.

@gouyou
Copy link
Author

gouyou commented Aug 10, 2018

It seems that the html example at swagger.io has a mistake, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants