-
Notifications
You must be signed in to change notification settings - Fork 194
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
Parameter insertion JSON template syntax #194
Comments
A simplistic approach would be to support JSON Pointer (RFC 6901) surrounded by double curly braces. For example: {
"params": {
"param4": {
"value": "paramValue"
}
},
"parts": {
"part5": {
"prose": "Some prose with parameter {{ #/params/param4/value }}"
}
}
}
Another approach could be to use a dot/bracket notation accessor syntax which is common amongst the various template languages that are out there. It is also the native mechanism for accessing object properties and their values in JavaScript. For example: {
"params": {
"param4": {
"value": "paramValue"
}
},
"parts": {
"part5": {
"prose": "Some prose with parameter {{ .params.param4.value }}"
}
}
}
Bracket notation could also be supported as follows: Assuming that this syntax only applies to the |
Andrew, this is pretty sweet. Syntactically, the mapping to XML (where we have But note how this means also that there will be strong dependencies on validation, for example we will really have to validate the uniqueness (across catalog scope) of those id values @anweiss ! |
Sprint 11 Progress June 7 2018 This issue depends on #186. Conversion from the XML syntax to the embedded-in-JSON syntax is straightforward. The conversion the other way will be part of the mardown->XML conversion that will be needed to support (complete) conversion back into XML. Progress to date: design 100% (see above); implementation 0% |
While not specific to this issue, some early thoughts on HTML/markdown translation are here: https://github.com/usnistgov/OSCAL/blob/master/docs/schema/html-markdown-format-mapping.md. |
Flagging related issue #200 |
June 21 Status: The discussions in #200 will result in a foundation on which this particular issue can be addressed. |
6/21/2018 Status
|
June 28 Status Meeting UpdateThis will be discussed again during the June 29 meeting. A decision will be made then. |
August 9 Status: No updates. This is still dependent on #224. |
Status Meeting: 8/23/2018No updates. This is still dependent on #224 |
Status Meeting: 8/30/2018No updates. This is still dependent on #224 |
09/27/2018No updates at this point. This will be addressed by ongoing fine-tuning of the metaschema. |
@anweiss and @wendellpiez Is JSON parameter insertion on par with XML? Has this been addressed fully? |
I believe we are aligned for now. Parameter insertion points should be included in our testing for #283 and #343 (XML/JSON bidirectional conversion).
where param.id is the identifier of the parameter whose value is to be provided. To escape: represent one or both braces as If this looks good I propose that when we close #343 we consider this one closable as well. To capture the documentation requirement, I have made #357. |
This has been completed. Follow-on issues have been created. |
User Story:
As an OSCAL producer, I can leverage a pre-defined template syntax for embedding parameter values into JSON-formatted OSCAL artifacts. This syntax would be analagous to the existing
<insert param-id="paramId"/>
inline element construct currently used in XML prose. As an OSCAL consumer, I can interpret, both pre-processed and post-processed, JSON-formatted OSCAL artifacts with parameters that are inserted using this syntax. Pre-processed artifacts would contain raw template text and post-processed artifacts are those whose template syntax has been parsed and substituted with the actual values referenced by the block.The idea would be to take a condensed subset of existing template languages (e.g. Jinja, Handlebars, Go, etc), and allow for it to be used for parameter insertion in JSON. If warranted, this could also be extended to enable co-occurrence constraints via expressions and conditionals, and other capabilities deemed applicable; albeit not required for acceptance of this user story.
Goals:
Parameter insertion in JSON cannot work the same way as it does in XML with inline elements. Instead, prose in JSON can only be a JSON string type, where special characters are appropriately escaped. The goal of this issue is to document in the metaschema a solution for embedding parameters into JSON-equivalent prose strings and that which can be used to cross-reference parameters in the same (or external) JSON-formatted OSCAL artifact. (@wendellpiez @anweiss)
Dependencies:
Can be done in parallel to #125, #193, #186, and #153.
Acceptance Criteria
An appropriate template syntax has been agreed upon, has been documented in the metaschema, and can be used to cross-reference and insert parameters into JSON-equivalent prose strings. Furthermore, when a set of parameter data is provided, the proposed syntax is processed and the actual values are inserted into the final artifact.
The text was updated successfully, but these errors were encountered: