Skip to content

CICD-087 · Validate data fixtures with jsonschema ​

Encyclopedia · Tests and quality checks · All snippets

Previous · CICD-086 · Next · CICD-088

1. Where it fits ​

  • Placement Bash run step following checkout, or equivalent lab terminal.
  • Prerequisites repository with test fixtures and task-specific quality dependencies.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
python -m jsonschema -i tests/fixture.json schemas/fixture.schema.json

3. How it works ​

The validator reads a JSON fixture and its schema as separate inputs. Add an intentionally invalid fixture to demonstrate that the schema actually constrains the value.

4. Verify the result ​

Use a pinned validator and a negative fixture proving the schema rejects wrong values.

Validation syntax-validated (Bash parse). Status definitions.