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

Fails to validate schema type: file on responses #192

Open
kirpit opened this issue Jan 22, 2018 · 0 comments
Open

Fails to validate schema type: file on responses #192

kirpit opened this issue Jan 22, 2018 · 0 comments

Comments

@kirpit
Copy link

kirpit commented Jan 22, 2018

Hi,

Spec validation doesn't support a file type as a schema on responses and simply fails to validate:

swagger: "2.0"
info:
  version: "1.0.0"
  title: "Download app"
paths:
  /download:
    get:
      summary: "Download a file"
      produces:
      - "application/pdf"
      responses:
        200:
          description: OK
          schema:
            type: file

which is perfectly valid spec definition that you can confirm on https://editor.swagger.io/.

>>> from flex import load
>>> load('test.yml')
ValidationError                           Traceback (most recent call last)
<ipython-input-2-ba70e59f9805> in <module>()
----> 1 load('test.yml')
... // snip snip
ValidationError: 'paths':
    - '/download':
        - 'get':
            - 'responses':
                - 200:
                    - 'referenceObject':
                        - 'additionalProperties':
                            - "When `additionalProperties` is False, no unspecified properties are allowed. The following unspecified properties were found:\n\t`{'schema', 'description'}`"
                        - 'required':
                            - '$ref':
                                - 'This value is required'
                    - 'responseObject':
                        - 'schema':
                            - 'type':
                                - 'type':
                                    - 'enum':
                                        - "Invalid value. file is not one of the available options (['null', 'boolean', 'integer', 'number', 'string', 'array', 'object'])"

We can validate the same definition with no issues just by changing the type: file to type: string.

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

No branches or pull requests

1 participant