ARTEMIS-5372: Add JSON-schema validation for broker properties#6484
Draft
lavocatt wants to merge 1 commit into
Draft
ARTEMIS-5372: Add JSON-schema validation for broker properties#6484lavocatt wants to merge 1 commit into
lavocatt wants to merge 1 commit into
Conversation
Generates a JSON Schema (Draft 7) describing all valid broker.properties configuration options. Built from multiple sources: Java reflection on ConfigurationImpl, XSD constraints, JavaDoc, source constants, and factory parameter discovery. Two-phase IR architecture: build graph via reflection, enrich with metadata from extractors, emit schema with $ref extraction. Supports factory-based polymorphism (Netty/InVM oneOf variants), class-based polymorphism (AMQP connection element subtypes), and hot-reloadable property flagging. Externalized configuration in META-INF/schema-generator-config.json. Add optional JSON Schema validation for broker configuration files. When the artemis-jsonschema JAR is on the classpath and validation is enabled via -Dartemis.config.validate-json=true, JSON broker configs are validated against the generated schema before being applied. JsonSchemaValidator loads the schema from the classpath resource packaged by artemis-jsonschema. Invalid configurations are rejected with detailed error messages. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
|
We could also filter the schema, only let it remove paths of configs we don't want to expose. Enforcing this would prevent people from using the broker properties to configure things they shouldn't. There's already some filtering enabled to ignore some kind of objects, this could be generalized with I.E allowed to configure a NettyAcceptor under acceptors but not under AMQPConnections for instance (made up example). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Generates a JSON Schema (Draft 7) describing all valid broker.properties configuration options. Built from multiple sources: Java reflection on ConfigurationImpl, XSD constraints, JavaDoc, source constants, and factory parameter discovery.
Two-phase IR architecture: build graph via reflection, enrich with metadata from extractors, emit schema with $ref extraction.
Supports factory-based polymorphism (Netty/InVM oneOf variants), class-based polymorphism (AMQP connection element subtypes), and hot-reloadable property flagging.
Externalized configuration in META-INF/schema-generator-config.json.
Add optional JSON Schema validation for broker configuration files. When the artemis-jsonschema JAR is on the classpath and validation is enabled via -Dartemis.config.validate-json=true, JSON broker configs are validated against the generated schema before being applied.
JsonSchemaValidator loads the schema from the classpath resource packaged by artemis-jsonschema. Invalid configurations are rejected with detailed error messages.