protected override void OnRegisterDependencies( ITypeInitializationContext context) { base.OnRegisterDependencies(context); if (_member != null) { context.RegisterResolver(Name, _member); } }
protected override void OnCompleteType( ITypeInitializationContext context) { if (!Values.Any()) { // TODO : Resources context.ReportError(new SchemaError( $"The enum type `{Name}` has no values.")); } }
private void ValidateFieldsRequirement( ITypeInitializationContext context) { if (Fields.Count == 0) { context.ReportError(new SchemaError( $"Interface `{Name}` has no fields declared.", this)); } }
protected override void OnRegisterDependencies( ITypeInitializationContext context) { base.OnRegisterDependencies(context); foreach (TypeReference typeReference in _types) { context.RegisterType(typeReference); } }
protected override void OnCompleteType(ITypeInitializationContext context) { base.OnCompleteType(context); foreach (INeedsInitialization argument in Arguments .Cast <INeedsInitialization>()) { argument.CompleteType(context); } }
protected override void OnRegisterDependencies(ITypeInitializationContext context) { base.OnRegisterDependencies(context); foreach (INeedsInitialization argument in Arguments .Cast <INeedsInitialization>()) { argument.RegisterDependencies(context); } }
private void CompleteExecutableDirectives( ITypeInitializationContext context) { var processed = new HashSet <string>(); if (context.Type is ObjectType ot) { AddExectableDirectives(processed, ot.Directives); AddExectableDirectives(processed, Directives); } }
protected override void OnCompleteType( ITypeInitializationContext context) { base.OnCompleteType(context); CompleteIsOfType(); CompleteInterfaces(context); CompleteFields(context); ValidateInterfaceImplementation(context); }
private void ValidateField( ITypeInitializationContext context, IGrouping <string, InterfaceField> interfaceField) { InterfaceField first = interfaceField.First(); if (ValidateInterfaceFieldGroup(context, first, interfaceField)) { ValidateObjectField(context, first); } }
protected override void OnRegisterDependencies( ITypeInitializationContext context) { base.OnRegisterDependencies(context); foreach (INeedsInitialization field in Fields .Cast <INeedsInitialization>()) { field.RegisterDependencies(context); } }
protected override void OnCompleteType(ITypeInitializationContext context) { base.OnCompleteType(context); foreach (INeedsInitialization field in Fields.Cast <INeedsInitialization>()) { field.CompleteType(context); } CompleteIsOfType(); CompleteInterfaces(context); }
protected override void OnCompleteType( ITypeInitializationContext context) { var processed = new HashSet <string>(); foreach (DirectiveDescription description in _descs) { CompleteDirective(context, description, processed); } _lookup = _directives.ToLookup(t => t.Name); }
protected override void OnCompleteType( ITypeInitializationContext context) { if (!Values.Any()) { context.ReportError(new SchemaError( string.Format( CultureInfo.InvariantCulture, TypeResources.EnumType_NoValues, Name))); } }
protected override void OnCompleteType( ITypeInitializationContext context) { base.OnCompleteType(context); foreach (INeedsInitialization field in Fields .Cast <INeedsInitialization>()) { field.CompleteType(context); } CompleteAbstractTypeResolver(context); }
private void CompleteInterfaces( ITypeInitializationContext context) { if (_interfaces != null) { foreach (InterfaceType interfaceType in _interfaces .Select(t => context.GetType <InterfaceType>(t)) .Where(t => t != null)) { _interfaceMap[interfaceType.Name] = interfaceType; } } }
private void ValidateInterfaceImplementation( ITypeInitializationContext context) { if (_interfaceMap.Count > 0) { foreach (IGrouping <string, InterfaceField> fieldGroup in _interfaceMap.Values .SelectMany(t => t.Fields) .GroupBy(t => t.Name)) { ValidateField(context, fieldGroup); } } }
private void CompleteClrType( ITypeInitializationContext context) { if (ClrType == null && context.TryGetNativeType(this, out Type clrType)) { ClrType = clrType; } if (ClrType == null) { ClrType = typeof(object); } }
protected override void OnCompleteType( ITypeInitializationContext context) { base.OnCompleteType(context); if (context.Type == null) { throw new InvalidOperationException( "It is not allowed to initialize a field without " + "a type context."); } DeclaringType = context.Type; Type = context.ResolveFieldType <T>(this, TypeReference); }
private void CompleteInterfaceFields( ITypeInitializationContext context) { if (context.Type is ObjectType ot && ot.Interfaces.Count > 0) { foreach (InterfaceType interfaceType in ot.Interfaces.Values) { if (interfaceType.Fields .TryGetField(Name, out InterfaceField field)) { _interfaceFields.Add(field); } } } }
private void CompleteFields( ITypeInitializationContext context) { foreach (INeedsInitialization field in Fields .Cast <INeedsInitialization>()) { field.CompleteType(context); } if (Fields.IsEmpty) { context.ReportError(new SchemaError( $"The input object `{Name}` does not have any fields.")); } }
protected override void OnCompleteType( ITypeInitializationContext context) { ITypeConversion converter = context.Services.GetTypeConversion(); _objectToValueConverter = new InputObjectToObjectValueConverter(converter); _valueToObjectConverter = new ObjectValueToInputObjectConverter(converter); base.OnCompleteType(context); CompleteClrType(context); CompleteFields(context); }
protected override void OnCompleteType( ITypeInitializationContext context) { base.OnCompleteType(context); if (Resolver == null) { Resolver = context.GetResolver(Name); if (Resolver == null) { context.ReportError(new SchemaError( $"The field `{context.Type.Name}.{Name}` " + "has no resolver.", context.Type)); } } }
private void CompleteResolver( ITypeInitializationContext context) { if (Resolver == null) { Resolver = context.GetResolver(Name); if (Resolver == null && _executableDirectives.All( t => t.Middleware == null)) { context.ReportError(new SchemaError( $"The field `{context.Type.Name}.{Name}` " + "has no resolver.", context.Type)); } } }
protected override void OnRegisterDependencies( ITypeInitializationContext context) { base.OnRegisterDependencies(context); if (context.Type == null) { throw new InvalidOperationException( "It is not allowed to initialize a field without " + "a type context."); } if (TypeReference != null) { context.RegisterType(TypeReference); } }
protected override void OnCompleteType( ITypeInitializationContext context) { base.OnCompleteType(context); if (Type != null) { CompleteDefaultValue(context, Type); if (context.Type is InputObjectType && Property == null && context.TryGetProperty(context.Type, Name, out PropertyInfo property)) { Property = property; } } }
private void RegisterDependencies( ITypeInitializationContext context) { if (_status == TypeStatus.Created) { _status = TypeStatus.Registering; foreach (INeedsInitialization dependency in _dependencies) { dependency.RegisterDependencies(context); } OnRegisterDependencies(context); _status = TypeStatus.Registered; } }
private void CompleteType( ITypeInitializationContext context) { if (_status == TypeStatus.Registered) { _status = TypeStatus.Completing; foreach (INeedsInitialization dependency in _dependencies) { dependency.CompleteType(context); } OnCompleteType(context); _status = TypeStatus.Completed; } }
protected override void OnCompleteType( ITypeInitializationContext context) { base.OnCompleteType(context); foreach (INeedsInitialization argument in Arguments .Cast <INeedsInitialization>()) { argument.CompleteType(context); } if (context.GetMiddleware(Name) is DirectiveDelegateMiddleware m) { Middleware = m.Middleware; IsExecutable = true; } }
private void CompleteFields( ITypeInitializationContext context) { foreach (INeedsInitialization field in Fields .Cast <INeedsInitialization>()) { field.CompleteType(context); } if (Fields.IsEmpty) { context.ReportError(new SchemaError(string.Format( CultureInfo.InvariantCulture, TypeResources.InputObjectType_NoFields, Name))); } }
protected override void OnRegisterDependencies( ITypeInitializationContext context) { base.OnCompleteType(context); if (!context.IsDirective && context.Type == null) { throw new InvalidOperationException( "It is not allowed to initialize a field without " + "a type context."); } if (TypeReference != null) { string s = TypeReference.ToString(); context.RegisterType(TypeReference); } }