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

refactor: removes deprecated OpenAPIController #3297

Closed
wants to merge 5 commits into from

Conversation

peterschutt
Copy link
Contributor

Description

This PR removes all deprecated elements of OpenAPIConfig and the OpenAPIController, removes any obsolete tests and refactors tests that were parametrized to test both OpenAPIController and the router-based approach.

Supersedes #3271

Closes

Copy link

codecov bot commented Mar 31, 2024

Codecov Report

Attention: Patch coverage is 90.47619% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 98.24%. Comparing base (43e3041) to head (d093a47).

Files Patch % Lines
litestar/_openapi/schema_generation/schema.py 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             v3.0    #3297      +/-   ##
==========================================
- Coverage   98.26%   98.24%   -0.02%     
==========================================
  Files         322      321       -1     
  Lines       14733    14570     -163     
  Branches     2343     2317      -26     
==========================================
- Hits        14477    14314     -163     
  Misses        117      117              
  Partials      139      139              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

+====================================================+========================================================================+
| **OpenAPI** |
+----------------------------------------------------+------------------------------------------------------------------------+
| ``litestar.openapi.OpenAPIController`` | :mod:`.openapi.plugins` |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is really an appropriate import redirection, but I mainly just wanted to keep the structure of the table in place so its there to fill out for other things.

docs/conf.py Show resolved Hide resolved
whats-new-2
3.x Changelog <https://litestar.dev/3-dev/release-notes/changelog.html>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will we be starting a new changelog document for the 3.x series, or just continue on with the existing changelog and add the 3.x stuff at the top? At the moment, this points to the 2.x changelog document?

Copy link
Member

Choose a reason for hiding this comment

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

New one for 3.0 preferably

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And does the 2.x changelog still exist in the 3.0 branch, or do I just delete everything from the existing one and change the document title?

"What's new in 2.0": "release-notes/whats-new-2",
"3.x Changelog": "https://docs.litestar.dev/3-dev/release-notes/changelog.html",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here, will this be a totally new doc?

+====================================================+========================================================================+
| **OpenAPI** |
+----------------------------------------------------+------------------------------------------------------------------------+
| ``litestar.openapi.OpenAPIController`` | :mod:`.openapi.plugins` |
Copy link
Member

Choose a reason for hiding this comment

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

not sure if this is a good idea or not but what if we add, in v3 branch only, an intersphinx link to Litestar v2 docs so was can directly link things like litestar.openapi.OpenAPIController? Idk if it would even work.. just a thought

tuukkamustonen and others added 5 commits April 10, 2024 07:27
* feat: Support `schema_extra` in `Parameter` and `Body` (#3022)

This adds sort of a backdoor for modifying the generated OpenAPI spec.

The value is given as `dict[str, Any]` where the key must match with the
keyword parameter name in `Schema`. The values are used to override items in
the generated `Schema` object, so they must be in correct types (ie. not in
dictionary/json format).

The values are added at main level, without recursive merging (because we're
adjusting `Schema` object and not a dictionary). Recursive merge would be much
more work.

Chose not to implement the same for `ResponseSpec` because response models are
generated as schema components, while `ResponseSpec` can be locally different.
Handling the logic of creating new components when `schema_extra` is passed in
`ResponseSpec` would be extra effort, and isn't probably as important as being
able to adjust the inbound parameters, which are actually validated (and for
which the documentation is even more important, than for the response).

* Update litestar/params.py

Co-authored-by: Jacob Coffee <[email protected]>

* Update litestar/params.py

Co-authored-by: Jacob Coffee <[email protected]>

* Update litestar/params.py

Co-authored-by: Jacob Coffee <[email protected]>

---------

Co-authored-by: Jacob Coffee <[email protected]>
This PR removes all deprecated elements of OpenAPIConfig and the OpenAPIController, removes any obsolete tests and refactors tests that were parametrized to test both OpenAPIController and the router-based approach.
This adds a what's new section for the v3 docs and seeds it with migration details for the OpenAPI plugins.
Copy link

sonarcloud bot commented Apr 9, 2024

Copy link

github-actions bot commented Apr 9, 2024

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3297

@peterschutt peterschutt closed this Apr 9, 2024
@peterschutt peterschutt deleted the remove-openapi-controller branch April 11, 2024 04:38
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.

4 participants