google / rejoiner

Generates a unified GraphQL schema from gRPC microservices and other Protobuf sources
https://google.github.io/rejoiner/
Apache License 2.0
3.67k stars 139 forks source link

Flattening out inputs #52

Open soltran opened 6 years ago

soltran commented 6 years ago

At where I work, we are interested in using Rejoiner. However, our standard for graphql schemas is to have the inputs be flattened out.

Is this something we could do? What are things that could make it tricky? (also is there a way to remove input fields in the same manner we can remove fields from the response? Struggling to figure out a way to do it).

If this is somewhat doable to enable , my colleague and I could be down to make a PR to make it happen (as well as add documentation for it)

siderakis commented 6 years ago

I like the idea of providing a setting to flatten out inputs, I'm not sure where the best place to add that option is. The actual change should be pretty simple.

Input schema modifications is a requirement that came up for us too. ProtoRegistry.modifyTypes() could be modified to apply modifications to input types. Either TypeModification can be modified to support input types or a new InputTypeModification could be added. I'm thinking InputTypeModification would be better. Since a proto can be used as both output and input GraphQL types this would allow TypeModifications to only modify the output types and InputTypeModifications to only modify input types.