Exemplo n.º 1
0
        private void CompleteNativeType(
            ITypeInitializationContext context)
        {
            if (ClrType == null &&
                context.TryGetNativeType(this, out Type nativeType))
            {
                ClrType = nativeType;
            }

            if (ClrType == null)
            {
                context.ReportError(new SchemaError(
                                        "Could not resolve the native type associated with " +
                                        $"input object type `{Name}`.",
                                        this));
            }

            _deserialize = InputObjectDeserializerFactory.Create(
                context, this, ClrType);
        }
Exemplo n.º 2
0
        private void CompleteNativeType(
            ITypeRegistry typeRegistry,
            Action <SchemaError> reportError)
        {
            if (_nativeType == null && typeRegistry.TryGetTypeBinding(this,
                                                                      out InputObjectTypeBinding typeBinding))
            {
                _nativeType = typeBinding.Type;
            }

            if (_nativeType == null)
            {
                reportError(new SchemaError(
                                "Could not resolve the native type associated with " +
                                $"input object type `{Name}`.",
                                this));
            }

            _deserialize = InputObjectDeserializerFactory.Create(
                reportError, this, _nativeType);
        }
Exemplo n.º 3
0
        void INeedsInitialization.CompleteType(ISchemaContext schemaContext, Action <SchemaError> reportError)
        {
            _nativeType = _nativeTypeFactory(schemaContext.Types);
            if (_nativeType == null)
            {
                reportError(new SchemaError(
                                "Could not resolve the native type associated with " +
                                $"input object type `{Name}`.",
                                this));
            }
            else
            {
                _deserialize = InputObjectDeserializerFactory.Create(
                    reportError, this, _nativeType);
            }

            foreach (InputField field in _fieldMap.Values)
            {
                field.CompleteInputField(schemaContext.Types, reportError, this);
            }
        }