Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metaschema constraints definition and enforcement #12

Open
3 tasks
wendellpiez opened this issue Mar 12, 2020 · 5 comments
Open
3 tasks

Metaschema constraints definition and enforcement #12

wendellpiez opened this issue Mar 12, 2020 · 5 comments

Comments

@wendellpiez
Copy link
Collaborator

User Story:

Metaschema needs new features to help developers and potentially users (content developers) to validate arbitrary constraints over their data, sometimes defined locally, frequently over and above the constraints introduced by the models themselves. So, not a new field (for example), but a new rule about values permitted on a field with a given flag.

This bears importantly on customization, as many customizations if not most can take the form of new constraints over generic models (such as part and prop) rather than new models.

Goals:

Extend the features of Metaschema to support more and better constraint checking, including node occurrence and value constraints as well as compound and co-occurrence constraints.

We start with customizing allowed-values but we go from there. # 2 on the list is probably support for checking referential integrity, for example of internal links, or whether every insert points to a parameter.

An implemention will be able to read the constraint definition and produce appropriate XSD and/or Schematron code, for XML, and for JSON, the functional equivalent. (Perhaps another Schematron, or a single "ambidextrous" one.)

Dependencies:

A stable Metaschema. This work is being done in conjunction with usnistgov/metaschema#39.

In its branch there are (rough) design notes exploring a number of features we wish to support: see https://github.com/wendellpiez/metaschema/blob/issue39-pipeline-refactor/toolchains/xslt-proto-v04/definition-notes.md.

Acceptance Criteria

  • All website and readme documentation affected by the changes in this issue have been updated. Changes to the website can be made in the docs/content directory of your branch.
  • A Pull Request (PR) is submitted that fully addresses the goals of this User Story. This issue is referenced in the PR.
  • The CI-CD build process runs without any reported errors on the PR. This can be confirmed by reviewing that all checks have passed in the PR.
@wendellpiez
Copy link
Collaborator Author

April 8 Update

Considerable progress on this in my working branch. An implementation is now nominally feature complete. It works by producing a Schematron to be used alongside the XSD for a Metaschema, which reports errors for constraints violated in data conforming to its model. Testing and bug fixing proceeds.

https://github.com/wendellpiez/metaschema/tree/issue39-pipeline-refactor

@wendellpiez
Copy link
Collaborator Author

April 30 Update

