Skip to content
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

Autoregister Domain models into Graphql #295

Merged
merged 11 commits into from
Jul 27, 2023

Conversation

tjeerddie
Copy link
Contributor

@tjeerddie tjeerddie commented Jun 30, 2023

Closes: #261

@tjeerddie tjeerddie force-pushed the generate-graphql-domain-models branch from 4334727 to 3c3893b Compare June 30, 2023 13:51
@tjeerddie tjeerddie force-pushed the generate-graphql-domain-models branch 3 times, most recently from 7f05dfe to 9902c1a Compare July 3, 2023 11:21
@tjeerddie tjeerddie changed the title Generate graphql domain models Autoregister graphql domain models Jul 3, 2023
@tjeerddie tjeerddie changed the title Autoregister graphql domain models Autoregister Domain models into Graphql Jul 3, 2023
@@ -65,7 +65,7 @@ dependencies = [
"nwa-stdlib~=1.4.8",
"oauth2-lib~=1.3.1",
"tabulate==0.9.0",
"strawberry-graphql==0.171.1"
"strawberry-graphql@git+https://github.com/tjeerddie/strawberry#egg=pydantic-convert-specialized-list-class"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using my forked version until it gets merged

strawberry-graphql/strawberry#2909

@tjeerddie tjeerddie force-pushed the generate-graphql-domain-models branch 12 times, most recently from 003b672 to e1c43f9 Compare July 7, 2023 07:16
orchestrator/app.py Outdated Show resolved Hide resolved
@tjeerddie tjeerddie force-pushed the generate-graphql-domain-models branch from 726d787 to aa8a3b1 Compare July 11, 2023 12:55
@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2023

Codecov Report

Merging #295 (0dab3ee) into main (54d0f3c) will decrease coverage by 3.09%.
The diff coverage is 57.14%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #295      +/-   ##
==========================================
- Coverage   76.68%   73.60%   -3.09%     
==========================================
  Files         165      168       +3     
  Lines        8500     8637     +137     
  Branches     1370     1396      +26     
==========================================
- Hits         6518     6357     -161     
- Misses       1789     2097     +308     
+ Partials      193      183      -10     
Impacted Files Coverage Δ
orchestrator/cli/generator/generator/workflow.py 33.33% <0.00%> (ø)
orchestrator/workflows/steps.py 61.05% <0.00%> (ø)
orchestrator/graphql/resolvers/subscription.py 34.92% <30.55%> (-65.08%) ⬇️
...r/graphql/utils/get_subscription_product_blocks.py 36.95% <36.95%> (ø)
orchestrator/graphql/autoregistration.py 39.68% <39.68%> (ø)
orchestrator/app.py 83.13% <40.00%> (-3.12%) ⬇️
orchestrator/domain/base.py 88.13% <50.00%> (-0.46%) ⬇️
orchestrator/graphql/types.py 76.31% <63.63%> (-23.69%) ⬇️
orchestrator/graphql/schema.py 79.41% <79.41%> (ø)
orchestrator/graphql/resolvers/settings.py 44.44% <80.00%> (-35.19%) ⬇️
... and 9 more

... and 12 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

- federated type doesn't work correctly with pydantic when you have defined resolvers within the strawberry type.
so we need to first create a pydantic class and then we can create the federated class.
- update unit tests.
- move `add_graphql` to a function inside OrchestratorCore class function `register_graphql` because using OrchestratorCore as import in add_graphql.py causes import loop.
- rename models that get converted to strawberry type to remove `Initial` and `Inactive`.
- add graphql tests as new github action steps because they fail when running with other tests.
- use OauthContext as base of OrchestratorContext.
- fix incorrect docstring of `_has_subscription_details`.
- check if model is already added to strawberry_models.
- rename `EnumList` to `EnumDict`.
- update fail check in unit tests.
- found out you can add any graphql type propertie as 'Key' to a pydantic type as directives to make them usable in federations.
- change product block naming to not remove 'Initial' and 'Inactive' because if you use a `RelatedProductBlock` instead of a `RelatedProductBlockInactive` you want to create a type for both of them.
- add federation key directives to product blocks so they can also be federated.
@tjeerddie tjeerddie force-pushed the generate-graphql-domain-models branch from 0dab3ee to e4c2614 Compare July 27, 2023 13:21
@pboers1988 pboers1988 merged commit 730cd0e into main Jul 27, 2023
6 checks passed
@pboers1988 pboers1988 deleted the generate-graphql-domain-models branch July 27, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement autoregistration of Domain models into the GraphQL
5 participants