-
Notifications
You must be signed in to change notification settings - Fork 183
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
Rename JSON customization elements in the Metaschema #440
Comments
I very much think we should also consider refactoring the design, not only the names. I could sketch out one or two alternatives. |
Dynamic key assignmentThis functionality makes it possible to use a dynamic value as the key of a JSON object, with the result that an object can be promoted from an (unlabeled) member of an array, to be an object (or string) with the given value as its label (key). This implies that key values are unique within the scope of the parent, a constraint that can be validated in XSD and JSON Schema, or via Schematron. Design A.
Works on either field or assembly. Has the effect of assigning the 'name' flag the role of the key in the JSON, Validation must ensure that such name values as represented in the XML are distinct. The Metaschema is validated to see to it that the value of Metaschema Design B.
( Dynamic value-key functionalityPermits assigning a flag to carry a dynamic label for the field value in the JSON. Example in XML
Example in JSON with no value key:
Example with 'name' flag assigned as JSON value key:
Design C
Design D
Static value-key assignmentInstead of designating a flag to carry the value key, a literal value key is assigned. This literal will be used to replace the fallback key value (label) on JSON strings representing (unlabeled) element values in the XML. This enables the assignment of a flag to carry, in the data, the value that will serve as the key of the string (or markup) value of a field. So it may not be used on assemblies. Design E (parallels A and C)
Design F A design to go with B and D instead of A and C could look like E, except with a shorter name:
Example from above, except with this feature:
In this case, validation must ensure not that the |
@wendellpiez I don't see any rationale as to why we need to change the overall construction of these features. Honestly, I prefer the original construction, since the markup is oriented relative to the subject that is being customized. Dynamic key assignmentGiven the following construction:
And the XML:
The resulting JSON would be:
Use of Dynamic value-key functionalityGiven the XML:
The default behavior produces the following JSON:
My preference is to use the
Which would result in the JSON:
I prefer this construction over "design C", since this customization modifies the behavior of how to render the field's value in JSON. As a result, the cusomization should be a child of the field. I don't like "design D" for the same reason. Static value-key assignmentKeeping with the previous constructions, my preference would be for the following to handle the static label case:
Given the XML:
This would result in the following JSON:
Again, in this case we are modifying the behavior of how to render the field's value in JSON. As a result, the cusomization should be a child of the field. I don't like "design E" or "design F" for the same rationele as above. |
7/11/2019This issue and the related ones (noted in #435 ) for the metaschema need to be reviewed together and unitested. However more unit tests need to be created for the other features. |
@wendellpiez thinks there might be a bug still in the |
This has been completed in PR #464. |
User Story:
As an OSCAL model developer, I need to be able to customize the JSON model to produce more concise JSONbased on my Metaschema-based model.
Goals:
There are two major goals in this issue:
key
andvalue-key
elements were added to the Metaschema. These elements drive customization of the resulting JSON models. Since these customizations are specific to JSON, the elements need to be renamed tojson-key
andjson-value-key
respectively. This change will require updates to the Metaschema schema, and to the schema generation, content converter generation, and documentation generation XSLTs.json-key
andjson-value-key
elements have been added to the Metaschema. Their use has not been documented in the Metaschema documentation. The use of these elements needs to be documented there.Dependencies:
None.
Acceptance Criteria
json-key
andjson-value-key
defined by the Metaschema instances.json-key
andjson-value-key
features.The text was updated successfully, but these errors were encountered: