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

Parse yaml wihtout any assumptions #513

Closed
awdm opened this issue Jul 16, 2020 · 2 comments
Closed

Parse yaml wihtout any assumptions #513

awdm opened this issue Jul 16, 2020 · 2 comments

Comments

@awdm
Copy link

awdm commented Jul 16, 2020

I'm using this software to automatically duplicate and modify yaml-files to setup Kubernetes resources. However, I noticed that these files are really inconsistent. Some examples:

  • Sometimes things just need to be quoted, no matter the actual data type, e.g. when you are declaring environment variables for a new container. But there is no way to recognize this through the syntax, only through the semantics.
  • In some tutorials, ports get their port number as a name. If people follow these tutorials they end up writing yaml which can't be parsed correctly

So what I'm looking for is a parser/serializer that makes absoluteley zero assumptions about the data type it is processing. If it reads a string containing a number, it gets parsed into a string. If it's told to write a string that contains a boolean, it writes a string (with qoutation marks).

@MariuszKogut
Copy link

MariuszKogut commented Oct 21, 2021

I have the same problem with a docker-compose.yml.

Input file:

version: '3.7'
...

Output after deserialize and serialize to same file

version: 3.7
...

Version is no longer a string and the schema validation during calling docker-compose fails.

@awdm Did you found a workaround for your problem?

@EdwardCooke
Copy link
Collaborator

This issue was just recently fixed and went out with the v12 version about 5 days ago. When a string is passed in to the serializer, it will handle it and quote as needed (numbers/bools/etc).

I'm closing the issue for now. If you still see problems with it let me know and I'll get them resolved.

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

No branches or pull requests

3 participants