docs2/site/docs/analyzers/gql003.md
Field, Connection or ConnectionBuilder.Create and Name methods| Value | |
|---|---|
| Rule ID | GQL003 |
| Category | Usage |
| Default severity | Warning |
| Enabled by default | Yes |
| Code fix provided | Yes |
| Introduced in | v7.7 |
Field, Connection or ConnectionBuilder.Create and Name methods define
different field names.
Field name should be provided in the Field, Connection or
ConnectionBuilder.Create method. If you intend to use a different name, modify
it within the Field, Connection or ConnectionBuilder.Create method instead
of using the Name method.
Specify the preferred field name within the Field, Connection or
ConnectionBuilder.Create method and remove the use of the Name method.
Field<StringGraphType>("Name1").Name("Name2");
Connection<StringGraphType>("Name1").Name("Name2");
ConnectionBuilder<string>.Create<StringGraphType>("Name1").Name("Name2");
ConnectionBuilder.Create<StringGraphType, string>("Name1").Name("Name2");
Field<StringGraphType>("Name1");
Connection<StringGraphType>("Name1");
ConnectionBuilder<string>.Create<StringGraphType>("Name1");
ConnectionBuilder.Create<StringGraphType, string>("Name1");
or
Field<StringGraphType>("Name2");
Connection<StringGraphType>("Name2");
ConnectionBuilder<string>.Create<StringGraphType>("Name2");
ConnectionBuilder.Create<StringGraphType, string>("Name2");
If you just want to suppress a single violation, add preprocessor directives to your source file to disable and then re-enable the rule.
#pragma warning disable GQL003
// The code that's violating the rule is on this line.
#pragma warning restore GQL003
To disable the rule for a file, folder, or project, set its severity to none
in the
configuration file.
[*.cs]
dotnet_diagnostic.GQL003.severity = none
For more information, see How to suppress code analysis warnings.
GQL001: Define the name in Field, Connection or ConnectionBuilder.Create method
GQL002: Name method invocation can be removed