After demonstrating the basic idea of Metaschema-based Schematron production for constraints enforcement, including the necessary path mapping (#45), we have been iterating the design, extending to support local extensions of constraints on data objects, defined on ancestors of those objects.

At this point there are still two or three questions of design/specification in this feature set, Most lately, I have created a couple of test metaschemas illustrating these issues. @david-waltermire-nist and I will continue to work on this with all deliberate speed.

Cf usnistgov/OSCAL#633

@wendellpiez
Copy link
Collaborator Author

August 4 Update

This has been stable while we built out other features including bidirectional conversion.

Remaining to do: build XSLT to read an XML-oriented Metatron and produce the JSONatron variant (a Schematron that can be run over JSON). Also, testing.

@david-waltermire
Copy link
Collaborator

The Metaschema constraints have been implemented in the Java-based toolchain. The XSLT implementation needs to be brought up to the same level of support.

@wendellpiez
Copy link
Collaborator Author

WIP on this is in the repository at https://github.com/usnistgov/metaschema/blob/main/toolchains/xslt-M4/schema-gen/make-metaschema-metatron.xsl. It is stable although not fully tested and possibly not fully current.

Moving forward then depends on external specs and unit tests for constraints definition and use.

This could be done informally against OSCAL but I am not ready to plan that.

Advice? Advancing on this depends on how we refactor the implementations and unit tests for Metaschema 'constraint' features.

@david-waltermire david-waltermire transferred this issue from usnistgov/metaschema Jun 30, 2023
nikitawootten-nist pushed a commit to nikitawootten-nist/metaschema-xslt that referenced this issue Jul 21, 2023
nikitawootten-nist pushed a commit to nikitawootten-nist/metaschema-xslt that referenced this issue Jul 21, 2023
…ov#37)

* integrated schema generation unit tests with new build scripting
* Work in progress on metaschema-related updates towards OSCAL SSP conversion roundtrips.
* added required top-level property to all unit-test JSON schema files
* Added XSD targets for unit testing
* oXygen project file for metaschema testing
* Updated project file
* Test coverage and planning docs
* added unit test for collapse
* fixed a bug in the test script causing expected schema files to not be compared.
* Addressing Issue usnistgov#11: JSON Schema missing constraint at root
* Adding metaschema documentation. usnistgov#16 usnistgov/OSCAL#596
* Added CI/CD files for website.
* Added Github issue templates.
* Addressing usnistgov#12, supporting collapsibility of fields.
* Fixed website build error.
* Updating website contents and CI/CD configuration.
* Patch to catch up metaschema implementation to latest changes in the OSCAL repo.
* fixed broken links in documentation
* updated repository documentation to fix broken links
* added configuration support to build scripts
* Implemented content converter generation in build scripts
* Removed references to local files for usnistgov/OSCAL#566
* integrated schema generation unit tests with new build scripting
* Now accounting for json-value-key/json-key combination
* removed extra files

Co-authored-by: Wendell Piez <wapiez@wendellpiez.com>
nikitawootten-nist pushed a commit to nikitawootten-nist/metaschema-xslt that referenced this issue Jul 21, 2023
…snistgov#36)

* Work in progress on metaschema-related updates towards OSCAL SSP conversion roundtrips.
* added required top-level property to all unit-test JSON schema files
* Added XSD targets for unit testing
* oXygen project file for metaschema testing
* Updated project file
* Test coverage and planning docs
* added unit test for collapse
* fixed a bug in the test script causing expected schema files to not be compared.
* Addressing Issue usnistgov#11: JSON Schema missing constraint at root
* Adding metaschema documentation. usnistgov#16 usnistgov/OSCAL#596
* Added CI/CD files for website.
Added Github issue templates.
* Addressing usnistgov#12, supporting collapsibility of fields.
* Fixed website build error.
* Updating website contents and CI/CD configuration.
* Patch to catch up metaschema implementation to latest changes in the OSCAL repo.
* fixed broken links in documentation
* updated repository documentation to fix broken links
* added configuration support to build scripts
* Implemented content converter generation in build scripts
* Removed references to local files for usnistgov/OSCAL#566
* integrated schema generation unit tests with new build scripting
* Now accounting for json-value-key/json-key combination

Co-authored-by: David Waltermire <david.waltermire@nist.gov>
nikitawootten-nist pushed a commit to nikitawootten-nist/metaschema-xslt that referenced this issue Jul 21, 2023
* integrated schema generation unit tests with new build scripting
* Work in progress on metaschema-related updates towards OSCAL SSP conversion roundtrips.
* added required top-level property to all unit-test JSON schema files
* Added XSD targets for unit testing
* oXygen project file for metaschema testing
* Updated project file
* Test coverage and planning docs
* added unit test for collapse
* fixed a bug in the test script causing expected schema files to not be compared.
* Addressing Issue usnistgov#11: JSON Schema missing constraint at root
* Adding metaschema documentation. usnistgov#16 usnistgov/OSCAL#596
* Added CI/CD files for website.
* Added Github issue templates.
* Addressing usnistgov#12, supporting collapsibility of fields.
* Fixed website build error.
* Updating website contents and CI/CD configuration.
* Patch to catch up metaschema implementation to latest changes in the OSCAL repo.
* fixed broken links in documentation
* updated repository documentation to fix broken links
* added configuration support to build scripts
* Implemented content converter generation in build scripts
* Removed references to local files for usnistgov/OSCAL#566
* integrated schema generation unit tests with new build scripting
* Now accounting for json-value-key/json-key combination
* removed extra files

Co-authored-by: Wendell Piez <wapiez@wendellpiez.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants