Skip to content

Handle $ref sibling descriptions#1821

Open
theswim wants to merge 1 commit into
joelittlejohn:masterfrom
theswim:feature/ref-sibling-description
Open

Handle $ref sibling descriptions#1821
theswim wants to merge 1 commit into
joelittlejohn:masterfrom
theswim:feature/ref-sibling-description

Conversation

@theswim

@theswim theswim commented May 26, 2026

Copy link
Copy Markdown

Summary

Fix property-level annotation handling for schemas that define sibling keywords alongside $ref.

In Draft 2020-12, $ref is an applicator and sibling keywords in the same schema object are evaluated independently. Previously, jsonschema2pojo resolved $ref by replacing the property schema with the referenced schema, so a sibling description on the property was ignored and the referenced schema description was used instead.

This change preserves the referenced schema for type generation while merging sibling keywords back into the resolved property schema for property annotations. Local sibling keywords override the referenced schema keyword of the same name.

Changes

  • Merge $ref sibling keywords into the resolved property schema in PropertyRule
  • Keep $ref itself excluded from the merged annotation schema
  • Add an integration test using the existing schema/ref/address.json fixture
  • Verify that a property-level sibling description becomes the generated @JsonPropertyDescription

Verification

  • ./mvnw clean verify
  • git diff --check

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.

1 participant