public override void OnConfigure( IDescriptorContext context, IObjectTypeDescriptor descriptor, Type type) { var nodeDescriptor = new NodeDescriptor(descriptor, type); descriptor.Extend().OnBeforeCreate(definition => { // since we bind the id field late we need to hint to the type discovery // that we will need the ID scalar. definition.Dependencies.Add( TypeDependency.FromSchemaType( context.TypeInspector.GetType(typeof(IdType)))); }); descriptor.Extend().OnBeforeCompletion((descriptorContext, definition) => { // first we try to resolve the id field. if (IdField is not null) { MemberInfo?idField = type.GetMember(IdField).FirstOrDefault(); if (idField is null) { throw NodeAttribute_IdFieldNotFound(type, IdField); } nodeDescriptor.IdField(idField); } else if (context.TypeInspector.GetNodeIdMember(type) is { } id) { nodeDescriptor.IdField(id); }
public override void OnConfigure( IDescriptorContext context, IObjectTypeDescriptor descriptor, Type type) { descriptor .Extend() .OnBeforeCreate(x => x.ContextData.Add(nameof(Neo4JNodeAttribute), this)); }
public override void OnConfigure( IDescriptorContext context, IObjectTypeDescriptor descriptor, Type type) { descriptor .Extend() .OnBeforeCreate(d => d.ContextData[WellKnownContextData.ExtendMarker] = true); }
public NodeDescriptor(IObjectTypeDescriptor <TNode> typeDescriptor) : base(typeDescriptor.Extend().Context) { _typeDescriptor = typeDescriptor; _typeDescriptor .Implements <NodeType>() .Extend() .OnBeforeCreate(OnCompleteDefinition); }
public NodeDescriptor(IObjectTypeDescriptor descriptor, Type?nodeType = null) : base(descriptor.Extend().Context) { _typeDescriptor = descriptor; _typeDescriptor .Implements <NodeType>() .Extend() .OnBeforeCreate(OnCompleteDefinition); Definition.NodeType = nodeType; }
protected override void Configure(IObjectTypeDescriptor <ISchema> descriptor) { descriptor .Name(Names.__Schema) .Description(TypeResources.Schema_Description) // Introspection types must always be bound explicitly so that we // do not get any interference with conventions. .BindFields(BindingBehavior.Explicit); descriptor .Field(Names.Description) .Type <StringType>() .Resolver(c => c.Schema.Description); descriptor .Field(Names.Types) .Description(TypeResources.Schema_Types) .Type <NonNullType <ListType <NonNullType <__Type> > > >() .Resolver(c => c.Schema.Types); descriptor .Field(t => t.QueryType) .Name(Names.QueryType) .Description(TypeResources.Schema_QueryType) .Type <NonNullType <__Type> >(); descriptor .Field(t => t.MutationType) .Name(Names.MutationType) .Description(TypeResources.Schema_MutationType) .Type <__Type>(); descriptor .Field(t => t.SubscriptionType) .Name(Names.SubscriptionType) .Description(TypeResources.Schema_SubscriptionType) .Type <__Type>(); descriptor .Field(Names.Directives) .Description(TypeResources.Schema_Directives) .Type <NonNullType <ListType <NonNullType <__Directive> > > >() .Resolver(c => c.Schema.DirectiveTypes); if (descriptor.Extend().Context.Options.EnableDirectiveIntrospection) { descriptor .Field(t => t.Directives.Where(d => d.Type.IsPublic).Select(d => d.ToNode())) .Type <NonNullType <ListType <NonNullType <__AppliedDirective> > > >() .Name(Names.AppliedDirectives); } }
public EntityResolverDescriptor( IObjectTypeDescriptor descriptor, Type?resolvedEntityType = null) : base(descriptor.Extend().Context) { _typeDescriptor = descriptor; _typeDescriptor .Extend() .OnBeforeCreate(OnCompleteDefinition); Definition.ResolvedEntityType = resolvedEntityType; }
protected override void Configure(IObjectTypeDescriptor <T> descriptor) { descriptor.Name(GetNameFromException()); descriptor.Ignore(x => x.Data); descriptor.Ignore(x => x.Source); descriptor.Ignore(x => x.HelpLink); descriptor.Ignore(x => x.HResult); descriptor.Ignore(x => x.InnerException); descriptor.Ignore(x => x.StackTrace); descriptor.Ignore(x => x.TargetSite); descriptor.Ignore(x => x.GetBaseException()); descriptor.Field(x => x.Message).Type <NonNullType <StringType> >(); descriptor.Extend().Definition.ContextData.MarkAsError(); }
protected override void Configure( IObjectTypeDescriptor <IOutputField> descriptor) { descriptor .Name(Names.__Field) .Description(TypeResources.Field_Description) // Introspection types must always be bound explicitly so that we // do not get any interference with conventions. .BindFields(BindingBehavior.Explicit); descriptor .Field(t => t.Name) .Name(Names.Name) .Type <NonNullType <StringType> >(); descriptor .Field(t => t.Description) .Name(Names.Description); descriptor .Field(t => t.Arguments) .Name(Names.Args) .Type <NonNullType <ListType <NonNullType <__InputValue> > > >() .Resolver(c => c.Parent <IOutputField>().Arguments); descriptor .Field(t => t.Type) .Name(Names.Type) .Type <NonNullType <__Type> >(); descriptor .Field(t => t.IsDeprecated) .Name(Names.IsDeprecated) .Type <NonNullType <BooleanType> >(); descriptor .Field(t => t.DeprecationReason) .Name(Names.DeprecationReason); if (descriptor.Extend().Context.Options.EnableDirectiveIntrospection) { descriptor .Field(t => t.Directives.Where(d => d.Type.IsPublic).Select(d => d.ToNode())) .Type <NonNullType <ListType <NonNullType <__AppliedDirective> > > >() .Name(Names.AppliedDirectives); } }
protected override void Configure(IObjectTypeDescriptor <IInputField> descriptor) { descriptor .Name(Names.__InputValue) .Description(TypeResources.InputValue_Description) // Introspection types must always be bound explicitly so that we // do not get any interference with conventions. .BindFields(BindingBehavior.Explicit); descriptor .Field(t => t.Name) .Name(Names.Name) .Type <NonNullType <StringType> >(); descriptor .Field(t => t.Description) .Name(Names.Description); descriptor .Field(t => t.Type) .Name(Names.Type) .Type <NonNullType <__Type> >(); descriptor .Field(t => t.DefaultValue) .Name(Names.DefaultValue) .Description(TypeResources.InputValue_DefaultValue) .Type <StringType>() .Resolver(c => { IInputField field = c.Parent <IInputField>(); if (field.DefaultValue.IsNull()) { return(null); } return(field.DefaultValue?.Print()); }); if (descriptor.Extend().Context.Options.EnableDirectiveIntrospection) { descriptor .Field(t => t.Directives.Where(d => d.Type.IsPublic).Select(d => d.ToNode())) .Type <NonNullType <ListType <NonNullType <__AppliedDirective> > > >() .Name(Names.AppliedDirectives); } }
protected override void Configure(IObjectTypeDescriptor <T> descriptor) { descriptor.Extend().OnBeforeCreate(RewriteMessageFieldToNonNullableStringType); descriptor.Extend().Definition.ContextData.MarkAsError(); }