Golang client can use pattern-based discriminator between oneOf#18760
Conversation
|
can you please review the test failure when you've time? |
|
Would you kindly give a hint, how can I launch only particular in my cloned repo? |
|
to run the tests locally, please run you will need to run a petstore server locally: https://github.com/OpenAPITools/openapi-generator/wiki/Integration-Tests#how-to-add-integration-tests-for-new-petstore-samples |
|
@wing328 thanks for the hints. I've checked, found my bug and updated PR. Seems that tests are passing now. |
|
looks good. let's give it a try thanks for the PR |
|
FYI. I've merged #19358 to improve the handling of backtick in the pattern (regex). Please give it a try with the latest snapshot version (https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.8.0-SNAPSHOT/) and let us know if you spot any issue. |
Golang cannot read oneOf without clear discriminator, because it doesn't do validation and cannot choose between different options.
This is why I had to change decoding of oneOf from just parsing JSON to parsing + validating to select, which of oneOf options is ok. Sorry, but it seems to be the only correct way to work with oneOf
This PR works for me, but I suppose that I need to enhance it.
My example is in modules/openapi-generator/src/test/resources/3_0/go/oneof-with-pattern-discriminator.yaml
Maybe I need to put it to bin/configs?
PR checklist
master(upcoming 7.6.0 minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)