-
Notifications
You must be signed in to change notification settings - Fork 67
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
PartialSchema Type extensions #93
Comments
One idea might be to naturally combine Types if a Type is declared multiple times in a schema or over multiple schemas. I'm not entirely sure how this would work with the current You potentially run into an issue where a field on a type is declared twice and that might be a little tricky. Another option would be to have a |
I have seen this before from the Node.js ecosystem, with graphql-nexus but it somewhat relies on codegen. The difficult part that I noticed right away would be implementing this in a type safe manner since we won't know the generic ObjectType of that specific Type declaration ahead of time. Furthermore, I think GraphQL spec's object extensions would solve this. It would probably make sense to go for about it this way, although I am not 100% sure how difficult it would be. |
@NeedleInAJayStack, @d-exclaimation, is this a change that would need to happen at the GraphQL level, or can this be isolated to Graphiti? It would definitely make the declarative Is the type safe manner really an issue because the type would be defined at compile time right? |
Adding support for the spec's object extensions would need to also happen at GraphQL level. I have seen some work on adding support for federation which relies on object extensions, but not sure the status on that. In terms of adding this capability just on Graphiti level, I'll definitely have a look over the week and see if I can work it out |
@cshadek If this is high priority for you and you have some free cycles, we sure wouldn't say no to a merge request ;) |
@NeedleInAJayStack haha I'm always happy to help - just not that sure where to begin with this one. I feel like it has to be a change at the GraphQL level and not Graphiti unless we can change how SchemaBuilder works to allow repeat type declarations with different fields and generate the resulting type based on the sum of those fields. Do you have any ideas on how to go about this? |
My first thought how this could be done is changing the SchemaBuilder typesComponent property from an array to something like map of the type name and the fields, and as the |
@d-exclaimation @NeedleInAJayStack, I saw that @samisuteria just added federation, which looks awesome! Does that mean this is solved now? I haven't yet had a chance to try out federation. |
No, not yet. The addition of federation support excluded implementation for code first directives and object extensions. I think @samisuteria is working on adding directives. |
I love the new SubSchema feature from @d-exclaimation!
I think it would be useful to have the ability to extended Types from one SubSchema in another SubSchema.
This would be a natural extension to the new declarative SubSchema feature and would allow you to break up a GraphQL type across multiple packages similar to Swift's
extension
feature.The text was updated successfully, but these errors were encountered: