You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working with schema generated from REST endpoint using swagger-to-graphql. It works fine, but all GET operations are mapped as queries, and POST operations as mutations in the graphql schema. Many of those GET operations do things like remove or update items. And many POST operations do things like search for results.
Working with it in apollo is a bit weird, so I was hoping to be able to remap some of the queries to mutations, and some mutations to queries using @graphql-tools/wrap.
I have looked at the docs and tried various functions but I'm unable find solution to do this in an easy way. Is this supported, or is it possible to add support for this use case ?
The text was updated successfully, but these errors were encountered:
@karibertils – sounds like you should just throw away swagger-to-graphql and build your own GraphQL schema with resolvers that wrap REST methods. While it's not auto-magical, it's going to server you way better in the long run than trying to normalize an auto-magical solution using hacks. Otherwise, check out the ExpandPath and HoistField transforms, which do something along the lines of what you're talking about. Still, using those tools to normalize an automated schema just strikes me as a bad idea with nuances compounding atop of nuances.
Agree. We should have transform to change root field type, though, seems useful, might break if root types are ever nested, have to think about that more
Hello
I am working with schema generated from REST endpoint using swagger-to-graphql. It works fine, but all GET operations are mapped as queries, and POST operations as mutations in the graphql schema. Many of those GET operations do things like remove or update items. And many POST operations do things like search for results.
Working with it in apollo is a bit weird, so I was hoping to be able to remap some of the queries to mutations, and some mutations to queries using @graphql-tools/wrap.
I have looked at the docs and tried various functions but I'm unable find solution to do this in an easy way. Is this supported, or is it possible to add support for this use case ?
The text was updated successfully, but these errors were encountered: