Duplicate all GraphQL component objects into V1 and V2 namespaces #11776

Closed
opened 2025-12-29 21:49:44 +01:00 by adam · 0 comments
Owner

Originally created by @bctiemann on GitHub (Oct 24, 2025).

Originally assigned to: @bctiemann on GitHub.

Proposed Changes

Duplicate all GraphQL hierarchy objects (Schema -> Query -> Type -> Filter) to separately named V1 versions.

Justification

Because strawberry requires all objects in the GraphQL hierarchy (Schema -> Query -> Type -> Filter) to be uniquely defined, and complicated by the fact that most of the fields in Type classes are defined using strawberry.lazy which looks in specific files for resolving objects, separating V1 and V2 objects by shortcuts such as subclassing or conditional imports is not feasible. The only reasonable way to keep the V1 and V2 schemas separate within the strawberry object space is to duplicate the entire hierarchy and differentiate them with V1 suffixes, defined in duplicate files with _v1.py.

This will add extra work if GraphQL changes that need to apply to both V1 and V2 arise, but it will incentivize us to deprecate V1.

The upside of this is that when V1 is deprecated, cleaning it up will be almost entirely a matter of deleting the _v1.py files.

Originally created by @bctiemann on GitHub (Oct 24, 2025). Originally assigned to: @bctiemann on GitHub. ### Proposed Changes Duplicate all GraphQL hierarchy objects (Schema -> Query -> Type -> Filter) to separately named `V1` versions. ### Justification Because strawberry requires all objects in the GraphQL hierarchy (Schema -> Query -> Type -> Filter) to be uniquely defined, and complicated by the fact that most of the fields in Type classes are defined using `strawberry.lazy` which looks in specific files for resolving objects, separating V1 and V2 objects by shortcuts such as subclassing or conditional imports is not feasible. The only reasonable way to keep the V1 and V2 schemas separate within the strawberry object space is to duplicate the entire hierarchy and differentiate them with `V1` suffixes, defined in duplicate files with `_v1.py`. This will add extra work if GraphQL changes that need to apply to both V1 and V2 arise, but it will incentivize us to deprecate V1. The upside of this is that when V1 is deprecated, cleaning it up will be almost entirely a matter of deleting the `_v1.py` files.
adam added the status: acceptedtype: housekeepingnetbox labels 2025-12-29 21:49:45 +01:00
adam closed this issue 2025-12-29 21:49:45 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11776