Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed name convention interference with the introspection types. (#2588)
- Loading branch information
1 parent
b7ff8fa
commit b2877e3
Showing
16 changed files
with
438 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 76 additions & 40 deletions
116
src/HotChocolate/Core/src/Types/Types/Introspection/__DirectiveLocation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,122 @@ | ||
#pragma warning disable IDE1006 // Naming Styles | ||
using HotChocolate.Properties; | ||
using Lang = HotChocolate.Language.DirectiveLocation; | ||
|
||
#nullable enable | ||
namespace HotChocolate.Types.Introspection | ||
{ | ||
[Introspection] | ||
#pragma warning disable IDE1006 // Naming Styles | ||
internal sealed class __DirectiveLocation | ||
#pragma warning restore IDE1006 // Naming Styles | ||
: EnumType<DirectiveLocation> | ||
internal sealed class __DirectiveLocation : EnumType<DirectiveLocation> | ||
{ | ||
protected override void Configure(IEnumTypeDescriptor<DirectiveLocation> descriptor) | ||
{ | ||
descriptor.Name("__DirectiveLocation"); | ||
|
||
descriptor.Description( | ||
TypeResources.DirectiveLocation_Description); | ||
|
||
descriptor.Item(DirectiveLocation.Query) | ||
descriptor | ||
.Name(Names.__DirectiveLocation) | ||
.Description(TypeResources.DirectiveLocation_Description) | ||
// Introspection types must always be bound explicitly so that we | ||
// do not get any interference with conventions. | ||
.BindItems(BindingBehavior.Explicit); | ||
|
||
descriptor | ||
.Item(DirectiveLocation.Query) | ||
.Name(Lang.Query.Value) | ||
.Description(TypeResources.DirectiveLocation_Query); | ||
|
||
descriptor.Item(DirectiveLocation.Mutation) | ||
descriptor | ||
.Item(DirectiveLocation.Mutation) | ||
.Name(Lang.Mutation.Value) | ||
.Description(TypeResources.DirectiveLocation_Mutation); | ||
|
||
descriptor.Item(DirectiveLocation.Subscription) | ||
descriptor | ||
.Item(DirectiveLocation.Subscription) | ||
.Name(Lang.Subscription.Value) | ||
.Description(TypeResources.DirectiveLocation_Subscription); | ||
|
||
descriptor.Item(DirectiveLocation.Field) | ||
descriptor | ||
.Item(DirectiveLocation.Field) | ||
.Name(Lang.Field.Value) | ||
.Description(TypeResources.DirectiveLocation_Field); | ||
|
||
// TODO : Resources | ||
descriptor.Item(DirectiveLocation.VariableDefinition) | ||
.Name("VARIABLE_DEFINITION") | ||
.Description("Location adjacent to a variable definition."); | ||
|
||
descriptor.Item(DirectiveLocation.FragmentDefinition) | ||
.Name("FRAGMENT_DEFINITION") | ||
descriptor | ||
.Item(DirectiveLocation.FragmentDefinition) | ||
.Name(Lang.FragmentDefinition.Value) | ||
.Description(TypeResources.DirectiveLocation_FragmentDefinition); | ||
|
||
descriptor.Item(DirectiveLocation.FragmentSpread) | ||
.Name("FRAGMENT_SPREAD") | ||
descriptor | ||
.Item(DirectiveLocation.FragmentSpread) | ||
.Name(Lang.FragmentSpread.Value) | ||
.Description(TypeResources.DirectiveLocation_FragmentSpread); | ||
|
||
descriptor.Item(DirectiveLocation.InlineFragment) | ||
.Name("INLINE_FRAGMENT") | ||
descriptor | ||
.Item(DirectiveLocation.InlineFragment) | ||
.Name(Lang.InlineFragment.Value) | ||
.Description(TypeResources.DirectiveLocation_InlineFragment); | ||
|
||
descriptor.Item(DirectiveLocation.Schema) | ||
descriptor | ||
.Item(DirectiveLocation.VariableDefinition) | ||
.Name(Lang.VariableDefinition.Value) | ||
.Description("Location adjacent to a variable definition."); | ||
|
||
descriptor | ||
.Item(DirectiveLocation.Schema) | ||
.Name(Lang.Schema.Value) | ||
.Description(TypeResources.DirectiveLocation_Schema); | ||
|
||
descriptor.Item(DirectiveLocation.Scalar) | ||
descriptor | ||
.Item(DirectiveLocation.Scalar) | ||
.Name(Lang.Scalar.Value) | ||
.Description(TypeResources.DirectiveLocation_Scalar); | ||
|
||
descriptor.Item(DirectiveLocation.Object) | ||
descriptor | ||
.Item(DirectiveLocation.Object) | ||
.Name(Lang.Object.Value) | ||
.Description(TypeResources.DirectiveLocation_Object); | ||
|
||
descriptor.Item(DirectiveLocation.FieldDefinition) | ||
.Name("FIELD_DEFINITION") | ||
descriptor | ||
.Item(DirectiveLocation.FieldDefinition) | ||
.Name(Lang.FieldDefinition.Value) | ||
.Description(TypeResources.DirectiveLocation_FieldDefinition); | ||
|
||
descriptor.Item(DirectiveLocation.ArgumentDefinition) | ||
.Name("ARGUMENT_DEFINITION") | ||
descriptor | ||
.Item(DirectiveLocation.ArgumentDefinition) | ||
.Name(Lang.ArgumentDefinition.Value) | ||
.Description(TypeResources.DirectiveLocation_ArgumentDefinition); | ||
|
||
descriptor.Item(DirectiveLocation.Interface) | ||
descriptor | ||
.Item(DirectiveLocation.Interface) | ||
.Name(Lang.Interface.Value) | ||
.Description(TypeResources.DirectiveLocation_Interface); | ||
|
||
descriptor.Item(DirectiveLocation.Union) | ||
descriptor | ||
.Item(DirectiveLocation.Union) | ||
.Name(Lang.Union.Value) | ||
.Description(TypeResources.DirectiveLocation_Union); | ||
|
||
descriptor.Item(DirectiveLocation.Enum) | ||
descriptor | ||
.Item(DirectiveLocation.Enum) | ||
.Name(Lang.Enum.Value) | ||
.Description(TypeResources.DirectiveLocation_Enum); | ||
|
||
descriptor.Item(DirectiveLocation.EnumValue) | ||
.Name("ENUM_VALUE") | ||
descriptor | ||
.Item(DirectiveLocation.EnumValue) | ||
.Name(Lang.EnumValue.Value) | ||
.Description(TypeResources.DirectiveLocation_EnumValue); | ||
|
||
descriptor.Item(DirectiveLocation.InputObject) | ||
.Name("INPUT_OBJECT") | ||
descriptor | ||
.Item(DirectiveLocation.InputObject) | ||
.Name(Lang.InputObject.Value) | ||
.Description(TypeResources.DirectiveLocation_InputObject); | ||
|
||
descriptor.Item(DirectiveLocation.InputFieldDefinition) | ||
.Name("INPUT_FIELD_DEFINITION") | ||
descriptor | ||
.Item(DirectiveLocation.InputFieldDefinition) | ||
.Name(Lang.InputFieldDefinition.Value) | ||
.Description(TypeResources.DirectiveLocation_InputFieldDefinition); | ||
} | ||
|
||
public static class Names | ||
{ | ||
public const string __DirectiveLocation = "__DirectiveLocation"; | ||
} | ||
} | ||
} | ||
#pragma warning restore IDE1006 // Naming Styles |
45 changes: 31 additions & 14 deletions
45
src/HotChocolate/Core/src/Types/Types/Introspection/__EnumValue.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,49 @@ | ||
#pragma warning disable IDE1006 // Naming Styles | ||
using HotChocolate.Properties; | ||
|
||
#nullable enable | ||
namespace HotChocolate.Types.Introspection | ||
{ | ||
[Introspection] | ||
#pragma warning disable IDE1006 // Naming Styles | ||
internal sealed class __EnumValue | ||
#pragma warning restore IDE1006 // Naming Styles | ||
: ObjectType<IEnumValue> | ||
internal sealed class __EnumValue : ObjectType<IEnumValue> | ||
{ | ||
protected override void Configure( | ||
IObjectTypeDescriptor<IEnumValue> descriptor) | ||
{ | ||
descriptor.Name("__EnumValue"); | ||
|
||
descriptor.Description( | ||
TypeResources.EnumValue_Description); | ||
|
||
descriptor.BindFields(BindingBehavior.Explicit); | ||
descriptor | ||
.Name(Names.__EnumValue) | ||
.Description(TypeResources.EnumValue_Description) | ||
// Introspection types must always be bound explicitly so that we | ||
// do not get any interference with conventions. | ||
.BindFields(BindingBehavior.Explicit); | ||
|
||
descriptor.Field(c => c.Name) | ||
descriptor | ||
.Field(c => c.Name) | ||
.Name(Names.Name) | ||
.Type<NonNullType<StringType>>(); | ||
|
||
descriptor.Field(c => c.Description); | ||
descriptor | ||
.Field(c => c.Description) | ||
.Name(Names.Description); | ||
|
||
descriptor.Field(c => c.IsDeprecated) | ||
descriptor | ||
.Field(c => c.IsDeprecated) | ||
.Name(Names.IsDeprecated) | ||
.Type<NonNullType<BooleanType>>(); | ||
|
||
descriptor.Field(c => c.DeprecationReason); | ||
descriptor | ||
.Field(c => c.DeprecationReason) | ||
.Name(Names.DeprecationReason); | ||
} | ||
|
||
public static class Names | ||
{ | ||
public const string __EnumValue = "__EnumValue"; | ||
public const string Name = "name"; | ||
public const string Description = "description"; | ||
public const string IsDeprecated = "isDeprecated"; | ||
public const string DeprecationReason = "deprecationReason"; | ||
} | ||
} | ||
} | ||
#pragma warning restore IDE1006 // Naming Styles |
Oops, something went wrong.