You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes one just wants to ask questions about the YAML that's being processed rather than needing to deserialize it into an entire object graph. This is especially common when parts of the structure of the input are user-specified, as in the case of things like Kubernetes cluster definitions.
My ideal API would allow me to use jq-style lookups to enumerate over the YAML and retrieve the pieces of interest. For example, that might look like:
var reader = new FileReader("my-file.yaml");
var listOfAllPodNames = Yaml.Deserialize(reader)
.Query(".pods[].name")
.As(List<string>);
or
var mapOfPodAttributes = Yaml.Deserialize(reader)
.Query(".pods[1].metadata")
.As(Dictionary<string, string>);
or
var listOfPodMetadata = Yaml.Deserialize(reader)
.Query(".pods[].metadata")
.As(Dictionary<string, string>[]);
I would also find this feature useful - see referenced issue - it would be very helpful for my use case to also be able to get the character index in the original string of the start of the found element.
Sometimes one just wants to ask questions about the YAML that's being processed rather than needing to deserialize it into an entire object graph. This is especially common when parts of the structure of the input are user-specified, as in the case of things like Kubernetes cluster definitions.
My ideal API would allow me to use
jq
-style lookups to enumerate over the YAML and retrieve the pieces of interest. For example, that might look like:or
or
Given the following YAML:
then we would expect to see the following results:
The text was updated successfully, but these errors were encountered: