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's model generated as JSON Schema does not allowed assembly, field, or flag definition #379

Open
aj-stein-gsa opened this issue Mar 3, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@aj-stein-gsa
Copy link
Contributor

aj-stein-gsa commented Mar 3, 2025

Describe the bug

When using this library's (from recent versions built from develop) functionality to generate a JSON schema for generating a JSON schema for writing original Metaschema modules, there are missing options that are schema-valid for object-type. At the top-level of a model, it only allows assembly and field to reference predefined assemblies and fields that do not exist. You cannot use define-assembly or define-field as expected.

Who is the bug affecting

Developers and engineers using the Metaschema specification, this library, and the associated CLI tooling to model with YAML as a first-class data format for the Metaschema module definition.

How do we replicate this issue

  1. Use the following command to run the JSON schema generation.
  2. Use the resulting JSON Schema with the sample example_model.json and validate it with metaschema-module-metaschema.json.
  3. Observe you are unable to validate with the syntactically valid object-type: define-assembly.
% oscal-cli --version
oscal-cli 2.5.0-SNAPSHOT built at 2025-02-27 19:16 from branch develop (ba14f61) at Unknown
liboscal-java 5.2.0-SNAPSHOT built at 2025-02-27 19:06 from branch develop (0d8fbdb) at Unknown
oscal v1.1.3 built at 2025-02-27 19:06 from branch b39789e5ab6df36dbe14f481e40113b91fd25f3f (b39789e) at https://github.com/usnistgov/OSCAL.git
metaschema-java 2.2.0-SNAPSHOT built at 2025-02-27T17:56:27+0000 from branch 284-date-time-extraction-functions (e837c3c) at Unknown
metaschema 2.2.0-SNAPSHOT built at 2025-02-27T17:56:27+0000 from branch 7e49638c1ad19fadc0e556cfca90478f3aae9489 (7e49638) at https://github.com/metaschema-framework/metaschema.git
% git branch --show-current
develop
 % git rev-parse HEAD                                
7e49638c1ad19fadc0e556cfca90478f3aae9489
% cd /home/metaschema
% oscal-cli metaschema generate-schema --as=json schema/metaschema/metaschema-module-metaschema.xml metaschema-module-metaschema.json
# yaml-language-server: $schema=metaschema-module-metaschema.json
METASCHEMA:
  schema-name: Example
  schema-version: 0.1.0-alpha
  short-name: example
  namespace: http://example.org/ns/example
  json-base-uri: http://example.org/ns/example
  definitions:
    - object-type: define-assembly # this will cause a validation error, replace with assembly to resolve, which should not be necessary
      name: root
      formal-name: Example Root
      flags:
        - name: flag
          as-type: string
          required: yes

Expected behavior (i.e. solution)

A top-level of object-type: define-assembly is valid with the generated JSON schema and valid to other metaschema-java capabilities.

Other comments

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To Triage
Development

No branches or pull requests

1 participant