-
Notifications
You must be signed in to change notification settings - Fork 10
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
Please supported mixed mode values #73
Comments
I'm not sure I'm following what this issue is asking for yet... Are you saying that yam is mishandling YAML tags then they're specified? Are you saying that yam should define its own default behavior for when no tag is present in the input? An example input and expected output would go a long way here! Thanks! |
When doing yam on glibc.yaml I would like it to convert package:
name: glibc
version: 2.40
epoch: 3
description: "the GNU C library"
copyright:
- license: LGPL-2.1-or-later
resources:
cpu: 16
memory: 16Gi to package:
name: glibc
version: "2.40"
epoch: 3
description: "the GNU C library"
copyright:
- license: LGPL-2.1-or-later
resources:
cpu: 16
memory: 16Gi As version is a string, epoch is an integer, and cpu is an integer, and memory is unambiguous string. |
Sorry for the delay! 😳 Thanks for this example, it's super helpful, and I think I'm understanding what you're looking for now. For context, yam is operating on YAML bytes. It doesn't have knowledge of application-specific types. This is by design: it's a general purpose YAML formatter. Given that, I could see implementing this feature in one of two ways:
I'd also be curious to know what problems you're seeing in some specific use cases with today's behavior, to help with the discussion about how best to solve it. |
Yes adding something to .yam.yaml would be great. Something like "quote:" key to always quote a given subkey. |
If one specifies that something should be a string, please encode it in the most natural and deterministic way.
Example for something desired to be formatted as a list of strings please ensure that all form of canonical integer and floating point numbers are encoded as strings.
https://yaml.org/spec/1.2.2/#24-tags
Lists
As valid representations of numbers, which upon parsing will not be strings. And thus need to be quoted to be strings.
For the purpose of melange, we can encounter something like "1.23015e+3" as a string value represetting package version or text git tag. But most commonly it is software with single major or single minor version only that can get miss-parsed.
The text was updated successfully, but these errors were encountered: