fix(codegen): isRequired() returns false for choice block properties#608
Conversation
…etaschema-framework#604) Properties inside Metaschema choice blocks are conditionally required - their requirement depends on which choice branch is taken. This fix ensures isRequired() returns false for all choice block members, resulting in @nullable annotations on generated getters/setters. Changes: - AbstractNamedModelInstanceTypeInfo.isRequired() now checks choiceId - Updated Javadoc on IPropertyTypeInfo.isRequired() documenting behavior - Enhanced setter Javadoc generation for nullability documentation - Regenerated bootstrap binding classes with correct annotations Resolves metaschema-framework#604
📝 WalkthroughWalkthroughThe PR implements a fix for the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes The core logic change in Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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/codegen/typeinfo/INamedInstanceTypeInfo.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/model/metaschema/binding/ConstraintLetExpression.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/codegen/typeinfo/AbstractNamedModelInstanceTypeInfo.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 |
cf6331f
into
metaschema-framework:develop
Summary
isRequired()to returnfalsefor properties inside Metaschema choice blocks@Nullable/@NonNullannotationsChanges
AbstractNamedModelInstanceTypeInfo.isRequired()now checks forchoiceIdbefore returningtrueIPropertyTypeInfo.isRequired()Javadoc to document choice block behaviorTest plan
isRequired()returnsfalsefor choice propertiesmvn clean install -PCI -PreleaseMETASCHEMA.getRootName()now returns@Nullable)Resolves #604
Summary by CodeRabbit
Release Notes
Bug Fixes
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.