Skip to content

defaults not checked in swagger 2.0 #36

@dtkav

Description

@dtkav

The defaults block within a parameter is not type checked in swagger 2.0 specs.
version: 0.2.3
python version: 3.6.5

(venv) ✔ ~/stash/connexion/tests/fixtures/bad_specs > cat swagger.yaml 
swagger: "2.0"

info:
  title: "{{title}}"
  version: "1.0"

basePath: /v1.0

paths:
  /welcome:
    get:
      operationId: fakeapi.foo_bar.search
      parameters:
        # The default below validates, but is obviously the wrong type
        - name: foo
          in: query
          type: integer
          default: somestring   # wrong type!!
      responses:
        200:
          description: search
          schema:
            type: object
(venv) ✔ ~/stash/connexion/tests/fixtures/bad_specs > openapi-spec-validator --schema 2.0 swagger.yaml 
OK
(venv) ✔ ~/stash/connexion/tests/fixtures/bad_specs > python
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openapi_spec_validator
>>> openapi_spec_validator.__version__
'0.2.3'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions