-
Notifications
You must be signed in to change notification settings - Fork 575
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
feat: Implementing Conditional Schema Support in @graphql-yoga/nestjs #2992
feat: Implementing Conditional Schema Support in @graphql-yoga/nestjs #2992
Conversation
🦋 Changeset detectedLatest commit: 98ff4cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Can you please add a test that confirms the changes work as expected?
75d8320
to
7f7a35c
Compare
@n1ru4l I've added a test, let me know if it's of for you ! |
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.
This looks good, thanks! Can you please rung pnpm changeset
to version the package, thanks!
fbd52e2
to
e0dd0f3
Compare
@enisdenjo I just ran the |
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.
Great stuff @magrinj, thank you very much! And sorry for the delay. 😬
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.
Oh, I just saw the CI, I see the build is failing - can you check whats up please?
@enisdenjo Oh yes sorry, I was using the wrong type for |
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.
Final change. 😄
Great job! Thanks! |
@magrinj some tests are failing, can you please check. Sorry for the back and forth... |
ad32fb9
to
19c74b8
Compare
@enisdenjo Is there any way we can discuss like Discord ? Actually the problem seems a bit complex, and I think I need some suggestion to fix it. |
@magrinj I am not very active on Discord, how about Slack? If you're ok with that, please provide me an e-mail and I'll invite you as a guest to our Slack! |
@enisdenjo Of course no I've Slack too, you can invite me on contact@magrin.fr |
@magrinj invite's out! |
@enisdenjo Thanks a lot, I'll try to reach you tomorrow if you're available |
Great! Looking forward to hearing from you. |
2338efa
to
4ee697e
Compare
@enisdenjo Ok so for now, I've disabled |
Great job @magrinj! I'll merge this and cut a new version. |
@enisdenjo Hello, sorry for the delay, I've some days off this week. |
Co-authored-by: Denis Badurina <badurinadenis@gmail.com>
Co-authored-by: Denis Badurina <badurinadenis@gmail.com>
It's not really a fix because subscription seems to be broken when is used
f775b5a
to
98ff4cd
Compare
@enisdenjo I've fix the issue, it was a small one sorry of the delay... |
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.
@magrinj this looks great to me, we ready to merge?
@enisdenjo Did you noticed that the changeset set bot is triggering a major version on lots of packaging ? Not sure why |
Good catch. 🤔 I don't know why though. The changesets in this PR are all minor. Could be that the bot has a brainfart? |
I don't know ^^' |
Let's see. 😄 |
✅ Benchmark Results
|
@EmrysMyrddin seems like the changesets are a-ok. See #3148. |
Thanks for the merge ! 🙂 |
Problem
In the current implementation of graphql-yoga, users have the flexibility to pass a function to the schema property, facilitating the setup of a conditional schema. Unfortunately, this functionality is not mirrored in the @graphql-yoga/nestjs package, creating a limitation when working with frameworks like Nest.JS, which appears to have restricted support for conditional schemas in the GraphQLModule.
At Twenty, we have a specific requirement to determine schemas dynamically based on the tenant to enable custom objects for our customers. The absence of this feature in the @graphql-yoga/nestjs package hinders our ability to provide a more personalized and scalable service.
Solution
To bridge this gap, I have introduced a new option called conditionalSchema. This option allows for the merging of conditional schema directives with the existing schema property, thereby enhancing flexibility and functionality. This enhancement not only preserves the autoSchemaFile option but also introduces the possibility to incorporate conditional schemas within the generated ones.
Changes Made:
Request for Feedback
I'm requiring your feedback on this implementation. Specifically, I am keen to understand potential edge cases or concerns that might arise with this enhancement.