-
Notifications
You must be signed in to change notification settings - Fork 227
Description
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
{ "title" : "External Identifier Schema",
"description" : "Indicates the type of external identifier.",
"allOf" :
[
{ "$ref" : "#/definitions/URIDatatype" },
{ "enum" :
[ "http://orcid.org/" ] } ] },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:
An instance validates successfully against this keyword if it validates successfully against all schemas defined by this keyword's value.
For `anyOf:
An instance validates successfully against this keyword if it validates successfully against at least one schema defined by this keyword's value.
Revisions
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status