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

feat: pass examples given in the FieldDefinition to the OpenAPIMediaType #3222

Draft
wants to merge 25 commits into
base: v3.0
Choose a base branch
from

Commits on Apr 7, 2024

  1. feat: Support schema_extra in Parameter and Body (litestar-org#…

    …3204)
    
    * feat: Support `schema_extra` in `Parameter` and `Body` (litestar-org#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]>
    2 people authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    f39864e View commit details
    Browse the repository at this point in the history
  2. feat: Added precedence of CLI parameters over envs (litestar-org#3190)

    * feat: Added precedence of CLI parameters over envs
    
    * Update docs/usage/cli.rst
    
    Co-authored-by: Peter Schutt <[email protected]>
    
    * Remove redundant LitestarEnv fields and fix tests
    
    * Update docs/usage/cli.rst
    
    * Update litestar/cli/commands/core.py
    
    * Update docs/usage/cli.rst
    
    * Update docs/usage/cli.rst
    
    * Update litestar/cli/commands/core.py
    
    ---------
    
    Co-authored-by: kedod <kedod>
    Co-authored-by: Peter Schutt <[email protected]>
    Co-authored-by: Jacob Coffee <[email protected]>
    3 people authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    085c88a View commit details
    Browse the repository at this point in the history
  3. fix: pass examples given in the FieldDefinition to the OpenAPIMediaTy…

    …pe, within request_body.py
    
    (cherry picked from commit 821d3bc)
    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    4544ed7 View commit details
    Browse the repository at this point in the history
  4. fix: move imports into type-checking block

    (cherry picked from commit 2835122)
    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    eb95a86 View commit details
    Browse the repository at this point in the history
  5. fix: ruff-format

    (cherry picked from commit 0eded49)
    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    48a1556 View commit details
    Browse the repository at this point in the history
  6. fix: add test and instance checking.

    (cherry picked from commit e6a1bb7)
    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    1cba655 View commit details
    Browse the repository at this point in the history
  7. fix: use get_formatted_examples to format examples.

    (cherry picked from commit 6336cbf)
    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    3426fe3 View commit details
    Browse the repository at this point in the history
  8. fix: pass examples given in the FieldDefinition to the OpenAPIMediaTy…

    …pe, within request_body.py
    
    (cherry picked from commit 821d3bc)
    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    d4e7401 View commit details
    Browse the repository at this point in the history
  9. fix: use get_formatted_examples to format examples.

    (cherry picked from commit 1e75753)
    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    5288f5e View commit details
    Browse the repository at this point in the history
  10. fix: improve example type-checking

    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    95b473c View commit details
    Browse the repository at this point in the history
  11. fix: remove breaking type checking.

    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    9882ea7 View commit details
    Browse the repository at this point in the history
  12. fix: remove unused import

    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    ac67c60 View commit details
    Browse the repository at this point in the history
  13. feat: Added precedence of CLI parameters over envs (litestar-org#3190)

    * feat: Added precedence of CLI parameters over envs
    
    * Update docs/usage/cli.rst
    
    Co-authored-by: Peter Schutt <[email protected]>
    
    * Remove redundant LitestarEnv fields and fix tests
    
    * Update docs/usage/cli.rst
    
    * Update litestar/cli/commands/core.py
    
    * Update docs/usage/cli.rst
    
    * Update docs/usage/cli.rst
    
    * Update litestar/cli/commands/core.py
    
    ---------
    
    Co-authored-by: kedod <kedod>
    Co-authored-by: Peter Schutt <[email protected]>
    Co-authored-by: Jacob Coffee <[email protected]>
    3 people authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    3b5cbb8 View commit details
    Browse the repository at this point in the history
  14. fix: F811 Redefinition of unused `test_run_command_arguments_preceden…

    …ce` from line 354
    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    1d54273 View commit details
    Browse the repository at this point in the history
  15. Trigger documentation build

    JacobCoffee authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    8eddfaa View commit details
    Browse the repository at this point in the history
  16. Trigger documentation build

    JacobCoffee authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    61388f1 View commit details
    Browse the repository at this point in the history
  17. feat: Add LITESTAR_ prefix before WEB_CONCURRENCY env option (litesta…

    …r-org#3227)
    
    * feat: Add LITESTAR_ prefix for web concurrency env option
    
    * Replace depacrated with versionchanged directive
    
    * Change wc option description
    
    * Remove depracation warning
    
    ---------
    
    Co-authored-by: kedod <kedod>
    kedod authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    e166797 View commit details
    Browse the repository at this point in the history
  18. feat: Support schema_extra in Parameter and Body (litestar-org#…

    …3204)
    
    * feat: Support `schema_extra` in `Parameter` and `Body` (litestar-org#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]>
    2 people authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    1c41cd1 View commit details
    Browse the repository at this point in the history
  19. Trigger documentation build

    JacobCoffee authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    cceefda View commit details
    Browse the repository at this point in the history
  20. Trigger documentation build

    JacobCoffee authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    8b8ac98 View commit details
    Browse the repository at this point in the history
  21. fix: add test and instance checking.

    (cherry picked from commit e6a1bb7)
    robswc authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    1204e80 View commit details
    Browse the repository at this point in the history
  22. feat: Support schema_extra in Parameter and Body (litestar-org#…

    …3204)
    
    * feat: Support `schema_extra` in `Parameter` and `Body` (litestar-org#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]>
    2 people authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    e3daa83 View commit details
    Browse the repository at this point in the history
  23. Trigger documentation build

    JacobCoffee authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    c01f993 View commit details
    Browse the repository at this point in the history
  24. Trigger documentation build

    JacobCoffee authored and provinzkraut committed Apr 7, 2024
    Configuration menu
    Copy the full SHA
    a8e9977 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    58108c0 View commit details
    Browse the repository at this point in the history