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

Implement XML element grouping on field or assembly sequences #470

Closed
5 tasks
wendellpiez opened this issue Aug 16, 2019 · 3 comments
Closed
5 tasks

Implement XML element grouping on field or assembly sequences #470

wendellpiez opened this issue Aug 16, 2019 · 3 comments
Assignees
Labels
enhancement Scope: Metaschema Issues targeted at the metaschema pipeline Scope: Modeling Issues targeted at development of OSCAL formats User Story

Comments

@wendellpiez
Copy link
Contributor

wendellpiez commented Aug 16, 2019

User Story:

Analogous to the way Metaschema offers features on the JSON side, it offers an attribute permitting the designer to indicate that a grouped sequence of fields or assemblies, when represented in XML, should be not an unwrapped sequence, but with an explicit wrapper.

Currently the attribute is named @xml-behavior and its permissible values in Metaschema are GROUPED and UNGROUPED, the latter being the default.

With GROUPED specified,

<model>
  <field name="citation" max-occurs="unbounded">
    <group-as name="citation-list" xml-behavior="GROUPED"/>
    <flag name="flag"/>
  </field>
</model>

instead of corresponding to

<citation flag="blah">one</citation>
<citation flag="blah">two</citation>

will be

<citation-list>
  <citation>one</citation>
  <citation>two</citation>
</citation-list>

Goals:

Implement this feature so that designers using metaschema can specify this representation.

Dependencies:

Note that in XSD, the declaration of such a field or assembly will correspond to two element declarations not only one (both citation and citation-list in this example).

Cardinalities should correspond. A minOccurs of 0 should result in an optional wrapper with a required child while when minOccurs is 1 or more, both should be required.

Also see #467 for renaming xml-behavior since strict XML processors might not approve of that name.

Finally, unit testing these features will need to be integrated into CI-CD (on two levels, validating schema production and validation schema functionality on instances), which will be very useful going forward.

Acceptance Criteria

  • Unit tests have been developed and deployed to demonstrate the specified behavior
    • This includes both unit tests for XSD production and tests of the XSD functionality in instances (unit testing for validity or not)
  • Metaschema XSD generation supports the functionality and unit tests pass (or fail) correctly
  • A Pull Request (PR) is submitted that fully addresses the goals of this User Story. This issue is referenced in the PR.
  • Integrate these unit tests into CI-CD.
  • The CI-CD build process runs without any reported errors on the PR. This can be confirmed by reviewing that all checks have passed in the PR.
@wendellpiez
Copy link
Contributor Author

We must also make name change(s) related to this since the name xml-behavior is not XML-compliant (since it starts with 'xml'). Possibilities: as-json and as-xml, in-json and in-xml ...

<group-as name="citation-list" as-xml="GROUPED" as-json="SINGLETON_OR_ARRAY"/>

@david-waltermire david-waltermire added Scope: Modeling Issues targeted at development of OSCAL formats Scope: Metaschema Issues targeted at the metaschema pipeline labels Sep 4, 2019
@wendellpiez
Copy link
Contributor Author

This is implemented in PR #484.

We need unit tests.

@david-waltermire
Copy link
Contributor

This was completed in PR #492.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Scope: Metaschema Issues targeted at the metaschema pipeline Scope: Modeling Issues targeted at development of OSCAL formats User Story
Projects
None yet
Development

No branches or pull requests

2 participants