-
Notifications
You must be signed in to change notification settings - Fork 15
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
Improve ability to override existing graphql models. #440
Conversation
a7d07ea
to
07500d5
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #440 +/- ##
==========================================
+ Coverage 71.33% 75.62% +4.29%
==========================================
Files 193 195 +2
Lines 9659 9703 +44
Branches 1316 1609 +293
==========================================
+ Hits 6890 7338 +448
+ Misses 2561 2130 -431
- Partials 208 235 +27 ☔ View full report in Codecov by Sentry. |
21ff7b9
to
57fe549
Compare
07500d5
to
0323f24
Compare
Will orchestrator implementations need to adjust imports for this? |
321e5c4
to
70c89bb
Compare
- add strawberry class override to change field resolvers of existing classes. - add unit tests for override_class function and add test that overrides `Query`. - move register_domain_models to create_graphql_router. - change register_domain_models to take existing models with a parameter instead of a global dict. - move `StrawberryPydanticModel`, `StrawberryModelType` and `GRAPHQL_MODELS` to graphql.schemas init. - create default `Subscription` inside the create_graphql_router to recreate it when interface is updated.
Co-authored-by: Mark Moes <mark_moes@live.nl>
- rename format_default_subscriptions to format_base_subscription. - improve test_override_class.
- move `create_subscription_strawberry_type` out of `add_class_to_strawberry`.
- the override_class can make the mapping itself instead of needing to do duplicate naming in the field and in the mapping given to the override_class. - change interface type in autoregistration to Type.
4cb256b
to
f6f53d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
register_graphql
to re-create autogenerated models and update the graphql router schema.Query
.StrawberryPydanticModel
,StrawberryModelType
andGRAPHQL_MODELS
to graphql.schemas init.Subscription
inside the create_graphql_router to recreate it when interface is updated.Fixes: #393, #310
Both fixed by the ability to update schema with running
app.register_graphql
multiple times.