danielvladco / go-proto-gql

Protobuf plugins for generating graphql schema and golang to graphql bindings. Also supports a graphql gateway (Alpha)
Apache License 2.0
217 stars 53 forks source link

Directives in options.graphql #29

Open stmcodes opened 3 years ago

stmcodes commented 3 years ago

In your example example/codegen/pb/options.graphql There are the directives of the services

directive @Query on FIELD_DEFINITION
directive @Service on FIELD_DEFINITION
directive @Test on FIELD_DEFINITION

This is automatically added with your generator. But the individual serviceNames don't get the @Service automatically or do they? For Example in line 84 serviceMutate1(in: DataInput): Data @Service Is there a reason of this directives in general? And would it be helpful for you to automatically add this Directives to the specific services?

danielvladco commented 3 years ago

Hi what do you mean by individual services and specific services?

This directive is added so you can more easy apply interceptors to endpoints (for example to add authentication)

If you don't need it you can disable it using svc=false parameter when generating code (check the example)