IBM / openapi-to-graphql

Translate APIs described by OpenAPI Specifications (OAS) into GraphQL
https://developer.ibm.com/open/projects/openapi-to-graphql/
MIT License
1.61k stars 211 forks source link

Support for Apollo Federated Query #353

Open Bengreen opened 3 years ago

Bengreen commented 3 years ago

Does openapi-to-graphql support generation of apollo federated queries. https://www.apollographql.com/docs/federation/api/apollo-federation/

This would allow merging of multiple instances of openapi-to-graphql to be merged along with other graphql federated content.

Alan-Cha commented 3 years ago

We currently do not support anything Apollo federation-specific. How do you imagine this working?

Off the top of my head, some of the problems moving forward is identifying keys from the OAS and maintaining consistent object type names across generated GraphQL interfaces.

Bengreen commented 3 years ago

I agree it does not look trivial. I was wondering if you had any thoughts on the topic and where to start as adding federation openapi-to-graphql or demonstrating openapi-to-graphql running in a federated graphql environment could be very powerful way to merge APIs Graphql and REST. In particular i was interested in using federation as a mechanism to push down query resolution into edge nodes (ie closer to the data). I have a crude example starting to come together trialing out schema stitching (which is similar to federation but is potentially limiting in its abilty to break down queries and push to the edge nodes.

i was looking at this library as a potential starting point https://github.com/0xR/graphql-transform-federation with the idea of testing it out and seeing how far i get. Then based on that would generate a fair idea of what could be useful to add to openapi-to-graphql to enable federation.

shellscape commented 3 years ago

FWIW @graphql-mesh/openapi (https://graphql-mesh.com/docs/handlers/openapi) has seemingly solved this.