ballerina-platform/ballerina-library

The `graphql:Context` Init Method Should not have Input Parameters

Opened this issue · 0 comments

Description:

The graphql:Context object currently has 3 input parameters; attributes, engine, and nextInterceptor. Except for the attributes parameter, others does not make sense.

  1. The attributes parameter: This can be used to initialize the context object with a set of attributes. This too is redundant as the set method can be used to set attributes. However, it can be useful in some scenarios.
  2. The engine parameter: This is not useful as the users cannot create a graphql:Engine object. So there's no point in passing this in the init method. Instead, it should be set internally, without exposing it to the public.
  3. The nextInterceptor parameter: This is not useful as well since the value should be 0 every time we create a context object. It should be incremented internally when an interceptor is executed.

Given the above reasons, I would suggest to remove the engine and nextInterceptor parameters from the init method of the graphql:Context object.

This will not break any existing code since the parameters are not used and we have not advised to use them anyway.