Skip to content

Commit

Permalink
fix: Add kind to props
Browse files Browse the repository at this point in the history
  • Loading branch information
huyenngn committed Mar 12, 2024
1 parent ba2f429 commit ce502a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions capella_ros_tools/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def _convert_class(
prop_yml = {
"name": field_def.name,
"type": decl.Promise(promise_ref),
"kind": "COMPOSITION",
"description": field_def.description,
"min_card": decl.NewObject(
"LiteralNumericValue", value=field_def.type.card.min
Expand Down
8 changes: 8 additions & 0 deletions tests/data/data_model/example_msgs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- name: sample_field1
description: "This block comment is added to the property description of sample_field1. This block comment is also added to the property description of sample_field1. "
type: !promise package1.uint8
kind: COMPOSITION
min_card: !new_object
_type: LiteralNumericValue
value: "1"
Expand All @@ -33,6 +34,7 @@
- name: sample_field2
description: "This block comment is added to the property descriptions of sample_field2 and sample_field3. "
type: !promise package1.uint8
kind: COMPOSITION
min_card: !new_object
_type: LiteralNumericValue
value: "1"
Expand All @@ -42,6 +44,7 @@
- name: sample_field3
description: "This block comment is added to the property descriptions of sample_field2 and sample_field3. "
type: !promise package1.uint8
kind: COMPOSITION
min_card: !new_object
_type: LiteralNumericValue
value: "0"
Expand All @@ -51,6 +54,7 @@
- name: sample_field4
description: "This block comment is added to the property descriptions of sample_field4 and sample_field5. Fields in SampleClass can reference enums in other files. The property sample_field4 is of type SampleEnum. cf. SampleEnum "
type: !promise types.SampleEnum
kind: COMPOSITION
min_card: !new_object
_type: LiteralNumericValue
value: "1"
Expand All @@ -60,6 +64,7 @@
- name: sample_field5
description: "This block comment is added to the property descriptions of sample_field4 and sample_field5. This inline comment is added to the property description of sample_field5. The property sample_field5 is of type SampleEnumValue. cf. SampleEnum, SAMPLE_ENUM_VALUE_XXX "
type: !promise types.SampleEnumValue
kind: COMPOSITION
min_card: !new_object
_type: LiteralNumericValue
value: "1"
Expand Down Expand Up @@ -133,6 +138,7 @@
- name: status
description: "The property status is of type SampleClassEnumStatus. "
type: !promise types.SampleClassEnumStatus
kind: COMPOSITION
min_card: !new_object
_type: LiteralNumericValue
value: "1"
Expand All @@ -142,6 +148,7 @@
- name: color
description: "The property color is of type Color. "
type: !promise types.Color
kind: COMPOSITION
min_card: !new_object
_type: LiteralNumericValue
value: "1"
Expand All @@ -151,6 +158,7 @@
- name: field
description: ""
type: !promise package2.uint8
kind: COMPOSITION
min_card: !new_object
_type: LiteralNumericValue
value: "1"
Expand Down
3 changes: 3 additions & 0 deletions tests/test_import_msgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def class_expected():
{
"name": "field",
"type": decl.Promise("my_package.uint8"),
"kind": "COMPOSITION",
"description": "Field",
"min_card": decl.NewObject(
"LiteralNumericValue", value="1"
Expand Down Expand Up @@ -178,6 +179,7 @@ def test_convert_class_with_range(importer):
{
"name": "field",
"type": decl.Promise("my_package.uint8"),
"kind": "COMPOSITION",
"description": "Field",
"min_card": decl.NewObject(
"LiteralNumericValue", value="1"
Expand Down Expand Up @@ -229,6 +231,7 @@ def test_convert_class_with_ref(importer):
{
"name": "field",
"type": decl.Promise("std_msgs.uint8"),
"kind": "COMPOSITION",
"description": "Field",
"min_card": decl.NewObject(
"LiteralNumericValue", value="1"
Expand Down

0 comments on commit ce502a4

Please sign in to comment.