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

provide more traceback information about location of error in spec when swagger spec does not validate #114

Open
yiwensong opened this issue Jan 23, 2019 · 0 comments

Comments

@yiwensong
Copy link

When validating swagger, it's difficult to know which line of the swagger that is causing the issue. For example, my swagger spec had a type field with a list instead of a string. This was difficult to track in my swagger spec as there was only an error without any clues as to what the surrounding lines might look like. it would be helpful to print out part of the object that causes the error.

below is an example traceback:

...
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 171, in validate_spec
    validate_definitions(definitions, bound_deref)
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 530, in validate_definitions
    visited_definitions_ids=visited_definitions_ids,
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 501, in validate_definition
    visited_definitions_ids=visited_definitions_ids,
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 501, in validate_definition
    visited_definitions_ids=visited_definitions_ids,
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 501, in validate_definition
    visited_definitions_ids=visited_definitions_ids,
  File "/opt/venvs/swagger-tools/lib/python3.6/site-packages/swagger_spec_validator/validator20.py", line 472, in validate_definition
    raise SwaggerValidationError('type must be a string; lists are not allowed (%s)' % swagger_type)
swagger_spec_validator.common.SwaggerValidationError: type must be a string; lists are not allowed (['string', 'null'])
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