-
Notifications
You must be signed in to change notification settings - Fork 288
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
Empty yaml documents should be ignored when importing lists #3464
Comments
This seems reasonable. Do you want to send a patch with a test? |
I would like to take a look at this issue |
The YAML decoder decodes an empty YAML as null, making it indistinguishable from an actual null. Would it be reasonable to ignore null when importing lists? |
@haoqixu yes, I think that's fine. The YAML spec strongly hints that an empty document is equivalent to a null value. |
What is the expected behavior when a document is not empty? Is it possible to handle missing keys gracefully for the general case? Say: ❯ cue import -l "strings.ToLower(metadata.namespace)" --list abc.yaml ---
metadata:
namespace: some-namespace
---
metadata:
name: some-name # missing namespace
---
metadata:
namespace: some-namespace |
If multiple behaviors are wanted depending on the use case, we could always rethink the flag slightly so that |
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
Yes.
What did you do?
Import a list of yaml documents and transform it with
-l
.abc.yaml
What did you expect to see?
It would be nice if this just didn't add anything to the list instead of failing. I use
cue import
a lot to import Helm charts and often, because Helm is just a bad text templating engine, it will include empty yaml documents. I therefore have to find the empty documents myself and run the import again.What did you see instead?
error evaluating label strings.ToLower(kind): reference "kind" not found
The text was updated successfully, but these errors were encountered: