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

Yams.dump dumps numerical String values as Number #197

Closed
jaynetics opened this issue Jul 5, 2019 · 1 comment · Fixed by #198
Closed

Yams.dump dumps numerical String values as Number #197

jaynetics opened this issue Jul 5, 2019 · 1 comment · Fixed by #198

Comments

@jaynetics
Copy link

this seems to be similar to #174 though i'm not sure it's the same issue.

let dict = ["1.0": "2."]
print(try! Yams.dump(object: dict))

expected output: '1.0': '2.'
actual output: 1.0: 2.

maybe this is an accepted limitation?

if so, i'd love to know if there is a sane way to correctly dump dicts of an unknown structure. i can only think of deep-mapping them to Nodes and setting styles based on the Strings' contents...

@norio-nomura
Copy link
Collaborator

norio-nomura commented Jul 6, 2019

If Resolver.default determines that the content of String is other than .str, it would be better to apply Style.singleQuoted to Node.Scalar on representing from that String.

norio-nomura added a commit that referenced this issue Jul 6, 2019
Apply `.singleQuoted` on representing `Node.Scalar` from `String` if `Resolver.default` resolves that to other than `.str`.
Fixes #197
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants