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

ENUM changes #303

Closed
jackbilestech opened this issue Dec 17, 2021 Discussed in #292 · 4 comments · Fixed by #552
Closed

ENUM changes #303

jackbilestech opened this issue Dec 17, 2021 Discussed in #292 · 4 comments · Fixed by #552
Milestone

Comments

@jackbilestech
Copy link

Discussed in #292

Originally posted by Roman-Bober November 25, 2021
Hi,
I wonder why enum changes gives "brocken backward compatability"
Shouldn't be if enum is added at the end of enum list it should be backward compatible?

Thank you,
Roman

I too am seeing the above issue whe appending an item to a string enum.

jackbilestech added a commit to jackbilestech/openapi-diff that referenced this issue Dec 17, 2021
@cTAbdIsi
Copy link

cTAbdIsi commented Jan 7, 2022

@jackbilestech Changes to enums are not breaking in every programming language or in Java it is breaking and causes runtime errors. That is why Zalando works with x-extensible-enum https://opensource.zalando.com/restful-api-guidelines/#112.

There are numerous solutions on the market, but no official ones in the OpenAPI standard.

@joschi
Copy link
Collaborator

joschi commented Feb 28, 2022

See also: #292 (comment)

While it's up to the specific implementation of clients how to act on the change, adding a previously invalid value to an existing enum is a breaking change in my opinion.

@doshidhaval
Copy link

We might be able to reach a decision here, but can we add a parameter to the CLI to allow us to treat ENUM as a breaking change or not. Something similar to https://openapi-generator.tech/docs/generators/java enumUnknownDefaultCase parameter does

@mcwhitak
Copy link

mcwhitak commented May 16, 2022

To echo what @doshidhaval said, an enum addition can be considered a compatible change if a default case exists (say: UNKNOWN) but otherwise is breaking.

This gets thornier when considering evolution over time however (imagine changing a default enum value to something that previously didn't exist).

westse added a commit to westse/openapi-diff that referenced this issue Jun 15, 2023
- Addresses issue OpenAPITools#303
- Default behavior unchanged to not allow response enum additions.
- Adds option to allow response enum additions, both in CLI and programmatically
- Tests added for new behavior related to lenient vs strict response enum behavior
- Tests also added for request enum behavior (which has been left unchanged).
@joschi joschi added this to the 2.1.0 milestone Dec 16, 2023
joschi pushed a commit that referenced this issue Dec 16, 2023
config-file and config-prop CLI options

- Gives user fine-grained control of what constitutes an incompatibile change.

Maven plugin config parameters

- configFiles param for a separate yaml config file Corresponds to CLI --config-file option.
- configProps param for specifying config props in pom.xml. Corresponds to CLI --config-prop option.
- OpenApiDiffMojoTest updated to verify parameters work.

Relies on recent exhaustive testing of incompatible checks to ensure no regressions (see #545).

Fix #551
Fix #550
Fix #303
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants