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

Adding ScalarStyle.NoneQuoted for none surrounded quotes #676

Closed
maythamfahmi opened this issue Feb 11, 2022 · 2 comments
Closed

Adding ScalarStyle.NoneQuoted for none surrounded quotes #676

maythamfahmi opened this issue Feb 11, 2022 · 2 comments

Comments

@maythamfahmi
Copy link

I am using YamlDotNet in an another open source project.

When I generate a list of object/strings it will be parsed surrounded with singe quote by default like:

'[ubuntu-latest, windows-2022, macos-latest]'

This give compilation error:
image

The correct way should be like without quotes

[ubuntu-latest, windows-2022, macos-latest]
image

I just feel that writing a customized method to remove this is not nice when we have ScalarStyle

I was expecting that I have an option like ScalarStyle = ScalarStyle.NoneQuoted or ScalarStyle.None

@maythamfahmi maythamfahmi changed the title [YamlMember(ScalarStyle = ScalarStyle.NoneQuoted)] Suggest adding ScalarStyle.NoneQuoted for none surrounded quotes Feb 11, 2022
@maythamfahmi maythamfahmi changed the title Suggest adding ScalarStyle.NoneQuoted for none surrounded quotes Adding ScalarStyle.NoneQuoted for none surrounded quotes Feb 11, 2022
@aaubry
Copy link
Owner

aaubry commented Feb 11, 2022

That's the syntax for a list. You should not be using a scalar (string) but a list.

@maythamfahmi
Copy link
Author

maythamfahmi commented Feb 11, 2022

@aaubry you are right I was not aware that and thank you for making me aware of it.

My problem to start with, I tried to make a list looks like a string like this just to follow the yaml format [ubuntu-latest, windows-2022, macos-latest] from the example I am working on.

But I was not aware that

[ubuntu-latest, windows-2022, macos-latest]

are the same as

- ubuntu-latest
- windows-2022
- macos-latest

No need for this feature as I works now by using list.

image

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

No branches or pull requests

2 participants