Skip to content

add backward compatibility for exclusiveMinimum and exclusiveMaximum #1092

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 4 commits into from
Aug 25, 2024
Merged

add backward compatibility for exclusiveMinimum and exclusiveMaximum #1092

merged 4 commits into from
Aug 25, 2024

Conversation

mikkelam
Copy link
Contributor

@mikkelam mikkelam commented Aug 10, 2024

This PR ensures backward compatibility in the schema validator for the exclusiveMinimum and exclusiveMaximum properties, handling both the boolean format from OpenAPI v3.0 and the numeric format from v3.1.

Documentation for this can be found here: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0 under the Tweak exclusiveMinimum and exclusiveMaximum section

Changes Made:

  • Updated the Schema class to handle both boolean (v3.0) and numeric (v3.1) formats for exclusiveMinimum and exclusiveMaximum.
  • Added a handle_exclusive_min_max method to ensure that the schema is correctly validated and converted based on the OpenAPI version.
  • Added tests to ensure the correct behavior for both formats of exclusiveMinimum and exclusiveMaximum.

@dbanty dbanty changed the title fix: add backward compatibility for exclusiveMinimum and exclusiveMax… add backward compatibility for exclusiveMinimum and exclusiveMaximum Aug 25, 2024
Copy link
Collaborator

@dbanty dbanty left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@dbanty dbanty added this pull request to the merge queue Aug 25, 2024
Merged via the queue into openapi-generators:main with commit b20d240 Aug 25, 2024
19 checks passed
@knope-bot knope-bot bot mentioned this pull request Aug 25, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 25, 2024
> [!IMPORTANT]
> Merging this pull request will create this release

## Fixes

### Allow OpenAPI 3.1-style `exclusiveMinimum` and `exclusiveMaximum`

Fixed by PR #1092. Thanks @mikkelam!

### Add missing `cast` import when using `const`

Fixed by PR #1072. Thanks @dorcohe!

### Correctly resolve references to a type that is itself just a single
allOf reference

PR #1103 fixed issue #1091. Thanks @eli-bl!

### Support `const` booleans and floats

Fixed in PR #1086. Thanks @flxdot!

Co-authored-by: knope-bot[bot] <152252888+knope-bot[bot]@users.noreply.github.com>
micha91 pushed a commit to micha91/openapi-python-client that referenced this pull request May 13, 2025
…penapi-generators#1092)

This PR ensures backward compatibility in the schema validator for the
exclusiveMinimum and exclusiveMaximum properties, handling both the
boolean format from OpenAPI v3.0 and the numeric format from v3.1.

Documentation for this can be found here:
https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0
under the `Tweak exclusiveMinimum and exclusiveMaximum` section

Changes Made:

- Updated the Schema class to handle both boolean (v3.0) and numeric
(v3.1) formats for exclusiveMinimum and exclusiveMaximum.
- Added a handle_exclusive_min_max method to ensure that the schema is
correctly validated and converted based on the OpenAPI version.
- Added tests to ensure the correct behavior for both formats of
exclusiveMinimum and exclusiveMaximum.

---------

Co-authored-by: Dylan Anthony <dbanty@users.noreply.github.com>
Co-authored-by: Dylan Anthony <43723790+dbanty@users.noreply.github.com>
micha91 pushed a commit to micha91/openapi-python-client that referenced this pull request May 13, 2025
> [!IMPORTANT]
> Merging this pull request will create this release

## Fixes

### Allow OpenAPI 3.1-style `exclusiveMinimum` and `exclusiveMaximum`

Fixed by PR openapi-generators#1092. Thanks @mikkelam!

### Add missing `cast` import when using `const`

Fixed by PR openapi-generators#1072. Thanks @dorcohe!

### Correctly resolve references to a type that is itself just a single
allOf reference

PR openapi-generators#1103 fixed issue openapi-generators#1091. Thanks @eli-bl!

### Support `const` booleans and floats

Fixed in PR openapi-generators#1086. Thanks @flxdot!

Co-authored-by: knope-bot[bot] <152252888+knope-bot[bot]@users.noreply.github.com>
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