dify/api/tests/unit_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
..
clients feat(dify-agent): sync shell and back proxy updates (#37159) 2026-06-10 03:04:32 +00:00
commands chore(api): Suppress unknown contract checks by default (#36969) 2026-06-09 08:32:34 +00:00
configs test(api): manage backend pytest services natively (#36235) 2026-05-19 07:52:15 +00:00
controllers feat(openapi): emit canonical ErrorBody on every /openapi/v1 error path 2026-06-10 02:48:38 -07:00
core fix(plugin): align plugin list endpoint counts with live endpoint state (#37179) 2026-06-10 08:11:11 +00:00
enterprise/telemetry refactor: replace bare dict with dict[str, Any] in enterprise telemetry, external data tool, and moderation tests (#35185) 2026-04-14 17:51:02 +00:00
enums refactor: quota v3 integration (#35436) 2026-04-27 01:49:40 +00:00
events feat: add cross-environment app migration workflow (#36765) 2026-05-28 07:30:33 +00:00
extensions ci: add flag for linter (#37018) 2026-06-08 04:53:12 +00:00
factories fix: validate conversation variable description length to prevent varchar(255) truncation error (#33038) 2026-06-10 07:28:12 +00:00
fields feat: snippet (#37046) 2026-06-05 09:38:42 +00:00
libs feat(api): introduce select, file and file list form input types to Human Input node (#36322) 2026-06-04 01:54:28 +00:00
models feat(dify-agent): sync shell and back proxy updates (#37159) 2026-06-10 03:04:32 +00:00
oss fix(test): register baidu_obs mock as pytest plugin (#35618) 2026-04-28 05:02:03 +00:00
repositories feat(api): introduce select, file and file list form input types to Human Input node (#36322) 2026-06-04 01:54:28 +00:00
services fix(api): require all selected tags in list filters (#37272) 2026-06-10 08:20:13 +00:00
tasks test: move delete account task to container integration (#36733) 2026-05-27 13:58:58 +00:00
tools chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00
utils feat: marketplace and oauth fixes (#35509) 2026-04-24 07:53:14 +00:00
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
.gitignore Enhance Code Consistency Across Repository with .editorconfig (#19023) 2025-04-29 18:04:33 +08:00
conftest.py chore: fix use select style api in orm (#35531) 2026-04-24 08:35:20 +00:00
test_makefile_backend_tests.py test(api): manage backend pytest services natively (#36235) 2026-05-19 07:52:15 +00:00
test_pytest_dify.py test(api): manage backend pytest services natively (#36235) 2026-05-19 07:52:15 +00:00