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 JSON/YAML serialization to URI #10404

Merged
merged 5 commits into from
Sep 29, 2021

Conversation

straight-shoota
Copy link
Member

URI can be trivially serialized to a string in both JSON and YAML, so this adds the necessary conversion methods.

Note that this does not make require "json"/require "yaml" mandatory when using require "uri". The methods just won't work unless JSON/YAML are also required.

@asterite
Copy link
Member

I think these should live in "uri/json" and "uri/yaml" respectively.

It doesn't break now, but nothing prevents us in the future from type-checking the arguments even before you call the methods (a bit more reliable) and then it will break.

@straight-shoota
Copy link
Member Author

Can we delay this until it becomes necessary if ever?

I know we do the same thing for other types, but it just feels like an unneccesary burdon on usability if you have to require these simple converter methods explicitly.

Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

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

Thank you @straight-shoota 🙏

Copy link
Contributor

@caspiano caspiano left a comment

Choose a reason for hiding this comment

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

Would love this in 1.0.0 🥰

@beta-ziliani
Copy link
Member

I am with Ary. I think we must keep it consistent with the rest of the lib. We can discuss later a refactor here and there.

@straight-shoota straight-shoota added this to the 1.2.0 milestone Sep 27, 2021
@straight-shoota straight-shoota merged commit b37c5b9 into crystal-lang:master Sep 29, 2021
@straight-shoota straight-shoota deleted the feature/uri-json branch September 29, 2021 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants