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

Data elements for JSON consolidation #239

Closed
3 tasks done
anweiss opened this issue Sep 24, 2018 · 3 comments
Closed
3 tasks done

Data elements for JSON consolidation #239

anweiss opened this issue Sep 24, 2018 · 3 comments
Assignees
Labels
Discussion Needed This issues needs to be reviewed by the OSCAL development team. enhancement Scope: Modeling Issues targeted at development of OSCAL formats

Comments

@anweiss
Copy link
Contributor

anweiss commented Sep 24, 2018

This issue is meant to track data elements that would allow for potential consolidation of JSON and JSON schema artifacts. The initial list is as follows:

  • hoisting array values into objects whose keys are the unique identifiers in the original array (possible for props, params and parts)

    Original XML snippet:

    <prop class="name">AC-1</prop>
    <prop class="priority">P1</prop>
    <prop class="baseline-impact">LOW</prop>
    <prop class="baseline-impact">MODERATE</prop>
    <prop class="baseline-impact">HIGH</prop>

    Current JSON equivalent:

    "props": [
      {
        "class": "name",
        "value": "AC-1"
      },
      {
        "class": "priority",
        "value": "P1"
      },
      {
        "class": "baseline-impact",
        "value": "LOW"
      },
      {
        "class": "baseline-impact",
        "value": "MODERATE"
      },
      {
        "class": "baseline-impact",
        "value": "HIGH"
      }
    ]

    Proposed JSON restructuring:

    "props": {
       "name": "AC-1",
       "priority": "P1",
       "baselineImpacts": [ "LOW", "MODERATE", "HIGH" ]
    }
  • support for both single-value arrays and singular property/values

    "baselineImpacts": [ "LOW" ]

    becomes:

    "baselineImpact": "LOW"
  • arrays of single-property objects become arrays whose values are from the original array's object's values

    Example of current JSON profile:

    "imports": [
       {
         "include": {
           "calls": [
             {
               "controlId": "ac-1"
             },
             {
               "controlId": "ac-2"
             },
             {
               "subcontrolId": "ac-2.1"
             }
           ]
         }
       }
    ]

    becomes:

    "imports": [
      {
        "includeControls": ["ac-1", "ac-2"],
        "includeSubcontrols": ["ac-2.1"],
        "matchControls": "<regex>"
      }
    ]

    the example above assumes the user disregards or simply has no need for the with-control/subcontrols semantics (they become optional) and explicitly calls the controls out instead

wendellpiez added a commit to wendellpiez/OSCAL that referenced this issue Sep 25, 2018
@david-waltermire
Copy link
Contributor

@anweiss has this been sufficiently addressed for you? If so, comment and transfer this back to me to close. if not, please indicate what still needs to be done.

@david-waltermire david-waltermire added Discussion Needed This issues needs to be reviewed by the OSCAL development team. enhancement Scope: Modeling Issues targeted at development of OSCAL formats labels May 8, 2019
@wendellpiez
Copy link
Contributor

wendellpiez commented May 28, 2019

There are lots of good ideas here but they will require extension of metaschema functionality to provide validations for testing and ensuring the requisiste consistency in the data.

Just for example, to produce this enviable JSON from profile XML:

"imports": [
  {
    "includeControls": ["ac-1", "ac-2"],
    "includeSubcontrols": ["ac-2.1"],
    "matchControls": "<regex>"
  }
]

the processor must be configured to know that any import/call/@control-id (XPath into the profile XML) should be represented as a string value in an array labeled includeControls.

This is not impossible -- the call field and control-id flag in the Metaschema have declarations, where the information for such optimizations might be described (here, that the calls are removable while their control IDs, subcontrol IDs etc can be promoted into a labeled array object). However, it requires design, development and testing.

@wendellpiez
Copy link
Contributor

Working on the first two items in my branch issue388-json-refactor. See #388.

Leaving the last issue for later since the modeling questions are more complex.

wendellpiez added a commit to wendellpiez/OSCAL that referenced this issue Jun 12, 2019
wendellpiez added a commit to wendellpiez/OSCAL that referenced this issue Jun 14, 2019
wendellpiez added a commit to wendellpiez/OSCAL that referenced this issue Jun 15, 2019
david-waltermire pushed a commit that referenced this issue Jun 15, 2019
* Testing and example files for metaschema feature extensions.
* Deleted the puzzling 'src/demo` directory
* Fixed producing JSON that is more condensed - and rendering it back again. #239, #388.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Needed This issues needs to be reviewed by the OSCAL development team. enhancement Scope: Modeling Issues targeted at development of OSCAL formats
Projects
None yet
Development

No branches or pull requests

3 participants