private static void DeclareFields( ITypeBindingInfo bindingInfo, IInputObjectTypeDescriptor typeDescriptor, InputObjectTypeDefinitionNode node) { foreach (InputValueDefinitionNode inputField in node.Fields) { bindingInfo.TrackField(inputField.Name.Value); IInputFieldDescriptor descriptor = typeDescriptor .Field(inputField.Name.Value) .Description(inputField.Description?.Value) .Type(inputField.Type) .DefaultValue(inputField.DefaultValue) .SyntaxNode(inputField); if (bindingInfo.TryGetFieldProperty( inputField.Name.Value, MemberKind.InputObjectField, out PropertyInfo p)) { descriptor.Extend().OnBeforeCreate( t => t.Property = p); } foreach (DirectiveNode directive in inputField.Directives) { descriptor.Directive(directive); } } }
private static void DeclareFields( ITypeBindingInfo bindingInfo, IInputObjectTypeDescriptor typeDescriptor, InputObjectTypeDefinitionNode node) { foreach (InputValueDefinitionNode inputField in node.Fields) { bindingInfo.TrackField(inputField.Name.Value); IInputFieldDescriptor descriptor = typeDescriptor .Field(inputField.Name.Value) .Description(inputField.Description?.Value) .Type(inputField.Type) .SyntaxNode(inputField); if (inputField.DefaultValue is { })
private static void DeclareFields( ITypeBindingInfo bindingInfo, IReadOnlySchemaOptions schemaOptions, IInputObjectTypeDescriptor typeDescriptor, InputObjectTypeExtensionNode node) { foreach (InputValueDefinitionNode inputField in node.Fields) { bindingInfo.TrackField(inputField.Name.Value); IInputFieldDescriptor descriptor = typeDescriptor .Field(inputField.Name.Value) .Description(inputField.Description?.Value) .Type(inputField.Type) .SyntaxNode(schemaOptions.PreserveSyntaxNodes ? inputField : null); if (inputField.DefaultValue is { })
private static void DeclareFields( ITypeBindingInfo bindingInfo, IReadOnlySchemaOptions schemaOptions, IObjectTypeDescriptor typeDescriptor, IReadOnlyCollection <FieldDefinitionNode> fieldDefinitions) { foreach (FieldDefinitionNode fieldDefinition in fieldDefinitions) { bindingInfo.TrackField(fieldDefinition.Name.Value); IObjectFieldDescriptor fieldDescriptor = typeDescriptor .Field(fieldDefinition.Name.Value) .Description(fieldDefinition.Description?.Value) .Type(fieldDefinition.Type) .SyntaxNode(schemaOptions.PreserveSyntaxNodes ? fieldDefinition : null); if (bindingInfo.TryGetFieldMember( fieldDefinition.Name.Value, MemberKind.ObjectField, out MemberInfo member)) { fieldDescriptor.Extend().OnBeforeCreate( t => t.Member = member); } foreach (DirectiveNode directive in fieldDefinition.Directives) { if (!directive.IsDeprecationReason()) { fieldDescriptor.Directive(directive); } } string deprecactionReason = fieldDefinition.DeprecationReason(); if (!string.IsNullOrEmpty(deprecactionReason)) { fieldDescriptor.Deprecated(deprecactionReason); } DeclareFieldArguments(schemaOptions, fieldDescriptor, fieldDefinition); } }