stac-utils / stac-validator

Validator for the stac-spec
Apache License 2.0
46 stars 27 forks source link

Return code not 0 when CLI check fails #144

Closed fredliporace closed 3 years ago

fredliporace commented 3 years ago

:wave: currently the return code is 0 when the check fails:

(stac-validator) [liporace@localhost test]$ stac_validator CBERS_4_MUX_20170528_090_084_L2_error.json
[
    {
        "version": "1.0.0-beta.2",
        "path": "CBERS_4_MUX_20170528_090_084_L2_error.json",
        "schema": [
            "https://schemas.stacspec.org/v1.0.0-beta.2/item-spec/json-schema/item.json"
        ],
        "valid_stac": false,
        "error_type": "ValidationError",
        "error_message": "'links' is a required property of the root of the STAC object"
    }
]
(stac-validator) [liporace@localhost test]$ echo $?
0

returning a non zero value in that cases it makes it easier to use the CLI tool for automatic bulk validations.

fredliporace commented 3 years ago

Thanks @jonhealy1 @jbants

tschaub commented 2 years ago

Does this only work in non-recursive mode? I'm running stac_validator with --recursive -1. I see a lot of "valid_stac": false printed, but the exit code is 0.

tschaub commented 2 years ago

I've proposed making the exit status reflect the validation status during recursion in #193.