Repository navigation
fix: adding a check to prevent path collisions - #55328
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The collision guard misses inherited allOf fields and indirect descendants, allowing conflicting properties to pass undetected.
2 open issues
What changed in this PR
Adds a safeguard during Admin API v2 OpenAPI processing to reject conflicting field names in polymorphic representations, addressing #54684.
Changes:
- Validates duplicate properties across a parent and its directly listed subtypes, excluding the discriminator.
- Adds tests for permitted fields and collisions between siblings or with the base type.
| File | Description |
|---|---|
rest/admin-v2/services/src/test/java/org/keycloak/admin/internal/openapi/OASModelFilterPolymorphismTest.java |
Adds focused polymorphic field-validation tests. |
rest/admin-v2/services/src/main/java/org/keycloak/admin/internal/openapi/OASModelFilter.java |
Adds conflicting-field validation to discriminator processing. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
Inherited-property overwrites, inconsistent nested discriminator handling, and missed indirect descendants leave collision validation and discriminator propagation incorrect.
3 open issues
Only direct$refentries are inspected, so an indirect descendant expressed as `allOf: [{allOf:… · New Nested discriminator fields are handled inconsistently: with outer discriminatortypeand branch… · New Merging inherited properties withputAllcan erase a conflicting declaration from an earlier… · New
2 resolved since last review
Review effort: Balanced
closes: keycloak#54684 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
There was a problem hiding this comment.
Looks good to me, I also verified locally that the new tests catch the expected collisions/schema mismatches - everything works as expected.
Thanks Steve!

closes: #54684