-
-
Notifications
You must be signed in to change notification settings - Fork 68
p1c2u/openapi-core#296: Implements OpenAPI 3.1 spec validator #128
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #128 +/- ##
==========================================
+ Coverage 98.14% 98.49% +0.34%
==========================================
Files 19 19
Lines 538 530 -8
==========================================
- Hits 528 522 -6
+ Misses 10 8 -2
Continue to review full report at Codecov.
|
The PR has been updated to also use the |
One thing I noticed it's |
Fixed 🙂 |
@nezhar What is the current status? |
This PR is currently waiting for python-openapi/openapi-schema-validator#18 to be resolved |
@p1c2u any chance of getting this merged? |
@p1c2u Could you please add your review? |
ed6a750
to
e905ee0
Compare
@p1c2u This is now based on |
Version 3.1 is missing as an option in command line parser (see |
Also need to add information about versions to the |
Python 2.7 and 3.5 support drop can be extracted to separate commit/PR (which is #137) |
This PR needs to be rebased after #137 is resolved |
9727d9f
to
fb0c8ce
Compare
openapi_spec_validator/validators.py
Outdated
@@ -339,10 +341,10 @@ def __init__(self, dereferencer): | |||
|
|||
@wraps_errors | |||
def iter_errors(self, schema, value): | |||
validator = OAS30Validator( | |||
validator = OAS31Validator( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be dependent of which spec we use? Otherwise we will use OAS31Validator for all specs? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I will look into this, create a test case and cover it in a dedicated PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really have any information about the spec at this step. I would sugest that we add The validator class and the format checker instance as two additional configuration parameters to the SpecValidator
openapi_v30_spec_validator = SpecValidator(
openapi_v30_validator_factory,
resolver_handlers=default_handlers,
validator_class=OAS30Validator,
format_checker=oas30_format_checker
)
This also means they need to be propagated on each new validator class. What are your thoughts about this or do you have any other suggestions?
openapi_spec_validator/validators.py
Outdated
schema, | ||
resolver=self.dereferencer.resolver_manager.resolver, | ||
format_checker=oas30_format_checker, | ||
format_checker=oas31_format_checker, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Shouldn't this be dependent of which spec we use? Otherwise we will use OAS31Validator for all specs? 🤔
As mentioned in python-openapi/openapi-schema-validator#18 this is the extension for OpenAPI 3.1.
It is created as draft as it install
jsonschema
andopenapi-schema-validator
via GitHub in order to use the latest changes for Draft 2020-12.The test cases provided in https://github.com/OAI/OpenAPI-Specification/tree/main/tests/v3.1 are used for the implementation.
Python 2.7 and 3.5 have been removed from the test matrix as they are end of life.
I'm open for sugestions if any changes are required in the PR.