23andMe / Yamale

A schema and validator for YAML.
MIT License
666 stars 88 forks source link

Feature Request: Ability to run yamale on multiple files #250

Open thiagowfx opened 1 month ago

thiagowfx commented 1 month ago

Observed: Currently it's only possible to run yamale in a directory, or for a single file.

Expected: It should also be possible to run yamale on a given set of files.

Example usage:

yamale --no-strict -s scripts/argocd_application_schema.yaml apps/base/myapp.yaml apps/base/myapp2.yaml

This currently fails with:

usage: yamale: [...]
yamale: error: unrecognized arguments: apps/base/myapp2.yaml

https://xyproblem.info / Motivation: Somewhat related to https://github.com/23andMe/Yamale/issues/228: It's not currently possible to exclude files from a given directory. In the context of developing Kubernetes GitOps repository this is often an issue. The ability to run yamale on multiple individual files would address it.

mildebrandt commented 1 month ago

Can you provide the version of Yamale you're using and the error message you're seeing? I can run yamale on single files using the same syntax you gave with the latest release, 5.2.1.

thiagowfx commented 1 month ago

My bad, you are right, Chris. For a single file, it works. The failure happens when you pass more than one file to it.

I got confused because this got surfaced in the context of pre-commit.com, and I had not realized that it was trying to pass more than one file to yamale.

I reworded the FR to support multiple files in addition to an individual one.

The documentation is also outdated ("PATH folder to validate. Default is current directory.").

I will send a PR iff I get spare cycles to do so.