dify/api/tests
GareArc f5c5dbaed5
feat(openapi): emit canonical ErrorBody on every /openapi/v1 error path
Install OpenApiErrorFormatter on the openapi blueprint's ExternalApi so
all non-2xx responses from /openapi/v1 carry the canonical ErrorBody shape
(code, message, status, optional details/hint). RFC 8628 device-flow
endpoints are unaffected — their flat {error: ...} shape is passed through
unchanged.

Also: set catch_all_404s=True when a formatter is present so unknown
routes return canonical JSON 404s (not Flask's default HTML 404).
Override _help_on_404 to suppress route suggestions, which would corrupt
the JSON contract and enumerate routes to unauthenticated callers.

Both behaviours are scoped by formatter presence — other blueprints that
construct ExternalApi without error_body_formatter are byte-identical.

Wire-level tests added to TestWireContract (3 tests, 18 total):
- 422 from @accepts validation carries code/status/details
- unknown-route 404 is canonical JSON without route suggestions
- device token POST returns RFC 8628 flat shape untouched by formatter
2026-06-10 02:48:38 -07:00
..
fixtures/workflow fix(api): defer streaming response until referenced variables are updated (#30832) 2026-01-12 16:23:18 +08:00
helpers feat(api): introduce model-type migration script (#36520) 2026-05-27 02:12:11 +00:00
integration_tests ci: add flag for linter (#37018) 2026-06-08 04:53:12 +00:00
test_containers_integration_tests fix(api): require all selected tags in list filters (#37272) 2026-06-10 08:20:13 +00:00
unit_tests feat(openapi): emit canonical ErrorBody on every /openapi/v1 error path 2026-06-10 02:48:38 -07:00
__init__.py refactor: move vdb implementations to workspaces (#34900) 2026-04-13 08:56:43 +00:00
conftest.py refactor(workflow-file): move core.file to core.workflow.file (#32252) 2026-02-16 22:38:19 +08:00
pytest_dify.py test(api): manage backend pytest services natively (#36235) 2026-05-19 07:52:15 +00:00
seed_legacy_model_type_dirty_data.py feat(api): introduce model-type migration script (#36520) 2026-05-27 02:12:11 +00:00
workflow_test_utils.py chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00