mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-22 16:58:49 +02:00
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
from typing import Union
|
from typing import NewType
|
||||||
|
|
||||||
import strawberry
|
import strawberry
|
||||||
|
|
||||||
BigInt = strawberry.scalar(
|
BigInt = NewType('BigInt', int)
|
||||||
Union[int, str], # type: ignore
|
|
||||||
|
BigIntScalar = strawberry.scalar(
|
||||||
|
name='BigInt',
|
||||||
serialize=lambda v: int(v),
|
serialize=lambda v: int(v),
|
||||||
parse_value=lambda v: str(v),
|
parse_value=lambda v: str(v),
|
||||||
description="BigInt field",
|
description='BigInt field',
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ from virtualization.graphql.schema import VirtualizationQuery
|
|||||||
from vpn.graphql.schema import VPNQuery
|
from vpn.graphql.schema import VPNQuery
|
||||||
from wireless.graphql.schema import WirelessQuery
|
from wireless.graphql.schema import WirelessQuery
|
||||||
|
|
||||||
|
from .scalars import BigInt, BigIntScalar
|
||||||
|
|
||||||
|
|
||||||
@strawberry.type
|
@strawberry.type
|
||||||
class Query(
|
class Query(
|
||||||
@@ -36,9 +38,14 @@ class Query(
|
|||||||
|
|
||||||
schema = strawberry.Schema(
|
schema = strawberry.Schema(
|
||||||
query=Query,
|
query=Query,
|
||||||
config=StrawberryConfig(auto_camel_case=False),
|
config=StrawberryConfig(
|
||||||
|
auto_camel_case=False,
|
||||||
|
scalar_map={
|
||||||
|
BigInt: BigIntScalar,
|
||||||
|
},
|
||||||
|
),
|
||||||
extensions=[
|
extensions=[
|
||||||
DjangoOptimizerExtension(prefetch_custom_queryset=True),
|
DjangoOptimizerExtension(prefetch_custom_queryset=True),
|
||||||
MaxAliasesLimiter(max_alias_count=settings.GRAPHQL_MAX_ALIASES),
|
MaxAliasesLimiter(max_alias_count=settings.GRAPHQL_MAX_ALIASES),
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user