diff --git a/README.md b/README.md index bf49958..a3d1836 100644 --- a/README.md +++ b/README.md @@ -108,14 +108,19 @@ We can perform a total validation of the CAP XML file: ```bash capvalidator validate ``` +By default this includes schema and signature validation. -To disable strict validation, that is, enforcement of a valid XML signature, we can use the `--no-strict` argument: +To manually enable/disable enforcement of a valid XML signature, we can use the `--strict` or `--no-strict` arguments respectively: ```bash -capvalidator validate --no-strict +capvalidator validate --strict ``` -Or, alternatively, more refined validations: +```bash +capvalidator validate --no-strict +``` + +Or, alternatively, for more refined validations we can use the `--type` argument: ```bash capvalidator validate --type schema ``` diff --git a/src/capvalidator/cli.py b/src/capvalidator/cli.py index c32b565..0d7d7de 100644 --- a/src/capvalidator/cli.py +++ b/src/capvalidator/cli.py @@ -15,14 +15,17 @@ def cli(): @click.option('--type', 'validation_type', type=click.Choice(['total', 'schema', 'signature']), required=False, default='total') +@click.option('--strict/--no-strict', 'strict', + required=False, default=True, + help='Disable validation of the XML signature') @click.argument('cap_xml', type=click.File(mode="rb", errors="ignore")) -def validate(ctx, cap_xml, validation_type) -> None: +def validate(ctx, cap_xml, validation_type, strict=True) -> None: """Validate a CAP alert""" cap = cap_xml.read() if validation_type == "total": - result = validate_xml(cap) + result = validate_xml(cap, strict=strict) elif validation_type == "schema": result = check_schema(cap) elif validation_type == "signature":