Releases: metaschema-framework/metaschema-java
v2.1.0
This minor release incorporates a bunch of bug fixes, new features, and code refactoring that will improve the stability of runtimes, and the maintainability of the code and use of the APIs.
What's New
-
The following new Metapath functions were added:
- fn:implicit-timezone Returns the value of the implicit timezone property from the dynamic context. (#265)
- fn:current-date Returns the current date. (#265)
- fn:current-time Returns the current time. (#265)
-
The
time
andtime-with-timezone
data types were added to support thefn:current-date
Metapath function. (#265) -
Support for the following Metapath expressions was added:
-
Expanded the Metapath ANTR grammar to include kind tests. (#136)
- Completed support for flag, field, assembly, and document kind tests.
- Added support for IArrayItem contents IItemType matching.
-
The internal type system was greatly improved to support these new Metapath expressions. This system is more robust and lays the groundwork for "instance of", "castable", other type related tests, and dynamic function declarations. (#136, #264)
- All
IItem
andICollectionValue
types now have anatomize()
method, which provides the prior functionality of the similar names method in FnData, - Cleaned up use of
getAtomicItem()
methods to ensure more consistent use. - Added
IItem.toSignature()
andICollectionValue.toSignature()
, which provides the type signature of the object based on its type. ThetoString()
method on these implementations will also provide the same signature to aid in debugging. - Refactored
QName
use to use an newIEnhancedQName
that supports caching qualified names using a numeric index. Name resolution now handled by theStaticContext
. Switch flag and model name resolution fromIModule
toIModule.getStaticContext()
. - Replaced QName based lookups with integer index-based lookups. Use of integer-based indexes should reduce memory usage and enables more efficient integer-based lookups in place of string-based matching.
- Added support for sequence type matching on sequences.
- Refactored data type service to handle abstract types that have no associated adapter so that all data types can be discovered using the service.
- Refactored data and date/time data types to have the ambiguous data type interfaces be the parent of the non-ambiguous data types. This aligns better with the data type naming and the semantics of how they work.
- Refactored data type and atomic item implementations to move casting operations to the atomic item implementations. This creates a cleaner isolation between the type adapters and Metapath items. (#245)
- Improved
date
anddate-time
adapter unit testing to check for ambiguity and resulting time value.
- All
-
Other refactoring, includes: (#136)
- Cleaned up all
IGroupable
implementations to simplify code and reduce methods. - Refactored the implementations supporting model container generation, by reducing the number of implementations and implementing a builder pattern to store container information while the container is being built. This enabled cleanup of some duplicate code identified by CPD in XmlFlagContainerSupport and other classes.
- Removed a bunch of unnecessary interfaces and unwound some significant spaghetti code.
- Moved the sequence collector
toSequence
fromISequence
toCustomCollectors
. - Added a location hint to
ISource
which will provide the URI or class for the Metaschema module. Cleaned up source information to provide more context in exceptions. Improved some exceptions using this information. - Refactored exception handling in
StaticContext
lookup methods. - Added a bunch of missing Javadocs.
- Added many missing Javadocs. Adjusted many existing Javadocs to provide more details. (#245)
- Removed some unused constants.
- Performed some light refactoring to remove unused code and to improve overall code readability to make maintenance easier.
- Replaced
Paths.get("")
withPaths.get(System.getProperty(user.dir))
to be more explicit. - Improved value creation methods in date and date/time item classes.
- Refactored the result type used in MetapathExpression to avoid the need for a case statement. This should result in cleaner code and better performance overall.
- Removed some commented out code.
- Updated some inconsistent Log4j2 configurations to be consistent with other configurations.
- Updated build and unit testing dependencies through parent POM.
- Improved parser errors and warnings to include the resource the error was found in.
- Cleaned up all
-
Unit test improvements:
- Added some unit test assertions to ensure HTML to Markdown conversion is tested more completely. (#245)
- Significantly improved data and date/time parsing test vectors.
-
Updated the Metaschema submodule to latest in metaschema-framework/metaschema
develop
.
Bug Fixes
- Resolved #259 by delaying registering module in validation commands to just before constraint validation to ensure schemas are generated directly from the loaded module and not the compiled version. (#263)
- Fixed a bug related to how sequence transitions from IArrayItem and IMapItem were handled, where they weren't unwrapped properly. (#136)
- Split
ICollectionValue.asSequence()
into two methods: 1)toSequence()
, which has the same behavior of generating a sequence containing the value. 2)contentsAsSequence()
which will return the item's contents as aISequence
if the item is multivalued (i.e.,IArrayItem
,IMapItem
), or the item otherwise.
- Split
- Resolved @258 by disallowing partial metapath parsing, which allowed invalid metapaths to be used if the first part was seen as valid. **Note: This may result in some erroneous Metapaths now being caught, where previously they were allowed. Double checked OSCAL internal constraints to make sure that this wasn't the case there. (#260)
- Fixed an issue that prevented constraints to be applied to the built-in Metaschema module module.
- Also fixed an issue that prevented newer binding matchers from overriding previous binding matchers where they have the same element names.
Breaking Changes
There are some minimal breaking changes in this release that are limited to publicly visible implementation classes focused around data type, Metapath items, Metapath function declaration, the Metapath StaticContext
, and some internal model classes. These changes will not affect the majority of applications using this library, unless the library is providing custom data types or Metapath functions. liboscal-java
was updated based on these changes, and provides a good example of the minimal scope of these changes.
What's Changed
- Improve parser error and warning messages by @david-waltermire in #244
- More code cleanup and refactoring by @david-waltermire in #245
- Fix partial metapath parse by @david-waltermire in #260
- Improve type system to support anonymous functions by @david-waltermire in #136
- Restore proper choice behavior in schema generation by @david-waltermire in #263
- Bump org.sonatype.central:central-publishing-maven-plugin from 0.5.0 to 0.6.0 by @dependabot in #246
- Bump net.openhft:compiler from 2.26ea0 to 2.27ea0 by @dependabot in #250
- Bump commons-io:commons-io from 2.17.0 to 2.18.0 by @dependabot in #255
- Bump io.github.hakky54:logcaptor from 2.9.3 to 2.10.0 by @dependabot in #256
- Bump github/codeql-action from 3.27.1 to 3.27.5 by @dependabot in #257
- Metapath 'treat as' expressions by @david-waltermire in #264
- Bump org.apache.logging.log4j:log4j-bom from 2.24.1 to 2.24.2 by @dependabot in #261
- Support implicitTimezone and currentDate Metapath functions by @david-waltermire in #265
Full Changelog: v2.0.1...v2.1.0
v2.0.1
This patch release fixes a few bugs that affect the output of tooling using this library.
What's Changed
- Ensure the exit message is not dropped by @david-waltermire in #236
- Improve parser data type error handling by @david-waltermire in #239
Full Changelog: v2.0.0...v2.0.1
v2.0.0
This major release incorporates a bunch of bug fixes, new features, and code refactoring that will improve the stability of runtimes, and the maintainability of the code and use of the APIs.
What's New
-
In #189, the
metaschema-cli convert
command was added which allows for the conversion between supported formats for any content that conforms to a Metaschema module.usage: metaschema-cli convert --to=FORMAT -m=FILE_OR_URL [<options>] <source-file-or-URL> [<destination-file>] -h,--help display this help message -m <FILE_OR_URL> metaschema resource --no-color do not colorize output --overwrite overwrite the destination if it exists -q,--quiet minimize output to include only errors --show-stack-trace display the stack trace associated with an error --to=<FORMAT> convert to format: xml, json, or yaml --version display the application version
-
In #181, the logging produced by validation commands has been enhanced to also output the constraint id that the log message pertains to.
-
The following new Metapath functions were added:
-
let
statements now fully support exposing the remark. Previously, this support was lacking for the pre-generated class bindings
for the Metaschema. -
The
flag
,following
,following-sibling
,preceding
, andpreceding-sibling
axes are now implemented. See #229. -
In
allowed-values
constraints, deprecated versions are now properly exposed in the related APIs. -
All constraint types, except for
allowed-values
now support custom messages similar to howexpect
previously worked. See #218. -
Runtime errors that occur while validation content using constraints sometimes caused the validation to exit prematurely before reporting validation errors. PR #232 now ensures that validation continues and these runtime issues are reported as validation errors.
-
Definition and instance properties are now fully supported in the class binding APIs.
-
The
metaschema-cli eval
command now outputs the value for flag and field nodes in addition to the path to the node. See #228. -
Due to the differences between how null values are handled in XML and JSON/YAML, the parser will now report warnings when a null value is found. See #227 for more information on this behavior.
Bug Fixes
- PR #188 addressed #184 by ensuring that only one copy of a constraint is added at a given location within a model. This issues was caused when an external constraint applied to multiple locations within a model and that model construct was reused in one or more of those locations. A copy of the constraint was added for each time the constraint target matches one of those locations.
- PR #187 addressed the case where a search path (
//somenode
). In such cases, the matched nodes were returned multiple times. This fix ensure that the nodes returned are unique. - PR #214 fixes the case where if the
fn:doc-available
Metapath function is called with an absolute URI, the function was trying to still resolve it. This would cause an error when the static context doesn't have a baseUri set. The behavior has been changed to only try resolution when the URI is not absolute.
Breaking Changes
-
Some implementation classes and interfaces haven been moved or renamed. The following is a summary of the changes.
In package
gov.nist.secauto.metaschema
:core.resource.AbstractResourceResolver
→core.model.AbstractResourceResolver
core.model.xml.ExternalConstraintsModulePostProcessor
→core.model.constraint.ExternalConstraintsModulePostProcessor
core.model.constraint.ISource
→core.model.ISource
databind.model.binding.metaschema.*
→databind.model.metaschema.binding.*
core/util/DefaultDiagramNode
→core/model/util/DefaultDiagramNode
core/util/IDiagramNode
→core/model/util/IDiagramNode
core/util/IDiagramNodeVisitor
→core/model/util/IDiagramNodeVisitor
core/util/MermaidErDiagramGenerator
→core/model/util/MermaidErDiagramGenerator
-
The interface
gov.nist.secauto.metaschema.databind.IBindingContext
has been significantly changes. You can no longer get a global shared instance. Instead, you can get a new instance using thenewInstance()
method, or a builder instance using thebuilder()
method. These changes were made in #211.By default, new instances do not support dynamically generating and compiling class bindings. This can be enabled by calling the
compilePath(Path)
using the builder instance.
What's Changed
- Address insertion of duplicate external constraints by @david-waltermire in #188
- Bump lycheeverse/lychee-action from 1.10.0 to 2.0.2 by @dependabot in #186
- Bump github/codeql-action from 3.26.12 to 3.26.13 by @dependabot in #185
- Bump actions/upload-artifact from 4.4.1 to 4.4.3 by @dependabot in #182
- Bump org.apache.maven.plugin-tools:maven-plugin-annotations from 3.11.0 to 3.15.0 by @dependabot in #172
- Bump org.freemarker:freemarker from 2.3.32 to 2.3.33 by @dependabot in #171
- Ensure a double slash Metapath returns unique items by @david-waltermire in #187
- Added new convert metaschema-cli command. by @david-waltermire in #189
- Include constraint id in console output by @david-waltermire in #181
- Code refactoring 20241019 by @david-waltermire in #191
- Feature/bump minor version to 1.3 by @david-waltermire in #192
- Add
fn:string-length
to Metapath function registry by @aj-stein-gsa in #193 - Add substring-after impl to Metapath default function registry by @aj-stein-gsa in #195
- Add
substring-before()
implementation by @aj-stein-gsa in #194 - More refactoring and cleanup by @david-waltermire in #198
- Add
lower-case()
andupper-case()
to Metapath default function registry by @aj-stein-gsa in #203 - Bump actions/setup-java from 4.4.0 to 4.5.0 by @dependabot in #212
- Bump actions/checkout from 4.2.1 to 4.2.2 by @dependabot in #209
- Bump github/codeql-action from 3.26.13 to 3.27.0 by @dependabot in #206
- Bump org.junit:junit-bom from 5.11.2 to 5.11.3 by @dependabot in #201
- Bump com.github.spotbugs:spotbugs-maven-plugin from 4.8.6.4 to 4.8.6.5 by @dependabot in #200
- Bump org.apache.maven.plugins:maven-invoker-plugin from 3.8.0 to 3.8.1 by @dependabot in #199
- Bump org.apache.maven.plugin-tools:maven-plugin-annotations from 3.15.0 to 3.15.1 by @dependabot in #213
- Bump com.fasterxml.woodstox:woodstox-core from 7.0.0 to 7.1.0 by @dependabot in #210
- Avoid resolving an already resolved URI in doc-available by @david-waltermire in #214
- Refactoring of Module Loading API by @david-waltermire in #211
- Support for remarks in let statements by @david-waltermire in #216
- Address comments marked TODO by @david-waltermire in #217
- Eval command improvments by @david-waltermire in #228
- Improve NULL field value and data type error handling by @david-waltermire in #227
- Metapath additional axes by @david-waltermire in #229
- Bump org.apache.maven.plugins:maven-plugin-report-plugin from 3.15.0 to 3.15.1 by @dependabot in #226
- Bump org.apache.maven.plugins:maven-pmd-plugin from 3.25.0 to 3.26.0 by @dependabot in #225
- Bump org.apache.maven.plugins:maven-jxr-plugin from 3.5.0 to 3.6.0 by @dependabot in #224
- Bump dependency.pmd.version from 7.6.0 to 7.7.0 by @dependabot in #223
- Code cleanup by @david-waltermire in #230
- Bump org.xmlresolver:xmlresolver from 6.0.10 to 6.0.11 by @dependabot in https://github.com/metaschema-framework/metaschema-j...
v1.2.0
Changelog
This minor release adds the following new features:
- Added support for SARIF help URLs, text, and markdown in SARIF results. (#139)
- Implemented the following Matpath functions:
- Documented how to identify which functions are supported. (#124)
- Schema validation errors are now reported as critical errors. Schema problems no longer prevent constraint validation from being performed (#178)
Bug Fixes
- In prior releases, validation results produced in the Static Analysis Results Interchange Format (SARIF) were not valid according to the SARIF JSON schema. This release fixes these issues. (#137)
- Property values were erroniously limited to token values, instead of string values (#177)
What's Changed
- Update .lycheeignore by @david-waltermire in #129
- Bump org.apache.maven.plugins:maven-invoker-plugin from 3.7.0 to 3.8.0 by @dependabot in #118
- Bump org.apache.maven.plugins:maven-pmd-plugin from 3.24.0 to 3.25.0 by @dependabot in #119
- Bump com.github.javaparser:javaparser-symbol-solver-core from 3.26.1 to 3.26.2 by @dependabot in #120
- Bump actions/setup-java from 4.3.0 to 4.4.0 by @dependabot in #125
- Bump github/codeql-action from 3.26.7 to 3.26.9 by @dependabot in #126
- Bump peter-evans/create-issue-from-file from 5.0.0 to 5.0.1 by @dependabot in #127
- Bump actions/checkout from 4.1.7 to 4.2.0 by @dependabot in #128
- Document function registry info by @aj-stein-gsa in #124
- Ensure SARIF results are valid to SARIF JSON schema by @david-waltermire in #137
- Use new module repository by @david-waltermire in #141
- Add support for SARIF help URLs, text, and markdown by @david-waltermire in #139
- Bump github/codeql-action from 3.26.9 to 3.26.10 by @dependabot in #143
- Bump org.eclipse.persistence:org.eclipse.persistence.moxy from 4.0.2 to 4.0.4 by @dependabot in #144
- Update .lycheeignore by @david-waltermire in #149
- Implement fn:string Metapath function by @david-waltermire in #138
- Bump dependency.jackson.version from 2.17.2 to 2.18.0 by @dependabot in #145
- Bump org.codehaus.plexus:plexus-utils from 4.0.1 to 4.0.2 by @dependabot in #146
- Bump dependency.pmd.version from 7.5.0 to 7.6.0 by @dependabot in #147
- Bump com.github.spotbugs:spotbugs-maven-plugin from 4.8.6.2 to 4.8.6.4 by @dependabot in #148
- Bump net.openhft:compiler from 2.25ea2 to 2.26ea0 by @dependabot in #117
- Bump to v1.2.0 by @david-waltermire in #150
- Implement Metapath regex functions by @david-waltermire in #140
- Bump io.github.hakky54:logcaptor from 2.9.2 to 2.9.3 by @dependabot in #155
- Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 by @dependabot in #153
- Bump github/codeql-action from 3.26.10 to 3.26.11 by @dependabot in #151
- Bump org.assertj:assertj-core from 3.24.2 to 3.26.3 by @dependabot in #157
- Bump org.junit:junit-bom from 5.11.1 to 5.11.2 by @dependabot in #159
- Bump org.apache.maven.plugins:maven-jxr-plugin from 3.4.0 to 3.5.0 by @dependabot in #160
- Bump com.github.seancfoley:ipaddress from 5.5.0 to 5.5.1 by @dependabot in #161
- Support the normalize-space Metapath function by @david-waltermire in #163
- Add the current-dateTime Metapth function by @david-waltermire in #165
- Auto add issues to project by @david-waltermire in #167
- Code cleanup by @david-waltermire in #166
- Add contains and ends-with Metapath functions by @david-waltermire in #168
- Bump github/codeql-action from 3.26.11 to 3.26.12 by @dependabot in #176
- Bump actions/upload-artifact from 4.4.0 to 4.4.1 by @dependabot in #175
- Bump actions/checkout from 4.2.0 to 4.2.1 by @dependabot in #174
- Bump org.apache.maven.plugins:maven-surefire-plugin from 3.5.0 to 3.5.1 by @dependabot in #173
- Add
fn:substring
to Metapath function library by @aj-stein-gsa in #142 - Support Metaschema module and constraint string property values by @david-waltermire in #177
- Make schema validation errors critical by @david-waltermire in #178
New Contributors
- @aj-stein-gsa made their first contribution in #124
Full Changelog: v1.1.0...v1.2.0
v1.1.0
Changelog
This minor release adds the following new features.
-
Adds a new CLI command that supports arbitrary Metapath evaluation in the command line interface (CLI).
The command is
metaschema-cli metapath eval
.usage: metaschema-cli metapath eval -m=FILE_OR_URL --expression=EXPRESSION [<options>] -e,--expression=<EXPRESSION> Metapath expression to execute -h,--help display this help message -i <FILE_OR_URL> Metaschema content instance resource -m <FILE_OR_URL> metaschema resource --no-color do not colorize output -q,--quiet minimize output to include only errors --show-stack-trace display the stack trace associated with an error --version display the application version
-
Adds a new CLI command for generating a Mermaid diagram for a Metaschema module.
usage: metaschema-cli generate-diagram [<options>] <metaschema-module-file-or-URL> [<destination-diagram-file>] -h,--help display this help message --no-color do not colorize output --overwrite overwrite the destination if it exists -q,--quiet minimize output to include only errors --show-stack-trace display the stack trace associated with an error --version display the application version
-
In the
metaschema-cli validate-content
command, you can now disable schema or constraint validation using arguments.--disable-constraint-validation do not perform constraint validation --disable-schema-validation do not perform schema validation
-
Removed a warning around improperly contextualized Metapaths, that was identifying cases in external constraints where sub contexts and constraint targets use an absolute path expression. This feature creates warnings in the CLI that add noise to the results without adding value.
This change was checked against the OSCAL modules to ensure backwards compatibility and no impact to existing validations.
What's Changed
- Bump org.xmlresolver:xmlresolver from 6.0.4 to 6.0.9 by @dependabot in #87
- Bump commons-cli:commons-cli from 1.8.0 to 1.9.0 by @dependabot in #88
- Bump dependency.antlr4.version from 4.13.1 to 4.13.2 by @dependabot in #93
- Ignoring broken documentation links by @david-waltermire in #105
- Adjusted UUID item type to be a child type of IStringItem to allow fa… by @david-waltermire in #103
- Ensure unexpected constraint errors are logged by @david-waltermire in #104
- Bump org.apache.maven.plugins:maven-plugin-report-plugin from 3.13.1 to 3.15.0 by @dependabot in #97
- Bump github/codeql-action from 3.26.0 to 3.26.6 by @dependabot in #99
- Bump actions/upload-artifact from 4.3.5 to 4.4.0 by @dependabot in #100
- Bump nl.talsmasoftware:lazy4j from 1.0.3 to 2.0.0 by @dependabot in #92
- Bump io.hosuaby:inject-resources-junit-jupiter from 0.3.3 to 1.0.0 by @dependabot in #84
- Bump actions/setup-java from 4.2.2 to 4.3.0 by @dependabot in #107
- Metapath expression evaluator subcommand by @david-waltermire in #102
- Bump github/codeql-action from 3.26.6 to 3.26.7 by @dependabot in #116
- Bump dependency.pmd.version from 7.4.0 to 7.5.0 by @dependabot in #109
- Bump org.jmock:jmock-junit5 from 2.13.0 to 2.13.1 by @dependabot in #111
- Bump com.fasterxml.woodstox:woodstox-core from 6.7.0 to 7.0.0 by @dependabot in #112
- Code cleanup and Javadocs by @david-waltermire in #106
- Mermaid diagram generation for module by @david-waltermire in #78
- Support disabling schema and/or constraint validation when validating content by @david-waltermire in #114
- Remove the warning around improperly contextualized expression by @david-waltermire in #115
Full Changelog: v1.0.2...v1.1.0
v1.0.2
What's Changed
- Fix wildcard name matching by @david-waltermire in #85
Full Changelog: v1.0.1...v1.0.2
v1.0.1
This patch release does not contain any functional code changes. It updates the website with a new format.
What's Changed
- Bump actions/upload-artifact from 4.3.3 to 4.3.5 by @dependabot in #67
- Bump org.apache.commons:commons-text from 1.11.0 to 1.12.0 by @dependabot in #63
- Bump commons-io:commons-io from 2.15.1 to 2.16.1 by @dependabot in #66
- Bump org.codehaus.plexus:plexus-utils from 4.0.0 to 4.0.1 by @dependabot in #65
Full Changelog: v1.0.0...v1.0.1
v1.0.0
Changelog
This release contains unreleased commits from the NIST repository and changes that were requested, but not merged at the time of this release, including usnistgov/metaschema-java#374, usnistgov/metaschema-java#368, usnistgov/metaschema-java#367, usnistgov/metaschema-java#365, usnistgov/metaschema-java#363, usnistgov/metaschema-java#373, and usnistgov/metaschema#659. The commits for these PRs are also merged here.
This release includes:
- significant cleanup of the code base, providing for easier long-term maintenance
- a large number of new Metapath features and functions
- robust support for external constraints that allows for further restrictions over an existing Metaschema module when validating content
- many bug fixes that improve the reliability of this project
- the ability to produce validation results in the Static Analysis Results Interchange Format (SARIF), which allows for integration with tools implementing this standard.
General
- Added and improved Javadoc comments across all modules, with a focus on full documenting the core API.
- Cleaned up many compile, code style, SpotBugs, CPD, and PMD warnings and errors.
- Cleaned up orphaned code
- Switched some tests using resources in the test classpath to use file resources to make testing more stable.
- Refactored model interfaces in core and databind to reduce code duplication, to simplify interface heirachies, and to share more implementation code. This resulted in the removal of dozens of interfaces, which were no longer needed.
- Cleaned up some accessor method names to be more consistent with their return types.
- Added support for defining configuration feature names to better support debugging.
- Cleaned up stream closure to ensure that streams are properly closed.
- Added methods to handle making URIs relative to another URI.
- Some work towards improving NullPointerExceptions to provide more context when missing data is the cause.
metaschema-core
Metaschema Module Model
- Implemented choice group support based on usnistgov/metaschema#228, which provides a means to allow sequenced collections of objects of different types.
- Cleaned up and documented loader interfaces, to include IDocumentLoader.
- Refactored XML model parsing. Moved XML model classes to be hidden in the implementation.
- Added support for QName in Metaschema data types, which are used in function signatures now instead of the Java class name.
- Fixed XML choice model parsing to ensure instances are also added to the model instance list.
- Refactored core model classes and support for collections
- Relocated many class files and cleaned up many unneeded methods.
- Reworked definition and instance model classes to reduce extra interfaces and to simplify and align implementations.
- Added support for flag and field instances to provide a different default value than the definition.
- Refactored instance class hierarchy to support grouped and ungrouped model instances, with minimal implementation.
- Renamed model interfaces for greater consistency.
- Refactored core model interfaces to reduce inheritance conflicts.
- Adjusted the module interfaces to promote a cleaner, non-parameterized API.
- Renamed many instance implementation classes to ensure consistent use of terminology. Prior the terms "property" and "instance" were used interchangeably, which could cause some confusion.
- Refactored IBindingContext to move supporting interfaces to be child interfaces.
- Removed the need for instances of IDataTypeHandler. Now IClassDataTypeHandler functionality is provided by IFeatureComplexItemValueHandler and JavaTypeAdapterDataTypeHandler is provided by IFeatureScalarItemValueHandler.
- Refactored bound class hierarchy to be more consistent with needed methods.
- Moved Java field handling to IFeatureJavaField from IBoundNamedModelInstance
- Moved JSON key and item handling to IBoundModelInstance.
- Reworked XML and JSON reading and writing.
- Added IBoundChoiceGroupInstance interface for choice groups.
- Cleaned up IModelPropertyInfo and implementations, relocating supporting classes as child classes.
- Implemented a IModelInstance item parsing as IModelPropertyInfo.IReadHandler, allowing all item parsing to be implemented in the format-specific parsing classes, i.e. MetaschemaJsonReader, MetaschemaXmlReader.
- Cleaned up IModelPropertyInfo readItems methods, which now return the parsed value. Eliminated the need for IPropertyCollector instances.
- Refactored constraint ILet statement construction to use static factory methods.
- Cleaned up JSON value key naming code.
- Fixed default value handling which wasn't producing empty collection for unparsed model instances. Cleaned up getDefaultValue and getEffectiveDefaultValue methods.
- Refactored JSON key handling to determine the JSON key on a per item basis. This is needed for ChoiceGroups.
- Refactored container handling code to reuse the core model implementation where possible.
- Refactored group-as namespace handling to allow for no namespace situations. Implemented getEffectiveGroupAsNamespace to handle the default case of using the module namespace where no group-as support is provided.
Metapath Interpreter
-
Added support for more XPath 3.1 syntax in Metapath:
- Adjusted Metapath syntax to add support for
for
,if
,range
, simple map!
, and extended QNames. - Added support for Metapath if expressions:
if (expr) then (expr) else (expr)
. - Added support for Metapath range expressions:
intValue to intValue
. - Added support for Metapath quantified expressions:
(some | every) $VarName in Expr1 (, $VarName in ExprN)* satisfies ExprS
.
- Adjusted Metapath syntax to add support for
-
Added the following Metapath functions:
abs
avg
ceiling
concat
count
document-available
empty
head
insert-before
min
max
sum
tail
remove
reverse
array:get
array:put
array:append
array:subarray
array:remove
array:insert-before
array:join
array:head
array:tail
array:reverse
array:flatten
map:get
map:merge
map:entry
map:size
map:keys
map:contains
map:find
map:put
map:remove
meta:model
which gets a nodeset based on the underlying Metaschema module model for the node.
-
Fixed defects in the following functions:
data
false
true
starts-with
which was checking for contains not startsWith.
-
Added support for sub-DynamicContexts supporting variable definition in let and quantified expression statements.
-
Added support for map construction.
- Added support for maps in function call, postfix and unary lookups.
- Added missing characteristics on a number of existing Metapath functions.
-
Added support for Metapath arrays
- Completed code to support Metapath array construction.
- Implemented array postfix and unary lookups.
-
Changed ISequence to implement the List interface to allow sequences to better participate in collection-oriented Java methods.
-
Cleaned up ISequence implementations, moving getFirstItem to be a method member. Added a utility function to convert a sequence into an array member.
-
Refactored comparison methods into a new ComparisonFunctions class.
-
Reorganized and improved item implementations to better group interfaces and implementation classes and to be more robust.
- Refactored atomic item interfaces and implementations.
- Added support for casting an IItem of IAnyAtomicItem type to the type of another item using the castAsType method. This is useful for functions that require the return type to match the argument's type.
- Added support for compareTo for all atomic items.
- Added equals and hashCode to all item types.
- Renamed FlagDefinitionNodeItemImpl to FlagGlobalDefinitionNodeItemImpl to better harmonize with sibling field and assembly implementations.
- Added toString methods to some items to improve debugging and testing.
- Refactored IDocumentNodeItem and IModuleNodeItem to better align the features of each. A document node item not exposes the root assembly, while a module node item exposes the global definitions and module namespace.
- Ensured proper handling of Metapath errors during validation. Resolves usnistgov/oscal-cli#292
-
To improve maintenance of Metapath function test vectors, inline compilation of Metapaths are now used, making tests more readable while we working on usnistgov/metaschema#239.
- Reorganize test util functions for vectorized tests.
- Parameterize CLI tests as pre-work for usnistgov/metaschema-java#241.
-
Fixed a bug causing Metapath lexer errors to be silently ignored.
-
Reorganized and refactored the Metapath compact syntax tree and ANTLR-based abstract syntax tree implementation classes.
-
Fixed bug causing empty sequences to not be produced by the Metapath expression: ().
-
Cleaned up static and dynamic Metapath exceptions. Refactored StaticContext generation to ensure proper use of model-based methods.
-
Adjusted namespace of Metapath functions to http://csrc.nist.gov/ns/metaschema/metapath-functions.
-
Improved function testing to lookup and call the function. This will more fully exercise the function call in JUnit tests.
-
Fixed a defect in opNumericDivide that caused improper handling of integer division.
-
Adjusted the document node item to ensure it returns the root node when getValue is called. This fixes usnistgov/oscal-cli#216.
-
Added support for Expanded QNames
-
Fixed and tested mod expression handling to properly return an integer result
-
Fixed function chain arrow operator processing
Made
=>
operator eqname only in A...