Skip to content

Conversation

@yaacovCR
Copy link
Collaborator

@yaacovCR yaacovCR commented Dec 21, 2020

accounts is now world's first code-first stitched schema using graphql-js!
inventory is now world's first using nexus!
products is now world's first using TypeGraphQL!

@gmac
Copy link
Owner

gmac commented Dec 21, 2020

HA, this is awesome! Actually fits well with an idea I had to write a subservice somewhere in Ruby that pops the JavaScript bubble.

@yaacovCR
Copy link
Collaborator Author

In the example, there are 4 services. I have one vanilla GraphQL JS, second nexus, third I was planning was TypeGraphQL....

Anything you want for fourth service from my end? I think venturing out of JS/TS is a bit beyond my reach, my though is to leave in fourth service for you to possibly convert to a different language?

@gmac
Copy link
Owner

gmac commented Dec 23, 2020

Nope, those are great! We can merge when you’re ready a polish from there. Leaving the fourth service as-is is fine for now. Will have to see how complex a different language gets on the package management front.

@yaacovCR yaacovCR changed the title code-first stitched schemas (WIP) code-first stitched schemas Dec 24, 2020
accounts is now world's first code-first stitched schema using graphql-js

to do:
= convert a service to TypeGraphQL
= convert a service to nexus
= convert a service to...
= simplify type merging configuration to only use simple keys -- as this example is not meant to showcase the more coplex options
= fix the awkwardness with `{ stitchingDirectives: directive } = stitchingDirectives()`
@yaacovCR
Copy link
Collaborator Author

Guess I'm done!

@yaacovCR
Copy link
Collaborator Author

yaacovCR commented Dec 24, 2020

ok, now i'm really done.

related:
MichalLytek/type-graphql#351 (comment)
graphql-nexus/nexus#148 (comment)

Both TypeGraphQL and nexus allow to use specify directive data either natively or via extensions, but they do not let you setup actual new directive definitions.

This is not so great, primarily because custom directives might exist in queries, and should really therefore be able to be defined in every schema.

Relevant: graphql/graphql-js#1343

Discussion above is about directive usage, but i think all agree that custom directive defs should be possible in every schema framework -- it's certainly possible in graphql-js.

Workarounds are to use extendSchema after using these custom frameworks to add in typeDefs. Or -- to have the gateway turn off validation of the subschema SDL.

These notes are included within the comments within the implementation.

@gmac
Copy link
Owner

gmac commented Dec 25, 2020 via email

@gmac gmac merged commit df1d953 into gmac:master Dec 28, 2020
@yaacovCR yaacovCR deleted the code-first branch December 28, 2020 19:48
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.

2 participants