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

Factor out local definitions in latest OSCAL metaschemas (where possible) #697

Closed
3 tasks
wendellpiez opened this issue Jun 17, 2020 · 2 comments
Closed
3 tasks
Assignees
Labels
closable enhancement model-refactor Used to mark issues related to model refactoring for the Metaschema v4 transition. Scope: Modeling Issues targeted at development of OSCAL formats

Comments

@wendellpiez
Copy link
Contributor

wendellpiez commented Jun 17, 2020

User Story:

The next-generation Metaschema provides opportunities for simplification where local definitions can be removed in favor of constraints targeting the fields or flags requiring adjustment.

Example:

Where the metadata metaschema module has:

<define-assembly name="metadata">
    <formal-name>Publication metadata</formal-name>
    <description>Provides information about the publication and availability of the containing document.</description>
    <model>
        <field ref="title" min-occurs="1"/>
        ...
        <define-field name="prop" max-occurs="unbounded">
            <formal-name>prop field</formal-name>
            <description>prop field ... </description>
            <json-value-key>value</json-value-key>
            <group-as name="properties" in-json="ARRAY"/>
            <define-flag name="name">
                <formal-name>name flag</formal-name>
                <description>name flag ... </description>
                <constraint>
                    <allowed-values allow-other="yes">
                       <enum value="keywords">Used to provide a listing of keywords. This is typically used on a <code>prop</code> in the <code>metadata</code> to provide keywords for the document.</enum>
                    </allowed-values>
                 </constraint>
              </define-flag>
           </define-field>
       ...
    </model>
</define-assembly>

It could have instead:

<define-assembly name="metadata">
    <formal-name>Publication metadata</formal-name>
    <description>Provides information about the publication and availability of the containing document.</description>
    <model>
        <field ref="title" min-occurs="1"/>
        ...
        <field ref="prop" max-occurs="unbounded">
            <group-as name="properties" in-json="ARRAY"/>
         </field>
       ...
    </model>
    <constraint>
        <allowed-values allow-other="yes" target="prop/@name">
           <enum value="keywords">Used to provide a listing of keywords. This is typically used on a <code>prop</code> in the <code>metadata</code> to provide keywords for the document.</enum>
        </allowed-values>
    </constraint>
</define-assembly>

The global definition for prop is used since defining only constraints for its name usage (in the context of metadata) is easier than defining a new fields and flags. The metaschema is tidier and easier to maintain.

Occasions of this are relatively easy to find by looking at local definitions mirroring global definitions. The main offender is the name flag on the prop field.

Goals:

Functionally, there should be no changes after this improvement, except that documentation should be neater.

Dependencies:

Managing the constraints this way depends on the new constraints enforcement functionality (see Issue #595). This work could be done in conjunction with testing of these features.

Acceptance Criteria

  • All OSCAL website and readme documentation affected by the changes in this issue have been updated. Changes to the OSCAL website can be made in the docs/content directory of your branch.
  • A Pull Request (PR) is submitted that fully addresses the goals of this User Story. This issue is referenced in the PR.
  • 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.

{The items above are general acceptance criteria for all User Stories. Please describe anything else that must be completed for this issue to be considered resolved.}

@david-waltermire david-waltermire added the model-refactor Used to mark issues related to model refactoring for the Metaschema v4 transition. label Sep 11, 2020
@david-waltermire david-waltermire added the Scope: Modeling Issues targeted at development of OSCAL formats label Sep 11, 2020
@david-waltermire david-waltermire self-assigned this Oct 30, 2020
@david-waltermire
Copy link
Contributor

This work has been completed in PR #754.

@david-waltermire david-waltermire linked a pull request Nov 24, 2020 that will close this issue
30 tasks
@david-waltermire
Copy link
Contributor

This issue was addressed by PR #758.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closable enhancement model-refactor Used to mark issues related to model refactoring for the Metaschema v4 transition. Scope: Modeling Issues targeted at development of OSCAL formats
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants