-
Notifications
You must be signed in to change notification settings - Fork 10.3k
OpenAPI document generation should emit documents with deterministic structure #59809
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
Comments
More information on this: I was able to write a transformer that minimizes the diff of the V1 API document in eShop. The transformer:
I'll publish this transformer in my aspnet-transformers-gallery project shortly. Users needing this support can use the transformer until we add the support directly in the framework. |
Hey @mikekistler, I'm seeing diffs in eshop after I build: Was this issue worked around in dotnet/eshop? |
@eerhardt Is it possible that this is just line ending difference? |
It's possible. But eshop has
In its |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
The OpenAPI document currently generated by .NET has a non-deterministic ordering of certain features such as path items, tag objects, and possibly other elements. This is problematic in situations where the OpenAPI document is generated at build time and committed to source control, because a small change in the app could generate a diff in the OpenAPI document that is simply a reordering of elements.
An example of the problem is [this PR in the eShop project], where the diff of the
src/Catalog.API/Catalog.API.json
file shows:but by sorting the files with jq, we can see that the substantive changes are much smaller:
Here only the 400 response is substantive -- the other change is a recording of the tag objects which isn't remedied by the --sort-keys feature of jq.
Describe the solution you'd like
The framework should generate the OpenAPI document with a deterministic structure, such that changes to the app will produce a new document with minimal and only "substantive" changes in the textual diff.
Additional context
No response
The text was updated successfully, but these errors were encountered: