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

p1c2u/openapi-core#296: Implements OpenAPI 3.1 validator #18

Merged
merged 2 commits into from Jan 11, 2022

Conversation

nezhar
Copy link
Contributor

@nezhar nezhar commented Aug 12, 2021

Support for draft 2020-12 has been added to jsonschema with python-jsonschema/jsonschema#817

Since there is no release at the moment, this is only a draft PR as it installs jsonschema directly from github.

The OAS31Validator has been added by extending the Draft202012Validator. The validator can be used with the draft202012_format_checker as seen in the tests.

Python 2.7 and 3.5 have been removed from the test matrix as they are end of life.

@nezhar nezhar force-pushed the master branch 2 times, most recently from 9510b0a to 294da5b Compare August 12, 2021 11:55
@nezhar
Copy link
Contributor Author

nezhar commented Aug 12, 2021

@p1c2u I would appreciate if you have any sugestions or feedback for the implementation.

I will build the support of OpenAPI 3.1 for https://github.com/p1c2u/openapi-spec-validator on top of this PR and I will use the tests provided in https://github.com/OAI/OpenAPI-Specification/tree/main/tests/v3.1

@codecov
Copy link

codecov bot commented Aug 16, 2021

Codecov Report

Merging #18 (bea387d) into master (22c5892) will increase coverage by 4.90%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #18      +/-   ##
==========================================
+ Coverage   62.29%   67.19%   +4.90%     
==========================================
  Files           6        6              
  Lines         183      189       +6     
  Branches       39       40       +1     
==========================================
+ Hits          114      127      +13     
+ Misses         54       50       -4     
+ Partials       15       12       -3     
Impacted Files Coverage Δ
openapi_schema_validator/__init__.py 100.00% <100.00%> (ø)
openapi_schema_validator/_format.py 67.05% <100.00%> (+8.72%) ⬆️
openapi_schema_validator/_types.py 100.00% <100.00%> (ø)
openapi_schema_validator/shortcuts.py 75.00% <100.00%> (ø)
openapi_schema_validator/validators.py 95.45% <100.00%> (+1.01%) ⬆️
openapi_schema_validator/_validators.py 48.33% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22c5892...bea387d. Read the comment docs.

Copy link
Collaborator

@p1c2u p1c2u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will also need:

  • coverage of definitions extended by the OAS
  • update of README with versions

requirements.txt Outdated Show resolved Hide resolved
@nezhar
Copy link
Contributor Author

nezhar commented Aug 19, 2021

We will also need:

  • coverage of definitions extended by the OAS
  • update of README with versions

README has been updated. I also made some changes to the validators, but I'm not sure which definitions are meant to be covered with this library. Are all fixed fields required such as the table here or is this out of scope?

@p1c2u
Copy link
Collaborator

p1c2u commented Aug 20, 2021

Sorry I wasn't clear enough. I meant this one:

The following properties are taken from the JSON Schema specification but their definitions have been extended by the OAS:

description - CommonMark syntax MAY be used for rich text representation.
format - See Data Type Formats for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats.

https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object

and fixed fields here

@nezhar
Copy link
Contributor Author

nezhar commented Aug 23, 2021

Sorry I wasn't clear enough. I meant this one:

The following properties are taken from the JSON Schema specification but their definitions have been extended by the OAS:
description - CommonMark syntax MAY be used for rich text representation.
format - See Data Type Formats for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats.

https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object

and fixed fields here

I added the missing fields. Should I also create new validators for the fields? I would implement them as follows:

@warmwaffles
Copy link

@nezhar and @p1c2u any updates for this?

@nezhar
Copy link
Contributor Author

nezhar commented Nov 30, 2021

@warmwaffles Currently this is waiting to be reviewed, you may try to install the fork meanwhile 🙂

@tschmidtb51
Copy link

@p1c2u Could you please add your review?

Copy link
Collaborator

@p1c2u p1c2u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just needs to be rebased

@tschmidtb51
Copy link

@nezhar please rebase.

@nezhar
Copy link
Contributor Author

nezhar commented Jan 10, 2022

@p1c2u @tschmidtb51 PR is rebased 🙂

@p1c2u
Copy link
Collaborator

p1c2u commented Jan 11, 2022

@nezhar thank you for the contribution

@p1c2u p1c2u merged commit d2a7eab into python-openapi:master Jan 11, 2022
@tschmidtb51
Copy link

@p1c2u Thanks for merging.

@p1c2u p1c2u mentioned this pull request Jan 25, 2022
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

Successfully merging this pull request may close these issues.

None yet

5 participants