mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-26 03:11:49 +01:00
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
from typing import Union
|
||||
from typing import NewType
|
||||
|
||||
import strawberry
|
||||
|
||||
BigInt = strawberry.scalar(
|
||||
Union[int, str], # type: ignore
|
||||
BigInt = NewType('BigInt', int)
|
||||
|
||||
BigIntScalar = strawberry.scalar(
|
||||
name='BigInt',
|
||||
serialize=lambda v: int(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 wireless.graphql.schema import WirelessQuery
|
||||
|
||||
from .scalars import BigInt, BigIntScalar
|
||||
|
||||
|
||||
@strawberry.type
|
||||
class Query(
|
||||
@@ -36,9 +38,14 @@ class Query(
|
||||
|
||||
schema = strawberry.Schema(
|
||||
query=Query,
|
||||
config=StrawberryConfig(auto_camel_case=False),
|
||||
config=StrawberryConfig(
|
||||
auto_camel_case=False,
|
||||
scalar_map={
|
||||
BigInt: BigIntScalar,
|
||||
},
|
||||
),
|
||||
extensions=[
|
||||
DjangoOptimizerExtension(prefetch_custom_queryset=True),
|
||||
MaxAliasesLimiter(max_alias_count=settings.GRAPHQL_MAX_ALIASES),
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user