Beispiel #1
0
        private static void MergeInputType(ISchema right, SchemaBuilder builder, InputObjectType rightType)
        {
            if (builder.TryGetType <InputObjectType>(rightType.Name, out var leftType))
            {
                var rightTypeFields = right.GetInputFields(rightType.Name);

                foreach (var rightTypeField in rightTypeFields)
                {
                    builder.Connections(connect =>
                    {
                        if (connect.TryGetInputField(leftType, rightTypeField.Key, out _))
                        {
                            return;
                        }

                        connect.Include(leftType, new[] { rightTypeField });
                    });
                }
            }
            else
            {
                builder
                .Include(rightType)
                .Connections(connect =>
                {
                    var fields = right.GetInputFields(rightType.Name).ToList();
                    connect.Include(rightType, fields);
                });
            }
        }
Beispiel #2
0
        public void GetInputFields()
        {
            /* Given */
            var inputTypeName = "input";

            /* When */
            var fields = Schema.GetInputFields(inputTypeName);

            /* Then */
            Assert.Single(
                fields,
                kv => kv.Key == "id" && (ScalarType)kv.Value.Type == ScalarType.ID);
        }