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

Update tests to support corrected JSON Schema Generation PR #380

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build/config/.markdown-link-check/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
},
{
"pattern": "https://help.github.com"
},
{
"pattern": "https://www.bottlecaps.de/rex/"
}
],
"replacementPatterns": [
Expand Down
70 changes: 42 additions & 28 deletions test-suite/metaschema-xspec/json-schema-gen/json-schema-gen.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,50 @@
xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
xmlns:j="http://www.w3.org/2005/xpath-functions"
stylesheet="../../../toolchains/xslt-M4/nist-metaschema-MAKE-JSON-SCHEMA.xsl" run-as="external">

<x:scenario label="When generating a JSON schema from composed Metaschema definitions">
<x:scenario label="if it has a defined field with no constraint and no allowed-values">
<x:context href="json-value_unconstrained_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_unconstrained.json' => j:unparsed-text() => j:json-to-xml()"/>
<x:scenario label="if it has a defined flag">
<x:scenario label="with no constraint and no allowed-values">
<x:context href="json-value_flag_unconstrained_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_flag_unconstrained.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>
<x:scenario label="with a constraint, allowed-values, strict enforcement of allow-other='no' and explicit target of '.'">
<x:context href="json-value_flag_constrained-closed_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_flag_constrained-closed.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>
<x:scenario label="with a constraint, allowed-values, no explicit target, and permissive enforcement of allow-other='yes'">
<x:context href="json-value_flag_constrained-open_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_flag_constrained-open.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>
</x:scenario>

<x:scenario label="if it has a defined field with a constraint, allowed-values, strict enforcement of allow-other='no' and explicit target of '.'">
<x:context href="json-value_constrained-closed_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_constrained-closed.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>

<x:scenario label="if it has a defined field with a constraint, allowed-values, no explicit target, and permissive enforcement of allow-other='yes'">
<x:context href="json-value_constrained-open_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_constrained-open.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>

<x:scenario label="if it has a defined field with a constraint, allowed-values, strict enforcement of allow-other='no' and explicit target other than '.'">
<x:context href="json-value_constrained-narrow_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_constrained-narrow.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>

<x:scenario label="if it has a defined field with a constraint, allowed-values, permissive enforcement of allow-other='yes' and explicit target other than '.'">
<x:context href="json-value_constrained-sortof_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_constrained-sortof.json' => j:unparsed-text() => j:json-to-xml()"/>
<x:scenario label="if it has a defined field">
<x:scenario label="with no constraint and no allowed-values">
<x:context href="json-value_field_unconstrained_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_field_unconstrained.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>
<x:scenario label="with a constraint, allowed-values, strict enforcement of allow-other='no' and explicit target of '.'">
<x:context href="json-value_field_constrained-closed_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_field_constrained-closed.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>
<x:scenario label="with a constraint, allowed-values, no explicit target, and permissive enforcement of allow-other='yes'">
<x:context href="json-value_field_constrained-open_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_field_constrained-open.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>
<x:scenario label="with a constraint, allowed-values, strict enforcement of allow-other='no' and explicit target other than '.'">
<x:context href="json-value_field_constrained-narrow_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_field_constrained-narrow.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>
<x:scenario label="with a constraint, allowed-values, permissive enforcement of allow-other='yes' and explicit target other than '.'">
<x:context href="json-value_field_constrained-sortof_metaschema.xml"/>
<x:expect label="the resulting JSON Schema should not have an enum to enforce it."
test="$x:result => j:json-to-xml()" select="'../json-value_field_constrained-sortof.json' => j:unparsed-text() => j:json-to-xml()"/>
</x:scenario>
</x:scenario>
</x:scenario>
</x:description>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading