-
Notifications
You must be signed in to change notification settings - Fork 184
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
OSCAL 1.0.5 JSON schema uses allOf
where anyOf
is more appropriate
#1773
Comments
Better reproduction: git clone --recursive https://github.com/usnistgov/oscal-content
git clone --recurisve https://github.com/usnistgov/OSCAL
npm install -g ajv-cli ajv-formats
ajv validate --spec=draft7 -c ajv-formats -s OSCAL/json/schema/oscal_catalog_schema.json -d oscal-content/nist.gov/SP800-53/rev5/json/NIST_SP-800-53_rev5_catalog.json
ajv validate --spec=draft7 -c ajv-formats -s OSCAL/json/schema/oscal_catalog_schema.json -d oscal-content/nist.gov/SP800-53/rev4/json/NIST_SP-800-53_rev4_catalog.json
ajv validate --spec=draft7 -c ajv-formats -s OSCAL/json/schema/oscal_profile_schema.json -d oscal-content/nist.gov/SP800-53/rev4/json/NIST_SP-800-53_rev4_MODERATE-baseline_profile.json All of those Very aggressively changing all occurrences of
you can then perform the catalog validations and see them succeed. |
I attempted to find out why there are two So I attempted to find the XML equivalent and found it is not equivalent. It is just a URI (i.e., the only possibility). The reproduction faults with gapinski@flexion-mac-C02FCBVSMD6N usnistgov % ajv validate --spec=draft7 -c ajv-formats -s OSCAL/json/schema/oscal_catalog_schema.json -d oscal-content/nist.gov/SP800-53/rev5/json/NIST_SP-800-53_rev5_catalog.json
oscal-content/nist.gov/SP800-53/rev5/json/NIST_SP-800-53_rev5_catalog.json invalid
[
{
instancePath: '/catalog/metadata/props/0/name',
schemaPath: '#/properties/name/allOf/1/enum',
keyword: 'enum',
params: { allowedValues: [Array] },
message: 'must be equal to one of the allowed values'
}
]
gapinski@flexion-mac-C02FCBVSMD6N usnistgov % which has an analogous |
I think the cause of this is one of the following:
The latter feels more likely but I am not sure whether it can be fixed by naively changing to |
Sorry we hadn't responded. Yesterday I looked into this but I am still uncertain as to why it is happening in the context of OSCAL. For the referenced usnistgov/metaschema#253 PR, we specifically tested the implementation change to drop I guess it is back to the drawing board since it did not work as intended when running the updated codebase against OSCAL. I am glad you figured all this out and reported it here and the relevant issue. Kudos to you, @kylelaker. |
Metaschema devs will need to look into the issue reported and determine where the bug is exactly and circle back on this, potentially in the next sprint or the one after. |
@JustKuzya, I know we discussed this earlier today during standup, but here is the PR feedback based on when you and I met with @nikitawootten-nist and paired. usnistgov/metaschema#360 (review) I am going to wait to hear back from @kylelaker to determine how we want to work together on the necessary unit tests to increase the coverage we were missing for this bit, and then the work is more or less done on this. |
@JustKuzya and @nikitawootten-nist, |
I have a local setup for testing. If you want to meet to establish additional criteria or add some timing script into pages, we can meet.
DC
From: A.J. Stein ***@***.***>
Sent: Monday, June 12, 2023 12:47 PM
To: usnistgov/OSCAL ***@***.***>
Cc: Cousin, Dmitry A. (Fed) ***@***.***>; Mention ***@***.***>
Subject: Re: [usnistgov/OSCAL] OSCAL 1.0.5 JSON schema uses `allOf` where `anyOf` is more appropriate (Issue #1773)
@JustKuzya<https://github.com/JustKuzya> and @nikitawootten-nist<https://github.com/nikitawootten-nist>, let me know if you want to talk about perf testing this afternoon let me know.
-
Reply to this email directly, view it on GitHub<#1773 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACS6IVVORLCHNLWXP4IBWXLXK5BYDANCNFSM6AAAAAAXJ7DMJA>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
Previously in usnistgov#360, @kylelaker reported a needed improvement to fix a regression for usnistgov/OSCAL#1773. While I had been completing testing in usnistgov#360 and properly expanding test coverage to address how we handle enumerations based on allow-other and target attributes for field and flag elements in Metaschema (both act similarly but subtly different with more scenarios for field), I observed my test data instances needed further correction in a way that cannot be address in the PR by Kyle. This merges the changes from the commit reffed by the URL below, adds my enhancement, tests, and all examples that helped me uncover missing code. usnistgov@6fb8a74 Co-authored-by: Kyle Laker <kyle@laker.email>
Marking blocked until Metaschema PR reviewed and merged. |
* Correct field and flag enumerations in JSON schemas. Previously in #360, @kylelaker reported a needed improvement to fix a regression for usnistgov/OSCAL#1773. While I had been completing testing in #360 and properly expanding test coverage to address how we handle enumerations based on allow-other and target attributes for field and flag elements in Metaschema (both act similarly but subtly different with more scenarios for field), I observed my test data instances needed further correction in a way that cannot be address in the PR by Kyle. This merges the changes from the commit reffed by the URL below, adds my enhancement, tests, and all examples that helped me uncover missing code. 6fb8a74 * Surpress bottlecaps.de link fail More info below: https://github.com/usnistgov/metaschema/actions/runs/5228171226/jobs/9440341454 Co-authored-by: Kyle Laker <kyle@laker.email>
#380 has been merged. Separate of the PR there, I also tested the pushed up models and confirm many of the enumerations across 4/7 models had flag and field enumerations correctly updated by diffing them with Oxygen and ignoring whitespace. The only changes were correct updates from |
* Update metaschema for 1.0.6 release This PR commit will update the Metaschema submodule to update. We need to update the underlying version of the MIMF to address the following: Closes #1773. Closes #1774. * Fix Metaschema XML schema URL Per @nikita-wootten-nist's feedback, fix this URL which has not been updated in either develop or main branches as the Metaschema 0.9.0 and directory restructuring occurred during the course of the drafting of the 1.0.6 release.
Closing with 1.0.6. pre-release. |
* Update metaschema for 1.0.6 release This PR commit will update the Metaschema submodule to update. We need to update the underlying version of the MIMF to address the following: Closes #1773. Closes #1774. * Fix Metaschema XML schema URL Per @nikita-wootten-nist's feedback, fix this URL which has not been updated in either develop or main branches as the Metaschema 0.9.0 and directory restructuring occurred during the course of the drafting of the 1.0.6 release.
Describe the bug
There are many fields with well-known values but that also "may be locally defined". In OSCAL v1.0.5's JSON schema, these are represented as
allOf
between an enum and the string-with-format data type.allOf
requires that the data match all given schemas, effectively limiting values to only the enum.anyOf
may be more appropriate.For example https://pages.nist.gov/OSCAL/reference/1.0.5/catalog/json-reference/#/catalog/metadata/parties/external-ids/scheme is shown in JSON schema as
I found the commit view useful to see the difference.
See: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7
Who is the bug affecting
Consumers of the OSCAL JSON schema
What is affected by this bug
Tooling & API
How do we replicate this issue
Evaluate a value such as "https://example.com/" against the given field.
Expected behavior (i.e. solution)
The JSON schema should not reject valid data when the value "may be locally defined".
Other comments
For Draft 07,
allOf
(and friends) are defined the validation specification but have moved to Core in the latest spec.For
allOf
:For `anyOf:
Revisions
No response
The text was updated successfully, but these errors were encountered: