Yamale icon indicating copy to clipboard operation
Yamale copied to clipboard

Option to disable recursive file search

Open reconman opened this issue 3 years ago • 2 comments

I wanted to use Yamale to validate all YAML files in my Github repository.

But Yamale also wants to validate my .github/workflows/CI.yml file.

Can you introduce a command line option to disable recursive file searches so sub-folders are ignored?

reconman avatar Nov 07 '21 14:11 reconman

Thanks for the suggestion, I'll think about how this can be done. In the meantime, you can do something like the following:

find *.yaml -exec yamale -s schema.yaml {} \;

mildebrandt avatar Nov 07 '21 18:11 mildebrandt

Instead of \; at the end, it should be +, otherwise the exit code will be 0 (success) instead of 1.

This is useful for calling it as part of build pipelines, as the pipeline will fail if any command returns non-0.

Additionally, the pattern in the find has to be more restrictive, otherwise you would validate the schema.yaml against itself.

reconman avatar Nov 13 '21 21:11 reconman