Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types with same name are mixed up #39

Closed
jobafr opened this issue Oct 9, 2023 · 2 comments · Fixed by #40
Closed

Types with same name are mixed up #39

jobafr opened this issue Oct 9, 2023 · 2 comments · Fixed by #40
Labels
bug Something isn't working

Comments

@jobafr
Copy link

jobafr commented Oct 9, 2023

Description
When parsing multiple types with the same name, such as visualization_msgs/Marker and aruco_msgs/Marker, the library mixes them up when they are used as children of another type.

  • Version: 4.2.2 (I tested with several versions from 1.0.1 to 4.2.2 and the bug seems to be present in all of them)
  • Platform: Linux, ROS noetic (but this probably hits ROS2 too)

Steps To Reproduce

  let res = parse(`

MSG: visualization_msgs/Marker
int32 a

===
MSG: aruco_msgs/Marker
int32 b

===
MSG: visualization_msgs/MarkerArray
Marker[] a

===
MSG: aruco_msgs/MarkerArray
Marker[] b
  
  `, { ros2: false })

  console.log(JSON.stringify(res, undefined, 2));

Expected Behavior
aruco_msgs/MarkerArray should contain an array of aruco_msgs/Marker, not visualization_msgs/Marker.

[
  {
    "name": "visualization_msgs/Marker",
    "definitions": [
      {
        "type": "int32",
        "isArray": false,
        "name": "a",
        "isComplex": false
      }
    ]
  },
  {
    "name": "aruco_msgs/Marker",
    "definitions": [
      {
        "type": "int32",
        "isArray": false,
        "name": "b",
        "isComplex": false
      }
    ]
  },
  {
    "name": "visualization_msgs/MarkerArray",
    "definitions": [
      {
        "type": "visualization_msgs/Marker",
        "isArray": true,
        "name": "a",
        "isComplex": true
      }
    ]
  },
  {
    "name": "aruco_msgs/MarkerArray",
    "definitions": [
      {
        "type": "aruco_msgs/Marker",
        "isArray": true,
        "name": "b",
        "isComplex": true
      }
    ]
  }
]

Actual behavior
Both MarkerArray types contain an array of visualization_msgs/Marker.

[
  {
    "name": "visualization_msgs/Marker",
    "definitions": [
      {
        "type": "int32",
        "isArray": false,
        "name": "a",
        "isComplex": false
      }
    ]
  },
  {
    "name": "aruco_msgs/Marker",
    "definitions": [
      {
        "type": "int32",
        "isArray": false,
        "name": "b",
        "isComplex": false
      }
    ]
  },
  {
    "name": "visualization_msgs/MarkerArray",
    "definitions": [
      {
        "type": "visualization_msgs/Marker",
        "isArray": true,
        "name": "a",
        "isComplex": true
      }
    ]
  },
  {
    "name": "aruco_msgs/MarkerArray",
    "definitions": [
      {
        "type": "visualization_msgs/Marker",
        "isArray": true,
        "name": "b",
        "isComplex": true
      }
    ]
  }
]
@jobafr jobafr added the bug Something isn't working label Oct 9, 2023
jobafr added a commit to jobafr/ros-typescript-generator that referenced this issue Oct 9, 2023
@jtbandes
Copy link
Member

Thanks for the report. Would you be interested in submitting a PR to fix this?

@defunctzombie defunctzombie added bug Something isn't working and removed bug Something isn't working labels Oct 24, 2023
@defunctzombie
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants