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

Plans for the language independent types in YAML #3101

Closed
mosop opened this issue Aug 6, 2016 · 8 comments · Fixed by #5007
Closed

Plans for the language independent types in YAML #3101

mosop opened this issue Aug 6, 2016 · 8 comments · Fixed by #5007

Comments

@mosop
Copy link
Contributor

mosop commented Aug 6, 2016

Hi. Do you have any plans to implement the full YAML 1.2 specification in the standard library?

@jhass
Copy link
Member

jhass commented Aug 6, 2016

We currently bind libyaml, what features does that miss in particular?

@mosop
Copy link
Contributor Author

mosop commented Aug 6, 2016

Oh, I've never known that the YAML specification doesn't expect its applications to implement the language-independent types, shown in http://yaml.org/type/. I simply want to map those !!binary, !!bool, !!float, !!int and !!timestamp to/from the corresponding types in Crystal. Because I can easily migrate my old YAML resources into my Crystal application. However, I don't think the standard library has to support those types. Because those are optional. How is the Crystal team is thinking about supporting the types?

@mosop mosop changed the title Plans for the Full YAML 1.2 specification Plans for the language independent types in YAML Aug 6, 2016
@mosop
Copy link
Contributor Author

mosop commented Aug 6, 2016

I overlooked the similar issue #2235.

@mosop
Copy link
Contributor Author

mosop commented Aug 6, 2016

Oh! Already referenced in #2235. Thanks.

@asterite
Copy link
Member

asterite commented Aug 6, 2016

I think out YAML API is missing the concept of a schema. The default should be the default (bools, numbers, times) but one should be able to choose another one. It's just that the fail-safe schema was easier to implement at first, because everything is a string, and then you can parse the string in the way that you need it.

@mosop
Copy link
Contributor Author

mosop commented Aug 7, 2016

Thank you for letting me hear your thoughts! I think the capability to switch between sets of schemas is a great concept. So far, you think that those typed values should be supported as default:

  • booleans
  • numbers (integers and floats)
  • timestamps

OK?

@ysbaddaden
Copy link
Contributor

As explained in #4771 this boils down to support the YAML Core Schema instead of the Failsafe Schema as supported by libyaml.

@straight-shoota
Copy link
Member

No, this is a different issue and only related to supporting Core Schema. If we can access the datatypes from JSON Schema it will bring us closer to supporting Core Schema. But there are some more language-independent types which are not required for Core Schema, so it must be considered which of these additional ones should be available in Crystal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants