compose-spec / compose-go

Reference library for parsing and loading Compose YAML files
https://compose-spec.io
Apache License 2.0
356 stars 112 forks source link

offer simple way to express (un)supported keys #27

Open ndeloof opened 4 years ago

ndeloof commented 4 years ago

We need to replace https://github.com/compose-spec/compose-go/issues/11 with a pluggable API for implementations to express keys they don't support.

v3 broke the v2 approach to define services options as a list of fields, that can be easily white|blacklisted as []string. We need a way to filter an actual yaml tree.

Proposal: introduce option for implementation to declare a whitelist (or blacklist) of yaml paths. Check configDict map[string]interface{} to only/not include elements matching such paths

It doesn't seem there's a standard syntax to express paths in yaml tree, nothing comparable to xpath. Assuming we can use a comparable syntax, we could define a blacklist like this:

hangyan commented 4 years ago

python seems have a library to parse yaml tree: https://pypi.org/project/yamlpath/. But still there is no standard way to define the syntax, we can choose one and implement it in golang

ndeloof commented 1 year ago

This is now feasible relying on tree.Path syntax