oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

Support unions with multiple mappings pointing to a single underlying type

Open tobio opened this issue 5 months ago • 2 comments

Fixes https://github.com/oapi-codegen/oapi-codegen/issues/1530 Fixes https://github.com/oapi-codegen/oapi-codegen/issues/1664

This PR:

  • Correctly generates the ValueByDiscriminator function when multiple discriminator values map to a single type
  • Prevents From*/Merge* functions from setting an arbitrary discriminator in the case where there isn't a 1:1 mapping between type and discriminator value

tobio avatar Sep 02 '25 12:09 tobio

Kusari Inspector

Kusari Analysis Results:

Proceed with these changes
✅ No Flagged Issues Detected All values appear to be within acceptable risk parameters.

No pinned version dependency changes, code issues or exposed secrets detected!

@kusari-inspector rerun - Trigger a re-analysis of this PR @kusari-inspector feedback [your message] - Send feedback to our AI and team See Kusari's documentation for setup and configuration. Commit: 71958afa46343ea2343563dd11e3bed038e39ea7, performed at: 2025-09-02T12:57:33Z

Found this helpful? Give it a 👍 or 👎 reaction!

kusari-inspector[bot] avatar Sep 02 '25 12:09 kusari-inspector[bot]

@jamietanna are you able to take a look at this one?

tobio avatar Sep 23 '25 01:09 tobio