-
Notifications
You must be signed in to change notification settings - Fork 19
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
has-cardinality
doesn't work as intended without @test
#559
Comments
In today's community call, we revisited this bug and did agree there is some gap in consistency around the how the When discussing and reviewing the examples, we can understand, by metaphor, that constraints like this constraint and some (but not all) constraint types have a notion of "subject" and "objects" of a constraint, much like natural language, to what are you constraining and how we constrain it respectively. We agree this is an important metaphor to use in upcoming documentation pertaining to these changes given pending work described below. Moving forward, we agree we should 1) enhance has cardinality to add a new attribute to capture that missing "object" definition (because the currently existing @david-waltermire, @wendellpiez, or others let me know if I missed something or misconstrued it. |
Let's say the 'object' flag is called To confirm, as I understand it this stipulates that where the old syntax appears (missing <has-cardinality target="EXPR" mix-occurs="3" max-occurs="5"/> becomes <has-cardinality target="." counting="EXPR" mix-occurs="3" max-occurs="5"/> Indeed I was hoping that this could work out if we simply stated the default of But indeed, this makes this constraint more like the others, a good thing. |
There is no bug here. The only implementation currently in the field (tmk) for the The semantics of https://pages.nist.gov/metaschema/specification/syntax/constraints/#has-cardinality-constraints If/when OSCAL-CLI is no longer conformant to this specification (perhaps preferring another one under more active maintenance), presumably they have stated that (or rather, they point to a spec to which they do conform), in which case this becomes an oscal-cli question (how does the feature work there?) or an "academic" one (since we otherwise do not support the feature). To the extent this might (now or someday) warrant syntax changes in updated OSCAL models is an OSCAL question. If the OP or any users prefer to propose changes to the current design - it would entail both a new schema for the Metaschema, and updates to the docs - that is properly done via a PR. (However if they have already moved off this schema/docs, they may not want to bother.) @david-waltermire @aj-stein-nist please offer any qualifications, corrections or caveats to what I have just stated? (In particular, my links might be stale if work has moved off NIST repositories?) Random observation: IMV the deeper problem of which this problem is a symptom will never be remedied by multiple implementations chasing one another's tails, but by a community-backed and -built set of tests showing both typical and edge cases. Without a library of tests we can share, and which can be validated externally by friends and adversaries, all else is thrashing. I know you folks who know me can hear the song looping here. We need two such libraries: one test library for the metaschema (or equivalent back end) supporting the design of its supported constraints model (syntax and semantics); and one test library for OSCAL, for testing the design of OSCAL constraints specifically. |
Describe the bug
I discovered this when completing a tutorial for #554 and attempting to build representation models.
In the current version of the Metaschema syntax of the
has-cardinality
constraint, twohas-cardinality
constraints that query exclusive sequences in different document instances cannot be defined in the same model. In this case given a mutually exclusive@target
when it is true for document instances the constraint will pass as valid and for false for others, and not be ignored when the@target
does not match.Examples are provided below in how to reproduce the bug.
I recommend we add
@test
to match other syntax and semantics of other constraint types to support this behavior.Who is the bug affecting?
Developers of information models that need conditional logic processing of similar
has-cardinality
constraints, but with differentmin-occurs
andmax-occurs
that cannot be satisfied optionally.What is affected by this bug?
Processing of
has-cardinality
constraints.When does this occur?
Consistently
How do we replicate the issue?
Use the following Metaschema module and samples.
When only two items with
@grouping='two-only-group'
constraint with@id='three-only-group
fails even if@target
doesn't match.
When only three items with
@grouping='three-only-group'
constraint with@id='two-only-group
fails even if@target
doesn't match.Expected behavior (i.e. solution)
The
min-occurs
andmax-occurs
properly trigger conditionally for one constraint and the other based on test evaluation, but not both so one always fail.Other Comments
Per preliminary discussion with @david-waltermire, I am opening this issue for discussion and review with maintainers and community adopters in an upcoming meeting.
The text was updated successfully, but these errors were encountered: