Here you will find all the recommendations for making best of this gem.
Important In the future, items from this list may become RuboCop cops.
This section is under construction.
- Never reference a type by their class!
- Always provide a type for fields and arguments, even if it will be resolved properly to
- Use symbol names for scalars and string gql names for anything else;
- Do not set arguments using the
argumentsnamed argument. Open a block and set them up inside of it instead;
- Do not define fields on the schema. Use alternatives instead;
- Provide description for everything, either directly or using
- Do not use fields chaining definition;
- Avoid using inline types, except for unions and enums;
- If a type requires nested fields to be fully qualified, then don’t create a scalar;
- Always assign a type to a class by its name, not its constant value;
- Register all database aliases on the Type Map to avoid warnings;
- Never load data during the resolve stage!
- Use the
prepareevent stage of requests to load data;
- Prefer using
current_value.somethingthan just calling
something. You may get some unexpected results.