Skip to content

feat: Export Unset types from generated types.py #927

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

Merged
merged 3 commits into from
Jan 3, 2024
Merged

feat: Export Unset types from generated types.py #927

merged 3 commits into from
Jan 3, 2024

Conversation

johnthagen
Copy link
Collaborator

Closes #925

@johnthagen johnthagen changed the title Export Unset types in types.py Export Unset types from generated types.py Jan 3, 2024
@dbanty dbanty changed the title Export Unset types from generated types.py feat: Export Unset types from generated types.py Jan 3, 2024
@dbanty dbanty added this pull request to the merge queue Jan 3, 2024
Merged via the queue into openapi-generators:main with commit d9b2620 Jan 3, 2024
@johnthagen johnthagen deleted the patch-1 branch January 3, 2024 17:28
dbanty added a commit that referenced this pull request Jan 4, 2024
This PR was created by Knope. Merging it will create a new release

### Features

#### Export `Unset` types from generated `types.py` (#927)

#### Generate properties for some boolean enums

If a schema has both `type = "boolean"` and `enum` defined, a normal
boolean property will now be created.
Previously, the generator would error. 

Note that the generate code _will not_ correctly limit the values to the
enum values. To work around this, use the
OpenAPI 3.1 `const` instead of `enum` to generate Python `Literal`
types.

Thanks for reporting #922 @macmoritz!

### Fixes

#### Do not stop generation for invalid enum values

This generator only supports `enum` values that are strings or integers.
Previously, this was handled at the parsing level, which would cause the
generator to fail if there were any unsupported values in the document.
Now, the generator will correctly keep going, skipping only endpoints
which contained unsupported values.

Thanks for reporting #922 @macmoritz!

#### Fix lists within unions

Fixes #756 and #928. Arrays within unions (which, as of 0.17 includes
nullable arrays) would generate invalid code.

Thanks @kgutwin and @diesieben07!

#### Simplify type checks for non-required unions

Co-authored-by: GitHub <[email protected]>
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.

2 participants