refactor(databind): add permissive document loading for non-validation contexts#600
Conversation
📝 WalkthroughWalkthroughAdds a permissive bound loader to IBindingContext and switches callers to use it for loading referenced or converted documents; disables required-field and constraint validation during permissive loads; adds plural-aware property type naming in error messages; tests and CLI usages updated to use permissive loading. Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI / Client
participant BindCtx as IBindingContext
participant Loader as IBoundLoader (permissive)
participant Deser as Deserializer
participant DynCtx as DynamicContext
participant Evaluator as Constraint/Metapath Evaluator
CLI->>BindCtx: request convert / validate / evaluate
BindCtx->>Loader: newPermissiveBoundLoader()
Note right of Loader `#f6f0e6`: DESERIALIZE_VALIDATE_REQUIRED_FIELDS=false
CLI->>Deser: provide document
Deser->>Loader: load(document)
Note right of Deser `#e8f6ef`: permissive load — skip required-field checks
Loader-->>Deser: partial/loaded model
Deser->>DynCtx: build DynamicContext (attach loader)
DynCtx->>Evaluator: evaluate constraints / metapath (may call doc())
Evaluator->>Loader: load referenced documents permissively
Evaluator-->>DynCtx: results
DynCtx-->>CLI: final result / validation outcome
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used📓 Path-based instructions (2)**/*.java📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*Test.java📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (5)📚 Learning: 2025-12-19T04:01:37.408ZApplied to files:
📚 Learning: 2025-12-27T16:52:04.509ZApplied to files:
📚 Learning: 2025-12-24T21:21:40.208ZApplied to files:
📚 Learning: 2025-12-24T21:22:07.082ZApplied to files:
📚 Learning: 2025-12-24T21:21:56.361ZApplied to files:
🔇 Additional comments (8)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PMD (7.19.0)databind/src/main/java/gov/nist/secauto/metaschema/databind/io/AbstractProblemHandler.java[ERROR] Cannot load ruleset pmd/category/java/custom.xml: Cannot resolve rule/ruleset reference 'pmd/category/java/custom.xml'. Make sure the resource is a valid file or URL and is on the CLASSPATH. Use --debug (or a fine log level) to see the current classpath. metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/metapath/EvaluateMetapathCommand.java[ERROR] Cannot load ruleset pmd/category/java/custom.xml: Cannot resolve rule/ruleset reference 'pmd/category/java/custom.xml'. Make sure the resource is a valid file or URL and is on the CLASSPATH. Use --debug (or a fine log level) to see the current classpath. databind/src/main/java/gov/nist/secauto/metaschema/databind/io/AbstractDeserializer.java[ERROR] Cannot load ruleset pmd/category/java/custom.xml: Cannot resolve rule/ruleset reference 'pmd/category/java/custom.xml'. Make sure the resource is a valid file or URL and is on the CLASSPATH. Use --debug (or a fine log level) to see the current classpath.
Comment |
…sages Refinements to PR metaschema-framework#593 (parser validation for required fields): Permissive Loading: - Add newPermissiveBoundLoader() to IBindingContext for creating loaders with DESERIALIZE_VALIDATE_REQUIRED_FIELDS disabled - Update constraint validation to use permissive loaders for referenced documents (enables doc() function during constraint evaluation) - Update CLI convert command to use permissive loading - Update CLI metapath eval command to use permissive loading and set document loader on DynamicContext to enable doc() function support - Add tests for permissive loading behavior Error Message Fixes: - Add plural parameter to getFormatPropertyTypeName() and getPropertyTypeName() - Fix plural forms: 'properties' instead of 'propertys' for JSON/YAML - Consolidate getFormatPropertyGroupLabel() to delegate to getFormatPropertyTypeName() and capitalize, reducing code duplication
46488f7 to
b660af1
Compare
d60c916
into
metaschema-framework:develop
Summary
Refinements to PR #593 (parser validation for required fields):
newPermissiveBoundLoader()toIBindingContextfor creating loaders withDESERIALIZE_VALIDATE_REQUIRED_FIELDSdisableddoc()function supportThis also includes a fix for the plural form bug ("propertys" → "properties") in validation error messages.
Test plan
PermissiveLoadingTesttests verify:newPermissiveBoundLoader()has validation disablednewBoundLoader()has validation enabled by defaultSummary by CodeRabbit
New Features
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.