Class SchemaReferenceCompositionSupport
- Since:
- 2.2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanhasUnsupportedAllOf(Schema schema) Check whether a schema has unsupported or ambiguousallOfcomposition after supported local references have been prepared.static booleanisExternalRef(String ref) Check whether a reference points outside the current schema document.static booleanCheck whether a reference points to a supported local target.static voidPrepare a schema tree for the record-generation path by materializing supported local references before the schema is handed toSourceGenerator.
-
Method Details
-
prepareLocalCompositionReferences
Prepare a schema tree for the record-generation path by materializing supported local references before the schema is handed toSourceGenerator.This method mutates the supplied schema. It resolves same-document definition references (
#/$defs/...and#/definitions/...) when they appear as root references or inside compatibleallOfbranches, then flattens object-compatibleallOfbranches into the composed schema. Definitions are prepared as well because they can be emitted as generated Java types.This is deliberately not a general JSON Schema resolver. It does not fetch remote references, resolve arbitrary JSON Pointers, canonicalize schemas, or sort Java members. Unsupported or ambiguous composition is left detectable by
hasUnsupportedAllOf(Schema)so the record-generation pipeline can fail, skip, or fall back according to context.- Parameters:
schema- The schema to prepare
-
hasUnsupportedAllOf
Check whether a schema has unsupported or ambiguousallOfcomposition after supported local references have been prepared.The check accepts only object-compatible branches that can be represented as one Java type. It rejects unresolved references, union-style branches, non-object typed branches, incompatible duplicate properties, and contradictory
additionalPropertiesrules.- Parameters:
schema- The schema- Returns:
- True when
allOfcannot be flattened deterministically
-
isExternalRef
Check whether a reference points outside the current schema document.External references are not resolved by this support class or by the record-generation pipeline.
- Parameters:
ref- The reference value- Returns:
- True for external references
-
isSupportedLocalRef
Check whether a reference points to a supported local target.The supported local targets are the current document (
#) and definitions under#/$defs/...or legacy#/definitions/.... Other same-document JSON Pointers are intentionally unsupported here.- Parameters:
ref- The reference value- Returns:
- True for supported local references
-