req and req_spec as DataRefs - DevOps-MBSE/AaC GitHub Wiki
To keep track of definitions for the purpose of the dataref primitive type, AaC uses a dictionary called fully_qualified_name_to_definition . This dictionary uses the definition name + package name as the key, and has the python compliant name as the data. Normally, definitions with the same name could co-exist in this dictionary, because it combines the definition name with the package name. With req and req_spec types, however, there is no package name. When two of either of these definition types share a name, one will be overwritten by the other, causing an error if a user attempts to reference it in a dataref .
The solution we've used with req definitions is to combine the name and ID, but req_spec has no ID. So for right now, req_spec definitions are at risk of being overwritten in the fully_qualified_name_to_definition dictionary.
# Requirement Specifiction Types
schema:
name: RequirementSpecification
package: aac.lang
root: req_spec
description: |
A requirement specification definition to capture desired behavior or attributes of the system being modeled.
Within many contexts requirements remain the central element of any Model-Based System Engineering solution.
AaC supports the definition, derivation, and trace of requirements throughout the model using the spec type and
associated reference capabilities.
fields:
- name: name
type: string
description: |
The name of the requirement specification.
is_required: true
- name: description
type: string
description: |
A brief description of the requirement specification.
- name: sections
type: dataref(req_spec.name)[]
description: |
A list of requirement sections that make up the specification.
- name: parent_specs
type: dataref(req_spec.name)[]
description: |
A list of requirement specifications that this specification inherits from.
- name: child_specs
type: dataref(req_spec.name)[]
description: |
A list of requirement specifications that inherit from this specification.
- name: requirements
type: dataref(req.id)[]
description: |
A list of requirements that make up the specification.
Above is the definition to req_spec from within the aac.aac core definition file. To solve this issue, we would need to add some identifying field to req_spec definitions such as a package or ID field.
Something like this would need to be added to the above definition.
fields:
- name: package
type: string
description: |
The Python package to be made available to the template.