-
Notifications
You must be signed in to change notification settings - Fork 22
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 convenient way to create YAML nodes in code #72
Conversation
17d6f47
to
6c58314
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, we should allow to use implicit conversions if the user imported special object from scala-yaml. We will add it in a separate PR.
Please, add at least one test for testing your implicit for nested yaml. For example
Sequence...
Mapping...
Mapping...
6c30cee
to
e2e85e7
Compare
yaml/shared/src/main/scala/org/virtuslab/yaml/YamlDecoder.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, cannot approve because I'm author of the PR 😅
yaml/shared/src/main/scala/org/virtuslab/yaml/syntax/YamlPrimitive.scala
Outdated
Show resolved
Hide resolved
yaml/shared/src/test/scala/org/virtuslab/yaml/internal/NodeCreationSuite.scala
Outdated
Show resolved
Hide resolved
b9a3057
to
586701b
Compare
Aims to close #68Will be closed in a follow-up PR.
Current state: one can write sth like this
I was thinking about implicit conversions that would allow more concise syntax:
As we know, implicit conversions could be very tricky so I would prefer t place them at
org.virtuslab.yaml.syntax
to limit accidental import. In addition to import this package, user will have to importimport scala.language.implicitConversions
or set proper compiler option. Otherwise, he will get compiler warnings about usage of implicit conversion.I find this proposal as a good balance between convenience and user awareness of what he is doing. What do you think?