feat: add --json / --output-format=json flag for structured error output in CI pipelines
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
Research direction
Look at the existing CLI output formatters in the codebase, likely in a module like openapi_spec_validator/cli.py or openapi_spec_validator/formatters.py. Study how spectral and vacuum implement JSON output. The first step is to add a --format json argument to the CLI parser and create a new formatter class that outputs structured error objects with the specified fields. Test by running the validator on a sample spec and verifying the JSON output is valid and contains the expected keys.
Written by the indexing model from the issue text.
Description
The CLI currently outputs human-readable error messages, which works well for interactive use but is harder to parse in CI/CD pipelines or editor integrations.
Issue #160 ("No specific error information available", open since 2022) highlights how vague error messages make debugging difficult. A structured JSON output mode would solve this by emitting parseable error objects with:
path: the location in the spec where the error occurredmessage: human-readable descriptionrule: the specification rule that was violated (e.g.openapi.3.1.schema-validation)severity: error / warning / infosuggestion: (optional) guidance on how to fix
This could be activated via --format json or controlled through the Python API by passing a structured formatter. Existing validators like spectral (--format json) and vacuum already support this pattern.
The openapi-core ecosystem would also benefit — consumers like prism or openapi-core could consume structured validation results without string-parsing output.
- Dominant language
- Python
- Stars
- 409
- Forks
- 73
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-openapi/openapi-spec-validator
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
python-openapi/openapi-spec-validator#400 · 1 comment ·
-
kind/bug/confirmed
Difficulty 5/5 Over a week Newbie friendliness 25/100
python-openapi/openapi-spec-validator#373 · 1 comment ·
All issues in python-openapi/openapi-spec-validator
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stephrobert/dsoxlab#238 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sublimehq/package_control#1780 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
nwg-piotr/nwg-displays#145 ·