public static IDirectiveCollection CreateAndComplete( ITypeCompletionContext context, object source, IEnumerable <DirectiveDefinition> directiveDefinitions) { if (context is null) { throw new ArgumentNullException(nameof(context)); } if (source is null) { throw new ArgumentNullException(nameof(source)); } if (directiveDefinitions is null) { throw new ArgumentNullException(nameof(directiveDefinitions)); } if (!directiveDefinitions.Any()) { return(EmptyDirectiveCollection.Default); } var directives = new DirectiveCollection(source, directiveDefinitions); directives.CompleteCollection(context); return(directives); }
protected override void OnCompleteType( ICompletionContext context, SchemaTypeDefinition definition) { base.OnCompleteType(context, definition); var directives = new DirectiveCollection( this, definition.Directives); directives.CompleteCollection(context); Directives = directives; Services = context.Services; }
public SortEnumValue( ITypeCompletionContext completionContext, SortEnumValueDefinition enumValueDefinition) { if (completionContext == null) { throw new ArgumentNullException(nameof(completionContext)); } if (enumValueDefinition is null) { throw new ArgumentNullException(nameof(enumValueDefinition)); } if (enumValueDefinition.Value is null) { throw new ArgumentException( DataResources.SortEnumValue_ValueIsNull, nameof(enumValueDefinition)); } SyntaxNode = enumValueDefinition.SyntaxNode; Name = enumValueDefinition.Name.HasValue ? enumValueDefinition.Name : (NameString)enumValueDefinition.Value.ToString(); Description = enumValueDefinition.Description; DeprecationReason = enumValueDefinition.DeprecationReason; IsDeprecated = !string.IsNullOrEmpty( enumValueDefinition.DeprecationReason); Value = enumValueDefinition.Value; ContextData = enumValueDefinition.ContextData; Handler = enumValueDefinition.Handler; Operation = enumValueDefinition.Operation; _directives = new DirectiveCollection(this, enumValueDefinition !.GetDirectives()); _directives.CompleteCollection(completionContext); }