Skip to content

ARTEMIS-6219 Support _class discriminator in JSON/YAML broker properties - #6658

Merged
gtully merged 1 commit into
apache:mainfrom
lavocatt:fixjsonloader
Sep 2, 2026
Merged

ARTEMIS-6219 Support _class discriminator in JSON/YAML broker properties#6658
gtully merged 1 commit into
apache:mainfrom
lavocatt:fixjsonloader

Conversation

@lavocatt

@lavocatt lavocatt commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

JSON and YAML broker properties cannot configure interface-typed fields like storeConfiguration and HAPolicyConfiguration because hierarchical formats cannot express a key as both a scalar discriminator and an object with sub-properties simultaneously.

Introduce a reserved _class key that emits the FQCN as a .class property before processing sub-properties, leveraging the existing ClassloadingUtil instantiation path. The _class key is extracted before iterating entries, making it order-independent regardless of JSON key serialization order.

Assisted-by: Claude Opus 4.6 noreply@anthropic.com

@gtully gtully left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a nice solution to the problem.

@gtully

gtully commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

the properties have a conversion method to go from String to a class type and have the order dependency to have the special string value first.

Add reserved _class key support for interface-typed fields in JSON/YAML
broker properties. The class name was already exposed by the flat format
(e.g. storeConfiguration=org...DatabaseStorageConfiguration.class); this
makes the same mechanism available in structured formats where a JSON key
cannot simultaneously be a scalar discriminator and an object container.

Assisted-by: Claude Opus 4.6
@lavocatt

lavocatt commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

the properties have a conversion method to go from String to a class type and have the order dependency to have the special string value first.

The _class value is now emitted as-is, an users choose to use the fully qualified class name or the short name if possible

@gtully
gtully merged commit da915b1 into apache:main Sep 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants