OpenAPI schema does not validate
- Dominant language
- Python
- Stars
- 9
- Forks
- 31
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 16
Description
Our `drf-spectacular`-generated OpenAPI schema currently does not pass `manage.py spectacular --validate` and has 8 warnings. We should fix the validation issues and fix or explicitly ignore the warnings, then add CI checks for regressions.
manage.py spectacular --file schema.yml --validate output:
```
Warning: operationId "issue_retrieve" has collisions [('/api/issue/', 'get'), ('/api/issue/{issue_id}', 'get')]. resolving with numeral suffixes.
Warning: operationId "tree_retrieve" has collisions [('/api/tree/', 'get'), ('/api/tree/{tree_name}/{git_branch}', 'get')]. resolving with numeral suffixes.
Warning: operationId "tree_boots_retrieve" has collisions [('/api/tree/{commit_hash}/boots', 'get'), ('/api/tree/{tree_name}/{git_branch}/{commit_hash}/boots', 'get')]. resolving with numeral suffixes.
Warning: operationId "tree_builds_retrieve" has collisions [('/api/tree/{commit_hash}/builds', 'get'), ('/api/tree/{tree_name}/{git_branch}/{commit_hash}/builds', 'get')]. resolving with numeral suffixes.
Warning: operationId "tree_commits_retrieve" has collisions [('/api/tree/{commit_hash}/commits', 'get'), ('/api/tree/{tree_name}/{git_branch}/{commit_hash}/commits', 'get'), ('/api/tree/{tree_name}/{git_branch}/commits', 'get')]. resolving with numeral suffixes.
Warning: operationId "tree_full_retrieve" has collisions [('/api/tree/{commit_hash}/full', 'get'), ('/api/tree/{tree_name}/{git_branch}/{commit_hash}/full', 'get')]. resolving with numeral suffixes.
Warning: operationId "tree_summary_retrieve" has collisions [('/api/tree/{commit_hash}/summary', 'get'), ('/api/tree/{tree_name}/{git_branch}/{commit_hash}/summary', 'get')]. resolving with numeral suffixes.
Warning: operationId "tree_tests_retrieve" has collisions [('/api/tree/{commit_hash}/tests', 'get'), ('/api/tree/{tree_name}/{git_branch}/{commit_hash}/tests', 'get')]. resolving with numeral suffixes.
Schema generation summary:
Warnings: 8 (8 unique)
Errors: 0 (0 unique)
SchemaValidationError: 'null' is not one of ['array', 'boolean', 'integer', 'number', 'object', 'string']
Failed validating 'enum' in schema[0]['properties']['type']:
{'type': 'string',
'enum': ['array', 'boolean', 'integer', 'number', 'object', 'string']}
On instance['type']:
'null'
```
## Related Issues
- #1992
Contributor guide
Research direction
Start by running `manage.py spectacular --file schema.yml --validate` and review the reported schema validation error and eight operationId warnings. Trace the generated schema and API routes responsible; the work is done when validation passes, warnings are fixed or explicitly ignored, and CI checks prevent regressions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- api, ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100