Problem
Given certain attributes in the USDM spec that should be defined as concrete types of an abstract class, only the abstract class is used in the resulting dataStructure.yml instead of the appropriate concrete types. The spec generated at https://github.com/cdisc-org/usdm_api appears correct, but this information is lost when translating to dataStructure.yml.
For example:
Within ScheduleTimeline is an instances attribute. This is correctly defined in the OpenAPI spec as such:
instances:
items:
anyOf:
- $ref: '#/components/schemas/ScheduledActivityInstance-Input'
- $ref: '#/components/schemas/ScheduledDecisionInstance-Input'
type: array
title: Instances
default: []
However, when merged into the resulting dataStructure.yml, we get this:
instances:
Type:
- $ref: '#/ScheduledInstance'
Definition: A USDM relationship between the ScheduleTimeline and ScheduledInstance
classes which identifies the set of scheduled instances (e.g., scheduled activity
instances or scheduled decision instances) associated with the scheduled timeline.
Cardinality: 0..*
Relationship Type: Value
Model Name: instances
Model Representation: Relationship
The corrected form for dataStructure.yaml should be:
instances:
Type:
anyOf:
- $ref: '#/ScheduledActivityInstance'
- $ref: '#/ScheduledDecisionInstance'
Definition: A USDM relationship between the ScheduleTimeline and ScheduledInstance
classes which identifies the set of scheduled instances (e.g., scheduled activity
instances or scheduled decision instances) associated with the scheduled timeline.
Cardinality: 0..*
Relationship Type: Value
Model Name: instances
Model Representation: Relationship
Solution
I'm not quite familiar with the merge code, but perhaps the ref field needs to be a more complex type to use the full OpenAPI concrete types instead of the abstract class here: https://github.com/cdisc-org/DDF-RA-Tools/blob/main/ddf_ra_tools/reports/data_structure.py#L15
Context here is that were are using the dataStructure.yml definition to do code generation for the spec that we would like to contribute back to the community. Without these types being correctly represented it makes for clunky usage of the spec.
Thank you for the help!
Problem
Given certain attributes in the USDM spec that should be defined as concrete types of an abstract class, only the abstract class is used in the resulting
dataStructure.ymlinstead of the appropriate concrete types. The spec generated at https://github.com/cdisc-org/usdm_api appears correct, but this information is lost when translating todataStructure.yml.For example:
Within
ScheduleTimelineis aninstancesattribute. This is correctly defined in the OpenAPI spec as such:However, when merged into the resulting
dataStructure.yml, we get this:The corrected form for
dataStructure.yamlshould be:Solution
I'm not quite familiar with the merge code, but perhaps the
reffield needs to be a more complex type to use the full OpenAPI concrete types instead of the abstract class here: https://github.com/cdisc-org/DDF-RA-Tools/blob/main/ddf_ra_tools/reports/data_structure.py#L15Context here is that were are using the
dataStructure.ymldefinition to do code generation for the spec that we would like to contribute back to the community. Without these types being correctly represented it makes for clunky usage of the spec.Thank you for the help!