GraphQL Code Generator is a great, widely-used, must-have tool for every developer who uses both TypeScript and GraphQL.
However, there’s a minor problem if you use it in combination with Realm GraphQL.
The Problem
All of the fields of the generated types will be marked with @deprecated directives like this:
That will have your editor strikes through the params, which look like this:
Hey @Toshi - thanks for calling this out, did you see this start happening recently?
It seems like GraphQL Codegen adds this flag when we specify a ‘@deprecated’ directive in the GQL schema. However, MongoDB Realm does not use directives at the moment and downloading my schema from the endpoint (e.g. from GraphQL Playground) does not seem to indicate this either.
It would make sense to file an issue with GraphQL Codegen and understand whether this is a bug/regression/feature request for them, or at least give us more information to why our service doesn’t work with their tooling.
Hi Sumedha, thanks for the immediate feedback like always!
Until reading your comment, I was thinking Realm guys intentionally marked the schema deprecated for some reason, because I have never experienced this issue when I work with other services/frameworks which exposes graphql endpoints.
Now I think, however, it should make sense as you said – the cause may exist on the graphql-codegen side. I’ll go to their repo and find a next step.
FYI, as for your question:
did you see this start happening recently?
No, I have experienced this @deprecated issue since the first time I started to work with Realm GraphQL, which was August. (It’s only August so you can say it’s “recent” )
Thanks for digging deeper into this - we’re investigating where in our remote schema these “deprecated” flags might be coming from and will update this thread as soon as we find out.