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

[ROSIDL] Add toPlainObject() method for array messages #1047

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

minggangw
Copy link
Member

@minggangw minggangw commented Feb 27, 2025

This patch adds support for converting array messages to plain objects by introducing a helper function to detect typed arrays and updating relevant tests.

Fix: #1046

@minggangw minggangw requested a review from Copilot February 27, 2025 03:03

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds support for converting array messages to plain objects by introducing a helper function to detect typed arrays and updating relevant tests.

  • Added an isTypedArray helper in utils.js.
  • Updated tests to import the centralized isTypedArray helper.
  • Modified test-message-properties-validation.js to call toPlainObject with the enableTypedArray flag.

Reviewed Changes

File Description
test/utils.js Added isTypedArray utility function and exported it.
test/test-message-properties-validation.js Updated the toPlainObject call to pass enableTypedArray flag.
test/test-message-translator-primitive.js Replaced local isTypedArray definition with import from utils.js.
test/test-array-data.js Replaced local isTypedArray definition with import from utils.js.
test/test-message-translator-complex.js Removed local isTypedArray definition in favor of the shared one.

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

test/test-message-properties-validation.js:181

  • The updated usage of toPlainObject with the enableTypedArray flag consolidates the conversion logic for both plain objects and array messages, but it removes the per-element conversion previously applied to ROS arrays. Please verify that the new behavior produces the correct plain object representation for array messages.
left[i].toPlainObject(/*enableTypedArray=*/ true)
@minggangw minggangw merged commit fad205e into RobotWebTools:develop Feb 27, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add toPlainObject() method to array messages
1 participant