public SchemaGraph( IReadOnlyDictionary <string, INamedType> types, IReadOnlyDictionary <string, Dictionary <string, IField> > fields, IReadOnlyDictionary <string, Dictionary <string, InputObjectField> > inputFields, IReadOnlyDictionary <string, DirectiveType> directiveTypes, IReadOnlyDictionary <string, Dictionary <string, Resolver> > resolvers, IReadOnlyDictionary <string, Dictionary <string, Subscriber> > subscribers, IReadOnlyDictionary <string, IValueConverter> scalarSerializers, string queryTypeName = "Query", string mutationTypeName = "Mutation", string subscriptionTypeName = "Subscription", IEnumerable <DirectiveInstance> directives = null) { _types = types; _fields = fields; _inputFields = inputFields; _directiveTypes = directiveTypes; _resolvers = resolvers; _subscribers = subscribers; _scalarSerializers = scalarSerializers; _directives = new DirectiveList(directives); Query = GetNamedType <ObjectType>(queryTypeName) ?? throw new ArgumentNullException( nameof(types), $"Could not find root type 'Query' from given types"); Mutation = GetNamedType <ObjectType>(mutationTypeName); Subscription = GetNamedType <ObjectType>(subscriptionTypeName); }
public Argument(IType type, object defaultValue = null, string description = null, IEnumerable <DirectiveInstance> directives = null) { Type = type ?? throw new ArgumentNullException(nameof(type)); DefaultValue = defaultValue; Description = description ?? string.Empty; _directives = new DirectiveList(directives); }
public EnumValue( string value, string?description = null, IEnumerable <DirectiveInstance>?directives = null, string?deprecationReason = null) { Description = description ?? string.Empty; Value = value; DeprecationReason = deprecationReason; _directives = new DirectiveList(directives); }
public InputObjectField( IType type, string description = null, object defaultValue = null, IEnumerable <DirectiveInstance> directives = null) { if (!TypeIs.IsInputType(type)) { throw new ArgumentOutOfRangeException( $" Type '{type}' is not valid input type"); } Type = type; Description = description ?? string.Empty; DefaultValue = defaultValue; _directives = new DirectiveList(directives); }
public UnionType(string name, IEnumerable <ObjectType> possibleTypes, string description = null, IEnumerable <DirectiveInstance> directives = null) { Name = name; Description = description ?? string.Empty; _directives = new DirectiveList(directives); foreach (var possibleType in possibleTypes) { if (PossibleTypes.ContainsKey(possibleType.Name)) { throw new InvalidOperationException( $"Type {Name} already has possibleType with name {possibleType.Name}"); } PossibleTypes[possibleType.Name] = possibleType; } }
public EnumType( string name, EnumValues values, string description = null, IEnumerable <DirectiveInstance> directives = null) { if (values == null) { throw new ArgumentNullException(nameof(values)); } Name = name ?? throw new ArgumentNullException(nameof(name)); Description = description ?? string.Empty; _directives = new DirectiveList(directives); foreach (var enumValue in values) { var value = enumValue.Value ?? new EnumValue(string.Empty); _values[enumValue.Key.ToUpperInvariant()] = value; } }
public Field( IType type, Args?arguments = null, string?description = null, object?defaultValue = null, IEnumerable <DirectiveInstance>?directives = null, string?deprecationReason = null) { Type = type; Description = description ?? string.Empty; DefaultValue = defaultValue; DeprecationReason = deprecationReason; _directives = new DirectiveList(directives); if (arguments != null) { foreach (var argument in arguments) { _arguments[argument.Key] = argument.Value; } } }
public InputObjectType(string name, string description = null, IEnumerable <DirectiveInstance> directives = null) { Name = name; Description = description ?? string.Empty; _directives = new DirectiveList(directives); }
protected ComplexType(string name, string?description, IEnumerable <DirectiveInstance>?directives) { Name = name; Description = description ?? string.Empty; _directives = new DirectiveList(directives); }