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

validate: check both message encoding and schema encoding #1186

Merged
merged 2 commits into from
Jun 24, 2024

Conversation

jtbandes
Copy link
Member

The validate example was incorrect for ros2msg/cdr channels, and it was also only checking the message encoding and not the schema encoding.

@@ -139,7 +139,7 @@ async function validate(
throw new Error(`Missing schema ${record.schemaId} for channel ${record.id}`);
}
let messageDeserializer: (data: ArrayBufferView) => unknown;
if (record.messageEncoding === "ros1") {
if (record.messageEncoding === "ros1" && schema.encoding === "ros1msg") {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitty nit: feels a bit more natural to me to check schema first, then the message encoding, going from less specific to more specific.

Copy link
Member Author

Choose a reason for hiding this comment

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

Screen.Recording.2024-06-24.at.12.27.47.PM.mov

@jtbandes jtbandes merged commit 680fd0d into main Jun 24, 2024
24 checks passed
@jtbandes jtbandes deleted the jacob/validate-fix branch June 24, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants