src/Service.GraphQLBuilder/Directives/ModelTypeDirective.cs (18 lines of code) (raw):
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using HotChocolate.Types;
namespace Azure.DataApiBuilder.Service.GraphQLBuilder.Directives
{
public class ModelDirectiveType : DirectiveType
{
public static string DirectiveName { get; } = "model";
public static string ModelNameArgument { get; } = "name";
protected override void Configure(IDirectiveTypeDescriptor descriptor)
{
descriptor.Name(DirectiveName)
.Description("A directive to indicate the type maps to a storable entity not a nested entity.");
descriptor.Location(DirectiveLocation.Object | DirectiveLocation.FieldDefinition);
descriptor.Argument(ModelNameArgument)
.Description("Underlying name of the database entity.")
.Type<StringType>();
}
}
}