-
-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: openapi default values (#2587)
`Litestar.update_openapi_schema()` is called whenever we first generate the openapi schema for an app object, and whenever we register a handler on the app. Inside, we perform checks to ensure that the `OpenAPI` object has a not-none `components` attribute, and that the components attribute has a not-none schema attribute. This PR modifies the definition of the `OpenAPI` type, and the `Component` type to remove the `None` union and instantiate an instance of the respective instance on construction. Background to the change is that when addressing uncovered lines of code in the `app.py` module, I was unsure of how to hit https://github.com/litestar-org/litestar/blob/fd06486e2ad4ed0a41636659fec4f093a09e3dd0/litestar/app.py#L835. Then realised that perhaps this whole block of code: https://github.com/litestar-org/litestar/blob/fd06486e2ad4ed0a41636659fec4f093a09e3dd0/litestar/app.py#L829-L835 might be unnecessary if we adjust these default values.
- Loading branch information
1 parent
3f58ff1
commit 47281b2
Showing
7 changed files
with
16 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters