-
Notifications
You must be signed in to change notification settings - Fork 69
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
TMX Messages currently serialize all attributes as strings #561
Comments
9 tasks
willjohnsonk
added a commit
that referenced
this issue
Sep 8, 2023
<!-- Thanks for the contribution, this is awesome. --> # PR Details ## Description <!--- Describe your changes in detail --> Temporary fix for TMX Message invalid JSON serialization (See Issue #561). Fix uses regex to filter out quotations from json string for attributes that are bool, numeric or null. ## Related Issue <!--- This project only accepts pull requests related to open issues --> <!--- If suggesting a new feature or change, please discuss it in an issue first --> <!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> <!--- Please link to the issue here: --> ## Motivation and Context Maintain simulation time synchronization functionality of V2X-Hub/CARMA-Streets <!--- Why is this change required? What problem does it solve? --> ## How Has This Been Tested? Tested in local dev container environment. <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Defect fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] I have added any new packages to the sonar-scanner.properties file - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the **CONTRIBUTING** document. [V2XHUB Contributing Guide](https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/Contributing.md) - [ ] I have added tests to cover my changes. - [x] All new and existing tests passed.
9 tasks
dan-du-car
pushed a commit
that referenced
this issue
Dec 20, 2023
<!-- Thanks for the contribution, this is awesome. --> # PR Details ## Description Temporary fix for JSON serialization for TMX messages. See related issue for more detailed description of error behavior. Using simple regex replacement to correct bool, double and integer values <!--- Describe your changes in detail --> ## Related Issue #561 (#561) <!--- This project only accepts pull requests related to open issues --> <!--- If suggesting a new feature or change, please discuss it in an issue first --> <!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> <!--- Please link to the issue here: --> ## Motivation and Context Fix for VRU UC 1 testing of SDSM functionality <!--- Why is this change required? What problem does it solve? --> ## How Has This Been Tested? Integration tested in CDASim deployment <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Defect fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] I have added any new packages to the sonar-scanner.properties file - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the **CONTRIBUTING** document. [V2XHUB Contributing Guide](https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/Contributing.md) - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
Due to dependency on boost::property_tree for attribute storage and json serialization
tmx_message
currently serializes all attributes to strings. It also does not support nested types currently. As far as I can tell the problem is some combination of the following two lines:V2X-Hub/src/tmx/TmxApi/tmx/attributes/container.hpp
Line 120 in 2079d64
V2X-Hub/src/tmx/TmxApi/tmx/attributes/serialization_types.hpp
Line 37 in 2079d64
Solution would most likely require replacing
typedef ptree_backend<std::string, std::string> standard_ptree_backend;
with a something like 'typedef ptree_backend<std::string, std::variant<std::string, int, double, bool, ptree_backend> standard_ptree_backend;' and then possibly also replacing write_json boost property tree json serialization which I believe has the know limitation of serializing everything as a string. (https://stackoverflow.com/questions/2855741/why-does-boost-property-tree-write-json-save-everything-as-string-is-it-possibl)Version
4.3.0 (Current)
Expected Behavior
TMX message attributes that are not string serialize to json without quotes. TMX Messages allow for definition of nested objects.
Actual Behavior
All TMX message attributes get serializes as strings for json serialization and tmx message does not support nest objects as attributes.
Steps to Reproduce the Actual Behavior
Related Work
No response
The text was updated successfully, but these errors were encountered: