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

Use a Python library for validating specs #224

Merged
merged 3 commits into from Jun 10, 2018

Conversation

@sloria
Copy link
Member

commented Jun 9, 2018

Switch from check_api to prance for validating specs to avoid
having to install a global npm package for validation.

Validation requirements can be installed by adding the [validation]
extras, i.e. pip install 'apispec[validation]'

@sloria sloria force-pushed the python-spec-validation branch 2 times, most recently from 073d097 to 0ca77ea Jun 9, 2018

@@ -32,11 +32,6 @@ Setting Up for Local Development

# After activating your virtualenv
$ pip install -r dev-requirements.txt
$ npm install -g check_api

3. Install apispec in develop mode. ::

This comment has been minimized.

Copy link
@sloria

sloria Jun 9, 2018

Author Member

This is no longer necessary because pip install -r dev-requirements.txt takes care of this.

Use a Python library for validating specs
Switch from check_api to prance for validating specs to avoid
having to install a global npm package for validation.

Validation requirements can be installed by adding the [validation]
extras, i.e. pip install 'apispec[validation]'

@sloria sloria force-pushed the python-spec-validation branch from 0ca77ea to 9e32cb5 Jun 9, 2018

@lafrech

This comment has been minimized.

Copy link
Member

commented Jun 10, 2018

Sounds great.

Why not just add it to dev-requirement.txt and leave setup.py unchanged?

@sloria

This comment has been minimized.

Copy link
Member Author

commented Jun 10, 2018

This allows users to install the validation requirements so that they can use apispec.utils.validate_swagger.

@lafrech

This comment has been minimized.

Copy link
Member

commented Jun 10, 2018

You're right. I'll probably be using this in my framework to emit a warning when the generated spec is invalid. Or to validate the spec in my units tests. This is a real improvement.

@sloria

This comment has been minimized.

Copy link
Member Author

commented Jun 10, 2018

I'm also planning to rename validate_swagger to validate_spec (validate_swagger will raise a DeprecationWarning). I'll do that after merging this.

sloria added some commits Jun 10, 2018

Rename validate_swagger -> validate_spec...
...and SwaggerError -> OpenAPIError
@sloria

This comment has been minimized.

Copy link
Member Author

commented Jun 10, 2018

Went ahead with the rename as a part of this PR.

@sloria sloria merged commit 28620ad into dev Jun 10, 2018

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
pyup.io/safety-ci No dependencies with known security vulnerabilities.
Details

@sloria sloria deleted the python-spec-validation branch Oct 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.