Skip to content

feat: Change optional Open API query parameters to allow `None #318

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

Closed

Conversation

forest-benchling
Copy link
Collaborator

Fixes #285.

Instead of methods like

def sync_detailed(
    *,
    client: Client,
    size: Union[Unset, int] = UNSET,
) -> Response[Thing]:

we will now generate

def sync_detailed(
    *,
    client: Client,
    size: Union[Unset, None, int] = None,
) -> Response[Thing]:

and treat None the same as Unset.

This is a bit different from the original proposal in the linked issue, but if you scroll down you can see that it's what was agreed upon in the end IIUC (though I wasn't sure if we agreed on what the default value should be). In addition, it has the benefit of preserving back-compat.

As part of this issue, I also tried to collapse nested Optional and Union types, so that what was formerly Union[Unset, Optional[int]] or Optional[Union[Unset, int]] is now Union[Unset, None, int].

Two more minor changes I lumped into this PR:

  • Upgrading dependencies (as safety check was failing on py==1.9.0, although weirdly it was not failing in the github-actions command)
  • Adding a poetry task to just run the unit tests

packyg and others added 7 commits January 5, 2021 12:48
Collapses the child elements into one, without class heirarchy, mixins, etc

This is a replaying of 2670d11 (first implementation) and 9f5b95a (a bugfix) onto the new `main-v.0.7.0`, modified for the refactored upstream.

This should bring `main-v.0.7.1` up to par with `main` for the features we implemented in our fork (dropping our `Unset` implementation for theirs)
Add support for generating setup.py and the initially generated one
@eli-bl eli-bl deleted the forest-models branch November 26, 2024 22:44
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.

Use Optional for Query Params Instead of Union[Unset, ...]
2 participants