oasis-tcs / openc2-jadn

OASIS OpenC2 TC: Specifing a vocabulary to describe the meaning of structured data, to provide hints for user interfaces working with structured data, and to make assertions about what a valid instance must look like. https://github.com/oasis-tcs/openc2-jadn
Other
4 stars 2 forks source link

Package Namespaces #71

Closed davaya closed 2 weeks ago

davaya commented 1 month ago

Section 6 describes fields in the "info" section of a JADN schema, and Annexes E and F are the JSON Schema and and JADN schemas for a package. A "namespaces" property is included in the info section with the syntax

Namespaces = MapOf(NSID, Namespace){1..*}    // Packages with referenced type defs

Two use cases are precluded by this definition because MapOf requires NSIDs to be unique:

  1. Splitting a single namespace across multiple packages
  2. Importing multiple packages into the current package

Defining a single namespace composed of multiple packages requires the same NSID to correspond to multiple Namespaces, and importing packages into the current package requires the blank NSID "" to correspond with multiple Namspaces. This requires changing namespaces from a Map (where keys must be unique) to a Set of pairs where just the pairs must be unique.

Although this is a syntax change to the JADN metaschema, it can be made non-breaking by allowing either the JADN v1.0 or v1.1 syntax. Supporting this requires adding an anyOf type option to the Choice type in JADN v1.1. This option is needed for other reasons and will be added to v1.1:

   ["Namespaces", "Choice", ["CO"], "anyOf v1.1 or v1.0", [
     [1, "ns1", "Ns1", [], "[prefix, namespace] pairs syntax - v1.1 - allow duplicate prefixes"]
     [2, "ns2", "Ns2", [], "prefix:Namespace map syntax - v1.0 - prefix must be unique"],
   ]],
   ["Ns1", "ArrayOf", ["*NSPair", "u"], "v1.1 - Packages with referenced type defs", []]
   ["NSPair", "Array", [], "", [
     [1, "prefix", "NSID", [], ""],
     [2, "namespace", "Namespace", [], ""]
   ]],
   ["Ns2", "MapOf", ["*Namespace", "+NSID", "{1"], "Packages with referenced type defs", []],

where "C" is the logical combination type option applicable to Choice, and CO means the logical OR operation = anyOf.

The three combination options are: CO = OR = anyOf CA = AND = allOf CX = XOR = oneOf

davaya commented 2 weeks ago

Closed by #80