-
Notifications
You must be signed in to change notification settings - Fork 2.9k
9856 Replace graphene with Strawberry #15141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
107 commits
Select commit
Hold shift + click to select a range
3f2c21f
9856 base strawberry integration
arthanson eceac90
9856 user and group
arthanson 700f015
9856 user and circuits base
arthanson 46b0df4
9856 extras and mixins
arthanson 36f57f8
9856 fk
arthanson 34d9b78
9856 merge feature
arthanson dbe4097
Merge branch 'feature' into 9856-strawberry-2
arthanson de2d9ed
9856 update strawberry version
arthanson 7a222a6
9856 update imports
arthanson 28c48b3
9856 compatability fixes
arthanson 2d4fbea
9856 compatability fixes
arthanson 5e40ebd
9856 merge feature
arthanson 663af64
9856 update strawberry types
arthanson fb4d63f
9856 update strawberry types
arthanson cdcaa90
9856 core schema
arthanson 460b57d
9856 dcim schema
arthanson ed1e1ae
9856 extras schema
arthanson d3fc026
9856 ipam and tenant schema
arthanson 48b0cdd
9856 virtualization, vpn, wireless schema
arthanson 6d7678f
9856 fix old decorator
arthanson a171a02
Merge branch 'feature' into 9856-strawberry-2
arthanson 7779e87
9856 cleanup
arthanson eca0966
9856 cleanup
arthanson 99b0198
9856 fixes to circuits type specifiers
arthanson 4fab68a
9856 fixes to circuits type specifiers
arthanson cc5703c
Merge branch 'feature' into 9856-strawberry-2
arthanson d37414d
9856 update types
arthanson 1aa5b0d
9856 GFK working
arthanson c3cbefc
9856 GFK working
arthanson ff03abf
9856 _name
arthanson a0d0ab1
9856 misc fixes
arthanson 3c24cf9
Merge branch 'feature' into 9856-strawberry-2
arthanson d4812b2
9856 type updates
arthanson a5445bb
9856 _name to types
arthanson 69134db
9856 update types
arthanson 6bb9d68
9856 update types
arthanson ce003b2
9856 update types
arthanson 82c08d9
9856 update types
arthanson 0387cb0
9856 update types
arthanson 4d0d19b
9856 update types
arthanson 3e284c5
9856 update types
arthanson 44f4d60
9856 update types
arthanson 497de46
9856 update types
arthanson 13bf2c1
9856 merge feature
arthanson 14f0445
9856 GraphQLView
arthanson f874801
9856 GraphQLView
arthanson 0312ec3
Merge branch 'feature' into 9856-strawberry-2
arthanson 7c289ae
9856 fix OrganizationalObjectType
arthanson 2f71926
9856 single item query for schema
arthanson aa7c00e
9856 circuits graphql tests working
arthanson a5aad53
9856 test fixes
arthanson 888d9ec
9856 test fixes
arthanson 0ca46e3
9856 test fixes
arthanson 1052ea5
9856 test fix vpn
arthanson 5ff2c18
9856 test fixes
arthanson 77eb101
9856 test fixes
arthanson 7c66a6a
9856 test fixes
arthanson 28ac66b
9856 circuits test sans DjangoModelType
arthanson 4784829
9856 core test sans DjangoModelType
arthanson 005a339
9856 temp checkin
arthanson 12cca5d
9856 fix extas FK
arthanson 4b56f0b
9856 fix tenancy FK
arthanson 26c8ee3
9856 fix virtualization FK
arthanson 38c7d76
9856 fix vpn FK
arthanson 5f56e2d
9856 fix wireless FK
arthanson e53475a
9856 fix ipam FK
arthanson 676764a
9856 fix partial dcim FK
arthanson a32f4b8
9856 fix dcim FK
arthanson 133d6bf
9856 fix virtualization FK
arthanson 7b6a603
9856 fix tests / remove debug code
arthanson 7fa36ca
9856 fix test imagefield
arthanson ccc81e7
9856 cleanup graphene
arthanson f960d5a
9856 fix plugin schema
arthanson ba79078
9856 fix requirements
arthanson 36e6f0d
9856 fix requirements
arthanson 9167227
9856 fix docs
arthanson 02fbea5
9856 fix docs
arthanson be2a814
9856 temp fix tests
arthanson a36cc0a
9856 first filterset
arthanson 8aca8f8
9856 first filterset
arthanson c2a3275
9856 merge feature
arthanson d6fd0b8
9856 fix tests
arthanson 960f340
9856 fix tests
arthanson fe3f2c8
9856 working auto filter generation
arthanson 2c9bea9
9856 filter types
arthanson 21b585e
9856 filter types
arthanson 347e453
9856 filter types
arthanson 634f35a
9856 fix graphiql test
arthanson 2b7c1d1
Merge branch 'feature' into 9856-strawberry-2
arthanson 1da5219
9856 fix counter fields and merge feature
arthanson 1517175
9856 temp fix tests
arthanson b47c5ee
9856 fix tests
arthanson 9c53f76
9856 fix tenancy, ipam filter definitions
arthanson da0c23b
9856 cleanup
arthanson 6090d41
9856 cleanup
arthanson 3b30aa9
9856 cleanup
arthanson 9c29f45
Merge branch 'feature' into 9856-strawberry-2
jeremystretch b75b9e0
9856 review changes
arthanson 908150f
9856 review changes
arthanson 783c4f2
9856 review changes
arthanson 371a2a2
9856 fix base-requirements
arthanson f456731
9856 add wrapper to graphiql
arthanson bbccb87
9856 remove old graphiql debug toolbar
arthanson be52246
Merge branch 'feature' into 9856-strawberry-2
arthanson d027a1c
9856 review changes
arthanson d40bf63
9856 update strawberry
arthanson 55725ee
9856 remove superfluous check
arthanson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import strawberry | ||
| import strawberry_django | ||
| from circuits import filtersets, models | ||
|
|
||
| from netbox.graphql.filter_mixins import autotype_decorator, BaseFilterMixin | ||
|
|
||
| __all__ = ( | ||
| 'CircuitTerminationFilter', | ||
| 'CircuitFilter', | ||
| 'CircuitTypeFilter', | ||
| 'ProviderFilter', | ||
| 'ProviderAccountFilter', | ||
| 'ProviderNetworkFilter', | ||
| ) | ||
|
|
||
|
|
||
| @strawberry_django.filter(models.CircuitTermination, lookups=True) | ||
| @autotype_decorator(filtersets.CircuitTerminationFilterSet) | ||
| class CircuitTerminationFilter(BaseFilterMixin): | ||
| pass | ||
|
|
||
|
|
||
| @strawberry_django.filter(models.Circuit, lookups=True) | ||
| @autotype_decorator(filtersets.CircuitFilterSet) | ||
| class CircuitFilter(BaseFilterMixin): | ||
| pass | ||
|
|
||
|
|
||
| @strawberry_django.filter(models.CircuitType, lookups=True) | ||
| @autotype_decorator(filtersets.CircuitTypeFilterSet) | ||
| class CircuitTypeFilter(BaseFilterMixin): | ||
| pass | ||
|
|
||
|
|
||
| @strawberry_django.filter(models.Provider, lookups=True) | ||
| @autotype_decorator(filtersets.ProviderFilterSet) | ||
| class ProviderFilter(BaseFilterMixin): | ||
| pass | ||
|
|
||
|
|
||
| @strawberry_django.filter(models.ProviderAccount, lookups=True) | ||
| @autotype_decorator(filtersets.ProviderAccountFilterSet) | ||
| class ProviderAccountFilter(BaseFilterMixin): | ||
| pass | ||
|
|
||
|
|
||
| @strawberry_django.filter(models.ProviderNetwork, lookups=True) | ||
| @autotype_decorator(filtersets.ProviderNetworkFilterSet) | ||
| class ProviderNetworkFilter(BaseFilterMixin): | ||
| pass | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,40 @@ | ||
| import graphene | ||
| from typing import List | ||
|
|
||
| import strawberry | ||
| import strawberry_django | ||
|
|
||
| from circuits import models | ||
| from netbox.graphql.fields import ObjectField, ObjectListField | ||
| from .types import * | ||
| from utilities.graphql_optimizer import gql_query_optimizer | ||
|
|
||
|
|
||
| class CircuitsQuery(graphene.ObjectType): | ||
| circuit = ObjectField(CircuitType) | ||
| circuit_list = ObjectListField(CircuitType) | ||
|
|
||
| def resolve_circuit_list(root, info, **kwargs): | ||
| return gql_query_optimizer(models.Circuit.objects.all(), info) | ||
|
|
||
| circuit_termination = ObjectField(CircuitTerminationType) | ||
| circuit_termination_list = ObjectListField(CircuitTerminationType) | ||
|
|
||
| def resolve_circuit_termination_list(root, info, **kwargs): | ||
| return gql_query_optimizer(models.CircuitTermination.objects.all(), info) | ||
|
|
||
| circuit_type = ObjectField(CircuitTypeType) | ||
| circuit_type_list = ObjectListField(CircuitTypeType) | ||
|
|
||
| def resolve_circuit_type_list(root, info, **kwargs): | ||
| return gql_query_optimizer(models.CircuitType.objects.all(), info) | ||
|
|
||
| provider = ObjectField(ProviderType) | ||
| provider_list = ObjectListField(ProviderType) | ||
|
|
||
| def resolve_provider_list(root, info, **kwargs): | ||
| return gql_query_optimizer(models.Provider.objects.all(), info) | ||
|
|
||
| provider_account = ObjectField(ProviderAccountType) | ||
| provider_account_list = ObjectListField(ProviderAccountType) | ||
|
|
||
| provider_network = ObjectField(ProviderNetworkType) | ||
| provider_network_list = ObjectListField(ProviderNetworkType) | ||
|
|
||
| def resolve_provider_network_list(root, info, **kwargs): | ||
| return gql_query_optimizer(models.ProviderNetwork.objects.all(), info) | ||
| @strawberry.type | ||
| class CircuitsQuery: | ||
| @strawberry.field | ||
| def circuit(self, id: int) -> CircuitType: | ||
| return models.Circuit.objects.get(pk=id) | ||
| circuit_list: List[CircuitType] = strawberry_django.field() | ||
|
|
||
| @strawberry.field | ||
| def circuit_termination(self, id: int) -> CircuitTerminationType: | ||
| return models.CircuitTermination.objects.get(pk=id) | ||
| circuit_termination_list: List[CircuitTerminationType] = strawberry_django.field() | ||
|
|
||
| @strawberry.field | ||
| def circuit_type(self, id: int) -> CircuitTypeType: | ||
| return models.CircuitType.objects.get(pk=id) | ||
| circuit_type_list: List[CircuitTypeType] = strawberry_django.field() | ||
|
|
||
| @strawberry.field | ||
| def provider(self, id: int) -> ProviderType: | ||
| return models.Provider.objects.get(pk=id) | ||
| provider_list: List[ProviderType] = strawberry_django.field() | ||
|
|
||
| @strawberry.field | ||
| def provider_account(self, id: int) -> ProviderAccountType: | ||
| return models.ProviderAccount.objects.get(pk=id) | ||
| provider_account_list: List[ProviderAccountType] = strawberry_django.field() | ||
|
|
||
| @strawberry.field | ||
| def provider_network(self, id: int) -> ProviderNetworkType: | ||
| return models.ProviderNetwork.objects.get(pk=id) | ||
| provider_network_list: List[ProviderNetworkType] = strawberry_django.field() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import strawberry_django | ||
|
|
||
| from core import filtersets, models | ||
| from netbox.graphql.filter_mixins import autotype_decorator, BaseFilterMixin | ||
|
|
||
| __all__ = ( | ||
| 'DataFileFilter', | ||
| 'DataSourceFilter', | ||
| ) | ||
|
|
||
|
|
||
| @strawberry_django.filter(models.DataFile, lookups=True) | ||
| @autotype_decorator(filtersets.DataFileFilterSet) | ||
| class DataFileFilter(BaseFilterMixin): | ||
| pass | ||
|
|
||
|
|
||
| @strawberry_django.filter(models.DataSource, lookups=True) | ||
| @autotype_decorator(filtersets.DataSourceFilterSet) | ||
| class DataSourceFilter(BaseFilterMixin): | ||
| pass |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.