api: don't overwrite 400 and 403

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-16 20:54:58 +02:00
parent cbed5a6522
commit 8b6292b3de
2 changed files with 15 additions and 15 deletions

View File

@ -60,8 +60,8 @@ def postprocess_schema_responses(result, generator, **kwargs): # noqa: W0613
for path in result["paths"].values(): for path in result["paths"].values():
for method in path.values(): for method in path.values():
method["responses"]["400"] = validation_error.ref method["responses"].setdefault("400", validation_error.ref)
method["responses"]["403"] = generic_error.ref method["responses"].setdefault("403", generic_error.ref)
result["components"] = generator.registry.build( result["components"] = generator.registry.build(
spectacular_settings.APPEND_COMPONENTS spectacular_settings.APPEND_COMPONENTS

View File

@ -1231,7 +1231,7 @@ paths:
'204': '204':
description: Access granted description: Access granted
'403': '403':
$ref: '#/components/schemas/GenericError' description: Access denied
'400': '400':
$ref: '#/components/schemas/ValidationError' $ref: '#/components/schemas/ValidationError'
/api/v2beta/core/applications/{slug}/metrics/: /api/v2beta/core/applications/{slug}/metrics/:
@ -1289,7 +1289,7 @@ paths:
'200': '200':
description: Success description: Success
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Bad request
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/core/groups/: /api/v2beta/core/groups/:
@ -2458,7 +2458,7 @@ paths:
$ref: '#/components/schemas/CertificateKeyPair' $ref: '#/components/schemas/CertificateKeyPair'
description: '' description: ''
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Bad request
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/events/events/: /api/v2beta/events/events/:
@ -3912,7 +3912,7 @@ paths:
$ref: '#/components/schemas/Link' $ref: '#/components/schemas/Link'
description: '' description: ''
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Flow not applicable
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/flows/instances/{slug}/export/: /api/v2beta/flows/instances/{slug}/export/:
@ -3969,7 +3969,7 @@ paths:
'200': '200':
description: Success description: Success
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Bad request
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/flows/instances/cache_clear/: /api/v2beta/flows/instances/cache_clear/:
@ -3985,7 +3985,7 @@ paths:
'204': '204':
description: Successfully cleared cache description: Successfully cleared cache
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Bad request
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/flows/instances/cache_info/: /api/v2beta/flows/instances/cache_info/:
@ -4028,7 +4028,7 @@ paths:
'204': '204':
description: Successfully imported flow description: Successfully imported flow
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Bad request
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/oauth2/authorization_codes/: /api/v2beta/oauth2/authorization_codes/:
@ -5352,7 +5352,7 @@ paths:
$ref: '#/components/schemas/PolicyTestResult' $ref: '#/components/schemas/PolicyTestResult'
description: '' description: ''
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Invalid parameters
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/policies/all/cache_clear/: /api/v2beta/policies/all/cache_clear/:
@ -5368,7 +5368,7 @@ paths:
'204': '204':
description: Successfully cleared cache description: Successfully cleared cache
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Bad request
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/policies/all/cache_info/: /api/v2beta/policies/all/cache_info/:
@ -7600,7 +7600,7 @@ paths:
$ref: '#/components/schemas/PropertyMappingTestResult' $ref: '#/components/schemas/PropertyMappingTestResult'
description: '' description: ''
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Invalid parameters
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/propertymappings/all/types/: /api/v2beta/propertymappings/all/types/:
@ -9239,7 +9239,7 @@ paths:
'204': '204':
description: Successfully imported provider description: Successfully imported provider
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Bad request
'403': '403':
$ref: '#/components/schemas/GenericError' $ref: '#/components/schemas/GenericError'
/api/v2beta/root/config/: /api/v2beta/root/config/:
@ -10440,9 +10440,9 @@ paths:
$ref: '#/components/schemas/RedirectChallenge' $ref: '#/components/schemas/RedirectChallenge'
description: '' description: ''
'400': '400':
$ref: '#/components/schemas/ValidationError' description: Token not found
'403': '403':
$ref: '#/components/schemas/GenericError' description: Access denied
/api/v2beta/sources/saml/: /api/v2beta/sources/saml/:
get: get:
operationId: sources_saml_list operationId: sources_saml_list