mirror of
https://github.com/langgenius/dify.git
synced 2026-05-23 18:38:26 +08:00
Match the existing api-group convention: one module per resource family
with multiple Resource classes per file (cf service_api/dataset/dataset.py
with 7 routes, console/auth/oauth_device.py with 2 before this branch).
The Phase B-D fragmentation (one file per route under
controllers/openapi/oauth_device/) was inconsistent with the codebase.
Collapse into:
controllers/openapi/oauth_device.py (5 routes: code, token,
lookup, approve, deny —
account branch)
controllers/openapi/oauth_device_sso.py (4 routes: sso-initiate,
sso-complete,
approval-context,
approve-external —
EE-only SSO branch)
The split mirrors the original pre-migration layout: account branch in
console/auth/oauth_device.py, SSO branch in controllers/oauth_device_sso.py
(root). Both legacy mount files updated to import from the new modules.
No behavior change; 59 tests still green. Test files updated to import
from the consolidated module paths.
Plan: docs/superpowers/plans/2026-04-26-openapi-migration.md (in difyctl repo).
23 lines
941 B
Python
23 lines
941 B
Python
"""Legacy /v1/* mounts for the OAuth bearer + device-flow endpoints.
|
|
Canonical handlers live in controllers/openapi/. This file just
|
|
re-registers them on service_api_ns until Phase F retires the
|
|
legacy paths entirely.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from controllers.openapi.account import AccountApi, AccountSessionsSelfApi
|
|
from controllers.openapi.oauth_device import (
|
|
OAuthDeviceCodeApi,
|
|
OAuthDeviceLookupApi,
|
|
OAuthDeviceTokenApi,
|
|
)
|
|
from controllers.service_api import service_api_ns
|
|
|
|
# Legacy /v1/* mounts — handlers live in controllers/openapi/.
|
|
# Removed in Phase F.
|
|
service_api_ns.add_resource(OAuthDeviceCodeApi, "/oauth/device/code")
|
|
service_api_ns.add_resource(OAuthDeviceTokenApi, "/oauth/device/token")
|
|
service_api_ns.add_resource(OAuthDeviceLookupApi, "/oauth/device/lookup")
|
|
service_api_ns.add_resource(AccountApi, "/me")
|
|
service_api_ns.add_resource(AccountSessionsSelfApi, "/oauth/authorizations/self")
|