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

Add options to choose prefered scalar style #291

Closed
wants to merge 2 commits into from

Conversation

ychaze
Copy link

@ychaze ychaze commented Jun 7, 2016

Description

Add the ability pass the scalar style (DOUBLE or SINGLE) as option for the dumper.

Tests

[X] Run all the current test suite by passing the option to the dumper

@ychaze
Copy link
Author

ychaze commented Jun 7, 2016

This should fix the following issue: #290

@AlaricCalmette
Copy link

My commit prevent surrounding keys with double or single quote when we specify the scalar type via the parameters of the dumper.

@dervus dervus self-assigned this Jun 16, 2016
@dervus
Copy link
Collaborator

dervus commented Aug 7, 2016

  1. Option name. First of all there's no such term as "scalar type" in YAML. The name is misleading. I think it should be named valueFlowScalars because it's about values, not keys and it's scope is flow scalars only. This name will allow us to conveniently add keyFlowScalars and blockScalars options in future.
  2. The option must accept plain (default), single, double strings as possible values. STYLE_* constants are internal for the dumper. They are not exposed by public API currently, not exposed by this PR, and shouldn't be exposed at all.
  3. if (string.length === 0) clause was placed after style resolver for absolutely no reason. It should remain were it was. Also I think it's body should be expressed via ? syntax, not switch.
  4. Supplied test doesn't test added feature at all. It tests dumper correctness for the second time while it should ensure that selected scalar styles applied correctly.
  5. No documentation entry for new option in README.

Sorry it took me so long to get here. I suppose after so long you may not be interested in rewriting all this, but I have to point out anyway.

@puzrin
Copy link
Member

puzrin commented Sep 17, 2016

Close - no activity/feedback. Let me know if this PR should be reopened or create a new one with updates after @dervus comments.

@puzrin puzrin closed this Sep 17, 2016
@cula
Copy link

cula commented Feb 26, 2018

Is any step forward here? I want to force add single quote to my string value in yaml. But I cannot find a way neither in Doc nor in Code. I read chooseScalarStyle and found no way to make it STYLE_SINGLE. Is there any solution to it?

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.

None yet

5 participants