Exemple #1
0
        public static DocumentNode RemoveBuiltInTypes(DocumentNode schema)
        {
            var definitions = new List <IDefinitionNode>();

            foreach (IDefinitionNode definition in schema.Definitions)
            {
                if (definition is INamedSyntaxNode type)
                {
                    if (!IntrospectionTypes.IsIntrospectionType(
                            type.Name.Value) &&
                        !Types.Scalars.IsBuiltIn(type.Name.Value))
                    {
                        definitions.Add(definition);
                    }
                }
                else if (definition is DirectiveDefinitionNode directive)
                {
                    if (!Types.Directives.IsBuiltIn(directive.Name.Value))
                    {
                        definitions.Add(definition);
                    }
                }
                else
                {
                    definitions.Add(definition);
                }
            }

            return(new DocumentNode(definitions));
        }
        private static void GenerateTypes(
            CodeGenerationResult result,
            DataGeneratorContext dataContext,
            CodeGeneratorContext generatorContext,
            ISchema schema)
        {
            GenerateQueryType(
                result,
                dataContext,
                generatorContext,
                schema.Types
                .OfType <ObjectType>()
                .Where(type => !IntrospectionTypes.IsIntrospectionType(type))
                .ToList());

            GenerateDependencyInjectionCode(
                result,
                generatorContext);
        }
 private static bool IsPublicAndNoScalar(INamedType type) =>
 !IntrospectionTypes.IsIntrospectionType(type.Name) &&
 !(type is ScalarType);