Replace deprecated Strawberry scalar registration for BigInt #98

Closed
opened 2026-04-05 16:21:39 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @pheus on 3/23/2026

Proposed Changes

NetBox defines the GraphQL BigInt scalar in netbox/netbox/graphql/scalars.py by passing a class directly to strawberry.scalar(). When the development server is run with warnings enabled, Strawberry emits a deprecation warning during startup (currently twice):

python3 -Wd netbox/manage.py runserver 0.0.0.0:8000
/netbox/netbox/graphql/scalars.py:5: DeprecationWarning: Passing a class to strawberry.scalar() is deprecated. Use StrawberryConfig.scalar_map instead for better type checking support. See: https://strawberry.rocks/docs/types/scalars
  BigInt = strawberry.scalar(

This scalar registration should be updated to use Strawberry's supported configuration mechanism, such as StrawberryConfig.scalar_map or the current upstream-recommended equivalent, instead of the deprecated strawberry.scalar() pattern. The goal is to preserve the existing GraphQL behavior for BigInt while eliminating the warning from development and test runs.

No user-facing changes to workflows, data models, or the UI are expected.

Justification

This is a codebase-only cleanup that keeps NetBox aligned with Strawberry's supported API and reduces warning noise for developers running NetBox with warnings enabled. Addressing it now should help avoid future breakage once the deprecated behavior is removed upstream, and it keeps local development and CI output cleaner when deprecations are surfaced more aggressively.

*Originally created by @pheus on 3/23/2026* ### Proposed Changes NetBox defines the GraphQL `BigInt` scalar in `netbox/netbox/graphql/scalars.py` by passing a class directly to `strawberry.scalar()`. When the development server is run with warnings enabled, Strawberry emits a deprecation warning during startup (currently twice): ```bash python3 -Wd netbox/manage.py runserver 0.0.0.0:8000 ``` ```text /netbox/netbox/graphql/scalars.py:5: DeprecationWarning: Passing a class to strawberry.scalar() is deprecated. Use StrawberryConfig.scalar_map instead for better type checking support. See: https://strawberry.rocks/docs/types/scalars BigInt = strawberry.scalar( ``` This scalar registration should be updated to use Strawberry's supported configuration mechanism, such as `StrawberryConfig.scalar_map` or the current upstream-recommended equivalent, instead of the deprecated `strawberry.scalar()` pattern. The goal is to preserve the existing GraphQL behavior for `BigInt` while eliminating the warning from development and test runs. No user-facing changes to workflows, data models, or the UI are expected. ### Justification This is a codebase-only cleanup that keeps NetBox aligned with Strawberry's supported API and reduces warning noise for developers running NetBox with warnings enabled. Addressing it now should help avoid future breakage once the deprecated behavior is removed upstream, and it keeps local development and CI output cleaner when deprecations are surfaced more aggressively.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#98