dify/api/controllers/openapi
GareArc f533e992d4
fix(hitl): scope OpenAPI/Service-API resume to author-configured webapp forms
Pause-time token emission now draws only from the recipient set each API
surface is allowed to act on (emit ⊆ validate), so the CLI/OpenAPI caller is
never handed a token the resume endpoint would reject as 404 (WTA-867).

A form's recipients are partitioned once, per surface, into a single
FormDisposition: the surface-actionable recipient yields `form_token`, while
the rest are reported as `approval_channels` (e.g. ["email", "console"]) so the
caller is told where approval actually happens. Token and channels are two
projections of one decision (disposition_for_surface) loaded by one recipient
query (load_form_dispositions_by_form_id); the live pause path and the
reconnect snapshot path consume the same FormDisposition so they cannot drift.

RecipientType carries its user-facing approval-channel label as an enum tuple
value, set in __new__, so a new recipient type cannot be declared without one.

Tests: consolidate recipient/disposition/enrich tests into parametrized
matrices, add CONSOLE-surface and empty-token coverage, extract a shared fake
session for the pause-event tests.
2026-06-16 16:11:29 -07:00
..
auth feat(api,cli): strict UUID validation for app-id and workspace-id (#37212) 2026-06-09 07:35:18 +00:00
__init__.py refactor: fix OpenAPI contract generation schemas (#37387) 2026-06-12 14:25:53 +00:00
_audit.py feat: adding dify cli (#36348) 2026-05-26 01:12:36 +00:00
_contract.py feat: unified ErrorBody contract for /openapi/v1 and difyctl (#37285) 2026-06-11 10:26:27 +00:00
_errors.py fix(hitl): scope OpenAPI/Service-API resume to author-configured webapp forms 2026-06-16 16:11:29 -07:00
_input_schema.py feat: adding dify cli (#36348) 2026-05-26 01:12:36 +00:00
_meta.py refactor(openapi): unify request validation behind @accepts/@returns decorators (#37216) 2026-06-10 03:02:24 +00:00
_models.py refactor: fix OpenAPI contract generation schemas (#37387) 2026-06-12 14:25:53 +00:00
account.py refactor(openapi): unify request validation behind @accepts/@returns decorators (#37216) 2026-06-10 03:02:24 +00:00
app_dsl.py feat: support import / export dsl in CLI (#37232) 2026-06-10 09:51:40 +00:00
app_run.py refactor: fix OpenAPI contract generation schemas (#37387) 2026-06-12 14:25:53 +00:00
apps_permitted_external.py refactor(openapi): unify request validation behind @accepts/@returns decorators (#37216) 2026-06-10 03:02:24 +00:00
apps.py refactor(openapi): unify request validation behind @accepts/@returns decorators (#37216) 2026-06-10 03:02:24 +00:00
files.py feat: unified ErrorBody contract for /openapi/v1 and difyctl (#37285) 2026-06-11 10:26:27 +00:00
human_input_form.py fix(hitl): scope OpenAPI/Service-API resume to author-configured webapp forms 2026-06-16 16:11:29 -07:00
index.py refactor(openapi): unify request validation behind @accepts/@returns decorators (#37216) 2026-06-10 03:02:24 +00:00
oauth_device_sso.py feat: adding dify cli (#36348) 2026-05-26 01:12:36 +00:00
oauth_device.py refactor: fix OpenAPI contract generation schemas (#37387) 2026-06-12 14:25:53 +00:00
workflow_events.py refactor: fix OpenAPI contract generation schemas (#37387) 2026-06-12 14:25:53 +00:00
workspaces.py feat: unified ErrorBody contract for /openapi/v1 and difyctl (#37285) 2026-06-11 10:26:27 +00:00