internal override void Merge(
            ITypeCompletionContext context,
            INamedType type)
        {
            if (type is EnumType enumType)
            {
                TypeExtensionHelper.MergeContextData(
                    Definition,
                    enumType.Definition);

                TypeExtensionHelper.MergeDirectives(
                    context,
                    Definition.Directives,
                    enumType.Definition.Directives);

                TypeExtensionHelper.MergeConfigurations(
                    Definition.Configurations,
                    enumType.Definition.Configurations);

                MergeValues(context, Definition, enumType.Definition);
            }
            else
            {
                throw new ArgumentException(
                          TypeResources.EnumTypeExtension_CannotMerge,
                          nameof(type));
            }
        }
Example #2
0
        internal override void Merge(
            ITypeCompletionContext context,
            INamedType type)
        {
            if (type is UnionType unionType)
            {
                TypeExtensionHelper.MergeContextData(
                    Definition,
                    unionType.Definition);

                TypeExtensionHelper.MergeDirectives(
                    context,
                    Definition.Directives,
                    unionType.Definition.Directives);

                TypeExtensionHelper.MergeTypes(
                    Definition.Types,
                    unionType.Definition.Types);

                TypeExtensionHelper.MergeConfigurations(
                    Definition.Configurations,
                    unionType.Definition.Configurations);
            }
            else
            {
                throw new ArgumentException(
                          TypeResources.UnionTypeExtension_CannotMerge);
            }
        }
        internal override void Merge(
            ITypeCompletionContext context,
            INamedType type)
        {
            if (type is ObjectType objectType)
            {
                TypeExtensionHelper.MergeContextData(
                    Definition,
                    objectType.Definition);

                TypeExtensionHelper.MergeDirectives(
                    context,
                    Definition.Directives,
                    objectType.Definition.Directives);

                TypeExtensionHelper.MergeInterfaces(
                    Definition,
                    objectType.Definition);

                TypeExtensionHelper.MergeObjectFields(
                    context,
                    objectType.Definition.RuntimeType,
                    Definition.Fields,
                    objectType.Definition.Fields);

                TypeExtensionHelper.MergeConfigurations(
                    Definition.Configurations,
                    objectType.Definition.Configurations);
            }
            else
            {
                throw new ArgumentException(
                          TypeResources.ObjectTypeExtension_CannotMerge);
            }
        }
        internal override void Merge(
            ICompletionContext context,
            INamedType type)
        {
            if (type is InputObjectType inputObjectType)
            {
                TypeExtensionHelper.MergeContextData(
                    Definition,
                    inputObjectType.Definition);

                TypeExtensionHelper.MergeDirectives(
                    context,
                    Definition.Directives,
                    inputObjectType.Definition.Directives);

                TypeExtensionHelper.MergeInputObjectFields(
                    context,
                    Definition.Fields,
                    inputObjectType.Definition.Fields);

                TypeExtensionHelper.MergeConfigurations(
                    Definition.Configurations,
                    inputObjectType.Definition.Configurations);
            }
            else
            {
                throw new ArgumentException(
                          TypeResources.InputObjectTypeExtension_CannotMerge,
                          nameof(type));
            }
        }