-
-
Notifications
You must be signed in to change notification settings - Fork 228
fix!: oai schema validation false negatives (vendored openapi_schema_pydantic update) #426
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
fix!: oai schema validation false negatives (vendored openapi_schema_pydantic update) #426
Conversation
- correct: W293, W291, F821
da4ddec
to
b312cd0
Compare
3810aa5
to
986bf2b
Compare
- anyOf, allOf, oneOf now default to `None` instead of `[]`
bbdc1f2
to
f1cdd88
Compare
Codecov Report
@@ Coverage Diff @@
## main #426 +/- ##
===========================================
- Coverage 100.00% 99.87% -0.13%
===========================================
Files 47 48 +1
Lines 1548 1586 +38
===========================================
+ Hits 1548 1584 +36
- Misses 0 2 +2
Continue to review full report at Codecov.
|
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.
PR ready for review @dbanty
openapi_python_client/schema/openapi_schema_pydantic/callback.py
Outdated
Show resolved
Hide resolved
openapi_python_client/schema/openapi_schema_pydantic/external_documentation.py
Outdated
Show resolved
Hide resolved
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.
Thanks for doing this! I think we should make a few changes though, as I'm not sure what exists upstream is necessarily what's best for this project (which is why I vendored it). Adding Callback and fixing Headers seem like the main two benefits here, maybe we can just keep those.
openapi_python_client/schema/openapi_schema_pydantic/callback.py
Outdated
Show resolved
Hide resolved
openapi_python_client/schema/openapi_schema_pydantic/components.py
Outdated
Show resolved
Hide resolved
bba6e33
to
b0dd28a
Compare
ac61bda
to
b552181
Compare
- Mypy do not well support it to declare `undefined` value
- For support of OAI vendor extension
ff7950f
to
e58f790
Compare
Finally getting back around to this so I can add it to the upcoming breaking release. Sorry it took so long 😅 but the changes are over in #568 now so I can update with the latest from |
The vendored openapi_schema_pydantic seems to be old? It have some bugs that are resolved on its last up to date version.
As for exemple, the following oai content --
headers
definition will raise a false negative oai validation error:The actual vendored version wrongly only accept
reference
as header definition:https://github.com/triaxtec/openapi-python-client/blob/0f58cfd4fc985ba871b3d2694d861c7f595dcb81/openapi_python_client/schema/openapi_schema_pydantic/encoding.py#L25
Resolved:
https://github.com/P1sec/openapi-python-client/blob/607a22109c93c885e24b20c0847436a5b32fa184/openapi_python_client/schema/openapi_schema_pydantic/encoding.py#L25
This PR update the vendored version and backport to it tiny changes that was made to it.
Some fixes bring internal breaking changes, as exemple, schema
oneOf
,anyOf
that was defaulting to a shared list reference:https://github.com/triaxtec/openapi-python-client/blob/0f58cfd4fc985ba871b3d2694d861c7f595dcb81/openapi_python_client/schema/openapi_schema_pydantic/schema.py#L244
Are now defaulting to
None
value:https://github.com/kuimono/openapi-schema-pydantic/blob/0836b429086917feeb973de3367a7ac4c2b3a665/openapi_schema_pydantic/v3/v3_0_3/schema.py#L243
I also consider it to bring external breaking change, since the OAI validation is now way more strict. Existing OAI definitions that was accepted may now raise validation errors.