Skip to content

Use Rune FQNs for enum choice dispatch - #338

Closed
plamen-neykov wants to merge 1 commit into
fix-circular-import-errorfrom
fix/choice-enum-dispatch-fqn
Closed

plamen-neykov wants to merge 1 commit into
fix-circular-import-errorfrom
fix/choice-enum-dispatch-fqn

Conversation

@plamen-neykov

Copy link
Copy Markdown
Contributor

Summary

Enum choice options currently use unqualified option names in
_CHOICE_DISPATCH. The runtime uses these keys when reading and writing
choice discriminators, so enum options serialize without their Rune FQN.

Generate fully qualified keys for enums, following the existing handling
of data types.

For example:

  • Before: "Currency": "Currency"
  • After: "example.basicmetadata.Currency": "Currency"

This also handles enum aliases and enum leaves within nested choices.
Metadata annotations do not change the discriminator. Primitive keys such
as "string" and Python option field names remain unchanged.

Compatibility

Models must be regenerated to receive the corrected dispatch tables.
Enum choice discriminators change from the option name to the enum's Rune
FQN. The runtime needs no further changes to consume these entries.

Validation

mvn -Dtest=PythonChoiceDispatchTest test

All 17 tests passed, including coverage for:

  • Direct enum and data-type options.
  • Metadata-bearing enum and string options.
  • Chained enum aliases.
  • Enum discriminator propagation through nested choices.

Generate enum discriminator keys from the Rune fully qualified name,
including enum aliases and options inside nested choices.

Preserve primitive option keys and Python field names. Update the
documentation and add regression coverage for metadata, aliases,
and nested enum options.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants