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

Glitch in (unused) feature on json-value-key #169

Closed
wendellpiez opened this issue Aug 19, 2021 · 7 comments · Fixed by #191 or #197
Closed

Glitch in (unused) feature on json-value-key #169

wendellpiez opened this issue Aug 19, 2021 · 7 comments · Fixed by #191 or #197
Assignees
Labels
bug Something isn't working XSLT Implementation Issue relates to the XSLT implementation of Metaschema.

Comments

@wendellpiez
Copy link
Collaborator

wendellpiez commented Aug 19, 2021

json-value-key/@flag-name - feature or residue?

Metaschema json-value-key can be used with @flag-name, indicating not that the value of the element is to be used as literal key for the (nominal) field value, but that the key value is assumed to serve as the value of a flag given on the field. That is, any property in the JSON not defined as a flag, is taken to be a pairing of flag (value) with value. This affords a kind of abbreviation:

<field name="property">
  <flag name="name"/>
  <flag name="date"/>
   <json-value-key flag-name="name"/>
</field>

In XML this would be (note the 'value' is the 'value' of the element):

<property date="today" name="datestamp">APR-31</property>

while in JSON (where the value must be a property key/value like anything else):

{ datestamp: APR-31,
  date: 'today' }

However this metaschema (example) is not currently valid against the XSD for Metaschema, which defines json-value-flag as type NCName, which does not permit an empty (null) value.

This feature not used anywhere in the OSCAL schemas. (So it could be argued we do not actually support it since there is no valid way to express it.)

Do we wish to deprecate use of json-value-key/@flag-name removing it from the schema altogether (and ripping out code that supports it)?

If we wish to support it we need to be able to validate it, which we currently cannot since the NCName type (as mentioned) requires a value, and using the @flag-name we specifically wish not to designate a literal name (for the value key) but assign it dynamically.

Who is the bug affecting?

Currently we are not using this feature in OSCAL, so related code is a no-op and no unwanted validation errors are encountered.

What is affected by this bug?

Anyone using this feature of Metaschema.

When does this occur?

Anytime schema validation is performed on an OSCAL metaschema with define-field/json-value-key/@flag-name.

Other Comments

If the feature is to be removed, let's remove the flag-name attribute?

@wendellpiez wendellpiez added the bug Something isn't working label Aug 19, 2021
@david-waltermire
Copy link
Collaborator

We may want something like:

<field name="property">
  <flag name="name"/>
  <flag name="date"/>
   <json-value-key-value>name</json-value-key-value>
</field>

or

<field name="property">
  <flag name="name"/>
  <flag name="date"/>
   <json-value-key-flag>name</json-value-key-flag>
</field>

@wendellpiez
Copy link
Collaborator Author

wendellpiez commented Aug 24, 2021

Okay on json-value-key-flag but suggest json-value-key for the case of assigning the literal key name, not a flag? (It will be much more common, iinm.)

@wendellpiez
Copy link
Collaborator Author

Noting that when we make this change we break the converters, etc.

@david-waltermire
Copy link
Collaborator

The metaschema.xsd changes for this are in #191. The XSLT implementation needs to be updated once #191 is merged to develop.

@david-waltermire david-waltermire added the XSLT Implementation Issue relates to the XSLT implementation of Metaschema. label Mar 10, 2022
@david-waltermire david-waltermire added this to the Metaschema 0.9.0 milestone Mar 10, 2022
@aj-stein-nist
Copy link
Collaborator

Closed after reviewing, it is complete.

@aj-stein-nist
Copy link
Collaborator

P.S.: merge the feature branch back into develop before it is "complete complete." @david-waltermire-nist is doing that now as we speak.

@aj-stein-nist
Copy link
Collaborator

This issue is part of current dev work and is already being done by Wendell and Dave in #195. Will update in triage board accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working XSLT Implementation Issue relates to the XSLT implementation of Metaschema.
Projects
Status: Done
3 participants