Skip to content

Commit

Permalink
merge: Merge pull request #27 from DSD-DBS/fix-docs
Browse files Browse the repository at this point in the history
Update snapshot schema
  • Loading branch information
ewuerger authored Feb 9, 2023
2 parents b1ab606 + 08382d0 commit 35a1d95
Show file tree
Hide file tree
Showing 9 changed files with 420 additions and 304 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Documentation

Read the `full documentation on Github pages`__.

__ https://dsd-dbs.github.io/capellambse-rm-bridge
__ https://dsd-dbs.github.io/capella-rm-bridge

Installation
------------
Expand Down
1 change: 1 addition & 0 deletions capella_rm_bridge/auditing.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class ChangeAuditor:
attribute="allocated_functions",
element="<LogicalFunction 'Root Logical Function' (f2...)>",
uuid="f28ec0f8-f3b3-43a0-8af7-79f194b29a2d",
),
Deletion(
parent="0d2edb8f-fa34-4e73-89ec-fb9a63001440",
attribute="components",
Expand Down
11 changes: 11 additions & 0 deletions capella_rm_bridge/changeset/actiontypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ class WorkItem(te.TypedDict, total=False):
children: cabc.Sequence[WorkItem]


class MetaData(te.TypedDict):
tool: str
revision: str
connector: str


class TrackerSnapshot(te.TypedDict):
id: int
version: int | float
Expand All @@ -53,6 +59,11 @@ class TrackerSnapshot(te.TypedDict):
items: cabc.Sequence[WorkItem]


class Snapshot(te.TypedDict):
metadata: MetaData
modules: cabc.Sequence[TrackerSnapshot]


class AttributeDefinition(te.TypedDict):
type: str

Expand Down
265 changes: 167 additions & 98 deletions capella_rm_bridge/changeset/snapshot_input.schema.json
Original file line number Diff line number Diff line change
@@ -1,120 +1,189 @@
{
"$id": "https://dsd-dbs.github.io/rm-bridge/importer/snapshot.schema.json",
"$id": "https://dsd-dbs.github.io/capella-rm-bridge/importer/snapshot.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "RM-Bridge Importer Snapshot",
"title": "Capella RM-Bridge Importer Snapshot",
"description": "A downloaded snapshot of Requirements Modules from an external Requirements Management tool.",
"type": "array",
"items": {
"$ref": "#/$defs/requirements-module"
},
"minItems": 1,
"uniqueItems": true,
"$defs": {
"requirements-module": {
"description": "Representation of a RequirementsModule in Capella, taken from the external RM tool. Some tools might use different terminology for the same concept (like \"Tracker\", etc.)",
"type": "object",
"properties": {
"metadata": {
"description": "Metadata of all components that created this snapshot. This includes version info and revision hashes/numbers of content.",
"type": "object",
"required": [
"id"
],
"additionalProperties": false,
"properties": {
"id": {
"description": "The unique identifier of this module in the external RM tool.",
"tool": {
"description": "Version of the used RM Tool.",
"type": "string"
},
"attributes": {
"description": "AttributeDefinitions for all possible attributes that Requirements or RequirementsFolders in a module could have. Not all of these definitions need to be actually used by any of the requirements' AttributeValues.",
"revision": {
"description": "Revision of the content managed by the RM Tool.",
"type": "string"
},
"connector": {
"description": "Version of the used software for connecting/bridging the RM Tool with Capella.",
"type": "string"
}
},
"required": [
"tool",
"revision",
"connector"
]
},
"modules": {
"type": "array",
"items": {
"$ref": "#/properties/modules/$defs/requirements-module"
},
"minItems": 1,
"uniqueItems": true,
"$defs": {
"requirements-module": {
"description": "Representation of a RequirementsModule in Capella, taken from the external RM tool. Some tools might use different terminology for the same concept (like \"Tracker\", etc.)",
"type": "object",
"patternProperties": {
".": {
"required": [
"id"
],
"additionalProperties": false,
"properties": {
"id": {
"description": "The unique identifier of this module in the external RM tool.",
"type": "string"
},
"long_name": {
"description": "Value of the \"Long Name\" field in Capella. Here it is the long name of the CapellaModule.",
"type": "string"
},
"data_types": {
"description": "EnumerationDataTypeDefinition for all EnumerationAttributeDefinitions used by EnumAttributeValues. Not all of these definitions need to be actually used by any of the requirements' EnumAttributeValues.",
"type": "object",
"oneOf": [
{
"properties": {
"type": {
"type": "string",
"enum": [
"Boolean",
"Date",
"Float",
"Integer",
"String"
]
}
},
"additionalProperties": false
},
{
"additionalProperties": false,
"patternProperties": {
".": {
"description": "The values that are available for this EnumerationDataTypeDefinition. They are sometimes called \"options\"",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"requirement_types": {
"description": "All RequirementTypes whose Requirements can be assigned to. These are for managing availability of values and data-types for all AttributeValues via AttributeDefinitions.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
".": {
"description": "The RequirementType that are available for all Requirements to be assigned to.",
"type": "object",
"additionalProperties": false,
"required": [
"long_name"
],
"properties": {
"type": {
"type": "string",
"const": "Enum"
"long_name": {
"description": "Value of the \"Long Name\" field in Capella. Here it is the long name of the RequirementType.",
"type": "string"
},
"values": {
"description": "The values that this Enum Attribute can have.",
"type": "array",
"items": {
"type": "string"
"attributes": {
"description": "AttributeDefinitions for all possible attributes that Requirements or RequirementsFolders in a module could have. Not all of these definitions need to be actually used by any of the requirements' AttributeValues.",
"type": "object",
"patternProperties": {
".": {
"description": "The \"Long Name\" of the AttributeDefinition.",
"type": "object",
"oneOf": [
{
"properties": {
"type": {
"type": "string",
"enum": [
"Boolean",
"Date",
"Float",
"Integer",
"String"
]
}
},
"additionalProperties": false
},
{
"properties": {
"type": {
"type": "string",
"const": "Enum"
},
"multi_values": {
"description": "Whether the Enum Attribute can have multiple values (true) or must always have exactly one value (false).",
"type": "boolean"
}
},
"additionalProperties": false
}
]
}
}
},
"multi_values": {
"description": "Whether the Enum Attribute can have multiple values (true) or must always have exactly one value (false).",
"type": "boolean"
}
},
"additionalProperties": false
}
}
]
}
},
"items": {
"description": "The Requirements or RequirementsFolders in this module, ordered in a hierarchical manner. Some tools might use different terminology for the same concept, like \"work item\".",
"type": "array",
"items": {
"$ref": "#/properties/modules/$defs/requirement"
}
}
}
},
"items": {
"description": "The Requirements or RequirementsFolders in this module, ordered in a hierarchical manner. Some tools might use different terminology for the same concept, like \"work item\".",
"type": "array",
"items": {
"$ref": "#/$defs/requirement"
}
}
}
},
"requirement": {
"description": "A Requirement or RequirementsFolder in the external Requirements Management tool. Some tools might use different terminology for the same concept, like \"work item\".",
"type": "object",
"required": [
"id",
"long_name"
],
"properties": {
"id": {
"description": "Unique identifier of this Requirement in the external RM tool",
"type": "string"
},
"long_name": {
"description": "Value of the \"Long Name\" field in Capella. Usually a short summary of the Requirement's \"text\".",
"type": "string"
},
"text": {
"description": "Complete description text of the requirement as HTML.",
"type": "string"
},
"attributes": {
"description": "Values for the attributes defined at module level. Not all attributes defined in the Module's `attributes` need to be present on any Requirement. However, it is not allowed for a Requirement to have attributes which do not also appear in the Module's `attributes`.\n\nFurthermore, the value of each Requirement attribute must match what is defined on the Module level:\n\n- For Boolean, Float, Integer and String, use the respective YAML types\n- For Date, use the date/time YAML type, including the timezone if possible\n- For Enum, use either a string that is equal to one of the Enum's members, or a list of such strings for multi-valued enums",
"requirement": {
"description": "A Requirement or RequirementsFolder in the external Requirements Management tool. Some tools might use different terminology for the same concept, like \"work item\".",
"type": "object",
"patternProperties": {
".": {
"description": "The value for this Requirement attribute (see the description of the `attributes` object for which types are valid)."
"required": [
"id",
"long_name"
],
"properties": {
"id": {
"description": "Unique identifier of this Requirement in the external RM tool",
"type": "string"
},
"long_name": {
"description": "Value of the \"Long Name\" field in Capella. Usually a short summary of the Requirement's \"text\".",
"type": "string"
},
"type": {
"description": "The assigned RequirementType. This value needs to be defined in the \"requirement_types\" object.",
"type": "string"
},
"text": {
"description": "Complete description text of the requirement as HTML.",
"type": "string"
},
"attributes": {
"description": "Values for the attributes defined at module level. Not all attributes defined in the Module's `attributes` need to be present on any Requirement. However, it is not allowed for a Requirement to have attributes which do not also appear in the Module's `attributes`.\n\nFurthermore, the value of each Requirement attribute must match what is defined on the Module level:\n\n- For Boolean, Float, Integer and String, use the respective YAML types\n- For Date, use the date/time YAML type, including the timezone if possible\n- For Enum, use either a string that is equal to one of the Enum's members, or a list of such strings for multi-valued enums",
"type": "object",
"patternProperties": {
".": {
"description": "The value for this Requirement attribute (see the description of the `attributes` object for which types are valid)."
}
}
},
"children": {
"description": "Requirements or RequirementsFolders underneath a RequirementsFolder (see description of the `items` object). If the `children` property exists, the object is recognized as a folder, as in Capella, Requirements can only be created under RequirementsModules or RequirementsFolders.",
"type": "array",
"items": {
"$ref": "#/properties/modules/$defs/requirement"
}
}
}
},
"children": {
"description": "Requirements or RequirementsFolders underneath a RequirementsFolder (see description of the `items` object). If the `children` property exists, the object is recognized as a folder, as in Capella, Requirements can only be created under RequirementsModules or RequirementsFolders.",
"type": "array",
"items": {
"$ref": "#/$defs/requirement"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
}
}
},
"required": [
"metadata",
"modules"
]
}
11 changes: 9 additions & 2 deletions docs/source/snapshot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ Snapshot
********

The snapshot is the input needed for calculating the
:ref:`ChangeSet<change-set>` and is a list of modules. Each module will be
compared against a matching
:ref:`ChangeSet<change-set>`. It consists of a metadata section and a list of
modules. The metadata documents the versions of the used RM tool and its
connector, the revision of the RM content and the Each module will be compared
against a matching
:external:class:`~capellambse.extensions.reqif.CapellaModule` from the given
model. If no matching ``CapellaModule`` was found this module will be skipped.
Differences of the module snapshot and the model ``CapellaModule`` will result
Expand All @@ -24,6 +26,11 @@ As previously noted: A module (or tracker) in the given snapshot equals a

.. code-block:: yaml
metadata:
tool: RM Tool Version
revision: r1234
connector: RM-Bridge-Polarion vX.Y.Z
modules:
- id: MODULE-000 # mandatory
long_name: Example # optional
Expand Down
Loading

0 comments on commit 35a1d95

Please sign in to comment.