Skip to content

Commit e2ba6db

Browse files
committed
fix(BA-5829): drop explicit AppConfigScopeType GQL registration
`gql_enum(...)` returns a wrapped enum class, which Strawberry registers under `"AppConfigScopeType"`. Other GQL modules use the bare DTO enum as a field annotation, and Strawberry auto-registers that under the same name on first encounter — failing the schema build with `Type AppConfigScopeType is defined multiple times`. Drop the explicit registration and let Strawberry auto-register from field references; re-export the GQL alias as a plain rebind so existing `AppConfigScopeTypeGQL` imports keep working.
1 parent 93d30d5 commit e2ba6db

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

  • src/ai/backend/manager/api/gql/app_config_fragment/types

src/ai/backend/manager/api/gql/app_config_fragment/types/node.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,17 @@
1212
from ai.backend.common.meta.meta import NEXT_RELEASE_VERSION
1313
from ai.backend.manager.api.gql.decorators import (
1414
BackendAIGQLMeta,
15-
gql_enum,
1615
gql_field,
1716
gql_pydantic_type,
1817
)
1918
from ai.backend.manager.api.gql.pydantic_compat import PydanticOutputMixin
2019

21-
# Register the shared DTO enum as a Strawberry type.
22-
AppConfigScopeTypeGQL = gql_enum(
23-
BackendAIGQLMeta(
24-
added_version=NEXT_RELEASE_VERSION,
25-
description="App-config scope type.",
26-
),
27-
AppConfigScopeType,
28-
name="AppConfigScopeType",
29-
)
20+
# The shared DTO enum is auto-registered by Strawberry the first time it
21+
# is referenced as a typed field. Re-export under the ``GQL`` suffix so
22+
# other modules can write `from ... import AppConfigScopeTypeGQL`. Calling
23+
# `strawberry.enum(...)` here would clash with that auto-registration
24+
# under the same `"AppConfigScopeType"` name.
25+
AppConfigScopeTypeGQL = AppConfigScopeType
3026

3127

3228
@gql_pydantic_type(
@@ -42,8 +38,6 @@ class AppConfigFragmentGQL(PydanticOutputMixin[AppConfigFragmentNode]):
4238
scope_type: AppConfigScopeType = gql_field(description="Scope type.")
4339
scope_id: str = gql_field(description="Scope id.")
4440
name: str = gql_field(description="Policy name (FK to app_config_policies).")
45-
extra_config: JSON | None = gql_field(
46-
description="Raw configuration payload, or null."
47-
)
41+
extra_config: JSON | None = gql_field(description="Raw configuration payload, or null.")
4842
created_at: datetime = gql_field(description="Creation timestamp.")
4943
updated_at: datetime | None = gql_field(description="Last update timestamp.")

0 commit comments

Comments
 (0)