-
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
Define common objects/models in a single place #731
Comments
To clarify @drsm79's issue:
|
This is a big topic and since there is a new Metaschema infrastructure being rolled out, there will be changes to both XML and JSON schemas going forward, so it is also an open-ended one. In general I would also suggest looking at the metaschemas not just the schemas, since that is our point of leverage for these issues. Going forward there should be opportunities to consider this as a feature request for the Metaschema tech. However there might also be low-hanging fruit there. (ORM straight from a metaschema, why not?) |
I think ORM from the metaschema ia s good idea. The question here is probably also how to enable scaling of oscal across multiple programming languages / paradigms quickly. The approach initially used was to leverage the openapi-generator to provide the model generation capability off of a collapsed json (or yaml) schema. Quality varied based on the generators, however, perhaps the higher level requirement is metaschema to openapi? Irrespective I think the biggest issue in the short to medium term is conflicting definitions across schemas within the family. This will increase flexibility (IMO) for generation irrespective of the origin source. |
I wrote some code to do metaschema-based code generation in Java. It generates Java code that can read and write JSON, YAML, and XML that corresponds to a given metaschema. We have plans to write similar code generators for other programming languages (i.e., Javascript/Typescript/NodeJS, Python, etc.). @butler54 Where are you seeing "conflicting definitions across schemas within the family"? We would like to fix these. Can you list where you are seeing these conflicts? |
Metaschema to openAPI spec, yeah ... at any rate, seeing the delta there (and what enhancements might be called for to produce something really nice) could be interesting and maybe even useful. |
@david-waltermire-nist - I'll get you a list (and my dumb script) shortly. I'll look into the metaschema idea - it would be great if we could go straight from metaschema => python (which is the current focus). |
Please excuse the delay - the results below are where inconsistencies where identified across the various schemas. The methodology used:
['oscal_catalog_schema.json', 'oscal_profile_schema.json', 'oscal_ssp_schema.json',
'oscal_component_schema.json', 'oscal_assessment-plan_schema.json',
'oscal_assessment-results_schema.json', 'oscal_poam_schema.json']
Happy to discuss further. |
So the real question here is whether this is a feature or a bug. The Metaschema tech is designed to support this. While the models can acquire structures from each other or a shared pool, they can also replace them with other structures with the same name (homonyms). Another way of asking the question is, why is OSCAL defined in multiple models across its different functional layers, and not just one big model that defines all of them? Lots of reasons, mostly having to do with flexibility, adaptability and agility (I just deleted a bunch of tl;dr). I can't prove a counter-factual, but my guess is that this flexibility and agility have been essential to getting us this far -- and it will remain important for adopters as well. At the same time I don't think it's an open-and-shut case. One might apply a transformation to schemas and data applying an alpha-conversion ...
(This prepends names with names of parents and ancestors at the root thereby hopefully disambiguating everything.) ... and this would be interesting, potentially giving more insight into the design tradeoffs. So perhaps some experiments are in order. I'd also be curious as to how the perceptions of this issue break across users of the XML vs JSON models and data sets. Additionally, it is quite possible that some of these cases might be consolidated, even without introducing a rule prohibiting homonymy across models. Maybe we need an Issue to examine the models with this in mind. |
Now thinking for the renaming, we wouldn't actually need to identify the parent, only the (nominal) root of the model ... still. |
@wendellpiez - happy to participate in some experiments on this issue. From a python front we've started working on some oscal object model / workflow's here: https://github.com/IBM/compliance-trestle - If we can define an experiment I can see what an implementation would look like. |
@butler54 awesome glad to hear this. @david-waltermire-nist will also be in the loop since he has more experience with schema-object mappings than I do. What would a filter look like in Python, that would be able to label or annotate any node in the OSCAL with its nominal root and/or schema ('flavor')? In XSLT (where I live) this would be a near-identity transformation. You would probably want it not just to add a property to nodes, but rename them, for purposes of disambiguation as the data is marshalled into object space. (So a The metaschemas all have a mandatory But here I am really just thinking aloud. I can imagine others imagining entirely different approaches. It's reassuring to look at oscal-compass/compliance-trestle#46 (after writing this) and see you are thinking similarly. |
This was addressed by PR #948, which has added support for a combined XML and JSON schema, along with model specific schema views. |
User Story:
As an OSCAL tool developer, I would like common objects/models to be defined in one schema file.
Goals:
Dependencies:
None that I'm aware of, related to #307
Acceptance Criteria
{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.}
The text was updated successfully, but these errors were encountered: