Skip to content

OpenAPI schema does not validate #2024

Description

@mentonin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions