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

Support flow style YAML printing. #613

Merged
merged 1 commit into from
Aug 10, 2021
Merged

Support flow style YAML printing. #613

merged 1 commit into from
Aug 10, 2021

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Aug 9, 2021

Closes #608. This patch:

  • Drops the to_yaml() overload in the message namespace taking an std::ostream reference and replaces it with to_block_style_yaml() and to_flow_style_yaml() functions.
  • Adds an optional boolean argument to the to_yaml() overload in the message namespace returning an std::string to switch to flow style (precluding the need for a new type to convey the chosen style, relying on the fact that only two YAML styles exist).

We can discuss the API choices, I don't mind strongly about these.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic hidmic added the enhancement New feature or request label Aug 9, 2021
@hidmic
Copy link
Contributor Author

hidmic commented Aug 9, 2021

CI up to rosidl_generator_cpp (to start with):

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

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

LGTM. I think limiting style to a boolean is a good idea. Users wanting any styling beyond this can be encouraged to use a yaml emitting library rather than taking on that responsibility here.

@hidmic
Copy link
Contributor Author

hidmic commented Aug 9, 2021

Full CI (to be safe):

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status (unrelated test failures)

@hidmic
Copy link
Contributor Author

hidmic commented Aug 10, 2021

Alright, going in !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support flow style formatting in to_yaml()
2 participants