Commit 82f5f9a
committed
fix(generator): emit .msg syntax in _fields_and_field_types for bounded types
_fields_and_field_types / get_fields_and_field_types() is documented as a
Python introspection API for message field types. However it was emitting
OMG IDL 4.2 syntax for bounded strings and sequences:
sequence<string<256>, 32> (IDL)
instead of the canonical ROS 2 .msg syntax:
string<=256[<=32] (.msg)
This breaks any consumer that passes the output directly to the MCAP
ros2msg schema encoder (e.g. mcap_utils _build_ros2_schema()), because
the ros2msg schema encoding requires .msg syntax per the MCAP registry
spec (https://mcap.dev/spec/registry#ros2msg). Foxglove and other
ros2msg-aware tools reject the IDL form.
Changes:
- Remove IDL-style sequence<> prefix/suffix generation in the
_fields_and_field_types dict template.
- Emit bounded string bound with <= (string<=N) instead of <N>.
- Emit bounded sequence bound as [<=N], unbounded sequence as [],
fixed-size array as [N] -- all matching .msg syntax.
- Update test_interfaces.py expected values accordingly.
The SLOT_TYPES tuple (rosidl_parser.definition objects) is unchanged
and remains the correct API for programmatic type inspection.1 parent e210dc3 commit 82f5f9a
2 files changed
Lines changed: 17 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 271 | + | |
276 | 272 | | |
277 | 273 | | |
278 | 274 | | |
| |||
282 | 278 | | |
283 | 279 | | |
284 | 280 | | |
285 | | - | |
| 281 | + | |
286 | 282 | | |
287 | 283 | | |
288 | 284 | | |
289 | 285 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
296 | 291 | | |
297 | 292 | | |
298 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
939 | 939 | | |
940 | 940 | | |
941 | 941 | | |
942 | | - | |
943 | | - | |
944 | | - | |
945 | | - | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
946 | 946 | | |
947 | | - | |
948 | | - | |
| 947 | + | |
| 948 | + | |
949 | 949 | | |
950 | | - | |
951 | | - | |
952 | | - | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
953 | 953 | | |
954 | 954 | | |
955 | 955 | | |
| |||
1012 | 1012 | | |
1013 | 1013 | | |
1014 | 1014 | | |
1015 | | - | |
| 1015 | + | |
1016 | 1016 | | |
1017 | 1017 | | |
1018 | 1018 | | |
0 commit comments