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

It is not possible to distinguish primitive types #50

Open
anti-social opened this issue Oct 21, 2022 · 4 comments
Open

It is not possible to distinguish primitive types #50

anti-social opened this issue Oct 21, 2022 · 4 comments

Comments

@anti-social
Copy link
Contributor

anti-social commented Oct 21, 2022

I parse yaml to YamlElement and I need a way to differ numbers from strings:

a: 1
b: "1"

In kotlinx.serialization there is an isString property which can be taken into account.

Either there could be special wrappers to all supported data types.

@Him188
Copy link
Owner

Him188 commented May 1, 2023

In JSON, unquoted values have their semantics, false means exactly the boolean value false, but in YAML, I think there is no such specification (viz. there are just strings)? You can still have a: foo unquoted.

@Him188 Him188 added the question Further information is requested label May 1, 2023
@anti-social
Copy link
Contributor Author

So it would be nice to have a flag how a scalar node was represented

@anti-social
Copy link
Contributor Author

anti-social commented May 2, 2023

I's really interesting problem.

What do you think about a recommendation to use a core scheme by default?

https://yaml.org/spec/1.2.2/#103-core-schema

The Core schema is an extension of the JSON schema, allowing for more human-readable presentation of the same types. This is the recommended default schema that YAML processor should use unless instructed otherwise.

All the parsers that I've used in other languages use the core schema, I think.

@Him188
Copy link
Owner

Him188 commented May 2, 2023

You are right. I agree we should use the Core schema.

@Him188 Him188 removed the question Further information is requested label May 2, 2023
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