Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modifies Goa's OpenAPI v3 generator to prevent de-duplication of explicit user types in the generated schema. this should address #3242. Presently, structurally similar types defined in the DSL e.g.:
Will result in a single entry in the generated v3 schema with an arbitrary name. After this change,
Payload1
andPayload2
are generated as independent, named entries in the schema e.g.Issues
If you rely on type deduplication to generate your v3 schema, this may cause problems.
Testing
I've added a test case for this case and have formatted the test fixtures to a common style (hence the large diff). I'm currently using this fork to generate our public API docs and things are looking good.
Previous approach
As discussed with @raphael earlier, I've been looking at some ideas for fixing #3242. This PR takes a very dumb approach of merging
openapi:typename
tags into every Result and Payload DSL node, using the name from the endpoint.This feels pretty bad and that's reflected in the fact that I've got test failures in quite a few places as a result of this. I do feel like this change should be taking place entirely within the
openapiv3
package given that the problem appears to manifest only when generating OpenAPI v3 specs.I am pretty new to Go and very new to Goa so I'd appreciate some eyes and advice on this if anyone has the time.