From 92938daf3f845d12090f3fa466f81fd55ba7ab75 Mon Sep 17 00:00:00 2001 From: Luke Murray Date: Wed, 6 Aug 2025 21:59:20 +1000 Subject: [PATCH 1/5] small change --- docs/docusaurus.config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 07b67a37..ff689efa 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -1,14 +1,14 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion -const {themes} = require('prism-react-renderer'); +const { themes } = require('prism-react-renderer'); const lightCodeTheme = themes.github; const darkCodeTheme = themes.dracula; /** @type {import('@docusaurus/types').Config} */ const config = { title: 'Entity GraphQL', - tagline: 'A modern .NET Core GraphQL library', + tagline: 'A modern .NET GraphQL library', url: 'https://entitygraphql.github.io', baseUrl: '/', onBrokenLinks: 'throw', @@ -114,10 +114,10 @@ const config = { apiKey: '1382a55cce60fc56fb5c6f05fb12443e', indexName: 'entitygraphql', contextualSearch: true, - + // Optional: Algolia search parameters searchParameters: {}, - + // Optional: path for search page that enabled by default (`false` to disable it) searchPagePath: 'search', //... other Algolia params From 54d659dfc3a36467d406814412caa57946083cab Mon Sep 17 00:00:00 2001 From: Luke Murray Date: Wed, 6 Aug 2025 22:11:11 +1000 Subject: [PATCH 2/5] clean up --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 3bc97244..87a89d1d 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,6 @@ This sets up 1 end point: - `POST` at `/graphql` where the body of the post is a GraphQL query - You can authorize that route how you would any ASP.NET route. See Authorization below for details on having parts of the schema requiring Authorization/Claims -_Note - As of version 1.1+ the EntityGraphQL.AspNet extension helper uses System.Text.Json. Previous versions used JSON.NET._ - ## 3. Build awesome applications You can now make a request to your API. For example From aed2d3fcfee0d0c9be68b3e8452376dcb9bff7bd Mon Sep 17 00:00:00 2001 From: Ko Date: Tue, 12 Aug 2025 12:16:29 +1000 Subject: [PATCH 3/5] according to GraphQL spec, enum is part of the valid input fields, which should not be skipped --- src/EntityGraphQL/Schema/SchemaIntrospection.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/EntityGraphQL/Schema/SchemaIntrospection.cs b/src/EntityGraphQL/Schema/SchemaIntrospection.cs index 3a494d7f..409744b3 100644 --- a/src/EntityGraphQL/Schema/SchemaIntrospection.cs +++ b/src/EntityGraphQL/Schema/SchemaIntrospection.cs @@ -7,7 +7,6 @@ using EntityGraphQL.Directives; #endif - namespace EntityGraphQL.Schema; public static class SchemaIntrospection @@ -117,10 +116,6 @@ private static List BuildInputTypes(ISchemaProvider schema) if (field.ResolveExpression?.NodeType == System.Linq.Expressions.ExpressionType.Call) continue; - // Skipping ENUM type - if (field.ReturnType.TypeDotnet.IsEnum) - continue; - inputValues.Add(new InputValue(field.Name, BuildType(schema, field.ReturnType, field.ReturnType.TypeDotnet, true)) { Description = field.Description }); } From 28f6ca34209144adcce2b9c4976a3e4c92990433 Mon Sep 17 00:00:00 2001 From: Ko Date: Tue, 12 Aug 2025 12:47:22 +1000 Subject: [PATCH 4/5] Add unit test for enum input fields in GraphQL introspection --- .../IntrospectionTests/IntrospectionTests.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/tests/EntityGraphQL.Tests/IntrospectionTests/IntrospectionTests.cs b/src/tests/EntityGraphQL.Tests/IntrospectionTests/IntrospectionTests.cs index d01573bd..c287017a 100644 --- a/src/tests/EntityGraphQL.Tests/IntrospectionTests/IntrospectionTests.cs +++ b/src/tests/EntityGraphQL.Tests/IntrospectionTests/IntrospectionTests.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using EntityGraphQL.Schema; @@ -7,6 +8,45 @@ namespace EntityGraphQL.Tests; public class IntrospectionTests { + [Fact] + public void IncludeEnumInputField_Introspection() + { + var schema = SchemaBuilder.FromObject(); + + schema.AddInputType("EnumInputArgs", "args with enums").AddAllFields(); + + var gql = new QueryRequest + { + Query = + @"query { + __type(name: ""EnumInputArgs"") { + name + inputFields { + name + type { kind name ofType { kind name } } + } + } + }", + }; + + var result = schema.ExecuteRequestWithContext(gql, new TestDataContext(), null, null); + Assert.Null(result.Errors); + + var fields = (IEnumerable)((dynamic)result.Data!["__type"]!).inputFields; + Assert.Contains(fields, f => f.name == "unit"); + + var unitField = fields.First(f => f.name == "unit"); + Assert.Equal("NON_NULL", unitField.type.kind); + Assert.Equal("ENUM", unitField.type.ofType.kind); + Assert.Equal("HeightUnit", unitField.type.ofType.name); + } + + private class EnumInputArgs + { + public HeightUnit Unit { get; set; } + public DayOfWeek Day { get; set; } + } + [Fact] public void TestGraphiQLIntrospection() { From 1e02202918606f1bc09e5a5bab3efb73b7e8e246 Mon Sep 17 00:00:00 2001 From: Luke Murray Date: Tue, 12 Aug 2025 16:39:28 +1000 Subject: [PATCH 5/5] chore: ver bump --- CHANGELOG.md | 6 ++++++ src/EntityGraphQL.AspNet/EntityGraphQL.AspNet.csproj | 2 +- src/EntityGraphQL/EntityGraphQL.csproj | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e56200c7..7b388207 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 5.7.1 + +## Fixes + +- #466 Include enum-typed input fields in introspection per GraphQL spec + # 5.7.0 ## Changes diff --git a/src/EntityGraphQL.AspNet/EntityGraphQL.AspNet.csproj b/src/EntityGraphQL.AspNet/EntityGraphQL.AspNet.csproj index da028b6d..de45b7b5 100644 --- a/src/EntityGraphQL.AspNet/EntityGraphQL.AspNet.csproj +++ b/src/EntityGraphQL.AspNet/EntityGraphQL.AspNet.csproj @@ -4,7 +4,7 @@ EntityGraphQL.AspNet EntityGraphQL.AspNet 13 - 5.7.0 + 5.7.1 Contains ASP.NET extensions and middleware for EntityGraphQL Luke Murray https://github.com/lukemurray/EntityGraphQL diff --git a/src/EntityGraphQL/EntityGraphQL.csproj b/src/EntityGraphQL/EntityGraphQL.csproj index e8844fb4..13f6aaf9 100644 --- a/src/EntityGraphQL/EntityGraphQL.csproj +++ b/src/EntityGraphQL/EntityGraphQL.csproj @@ -4,7 +4,7 @@ 13.0 EntityGraphQL EntityGraphQL - 5.7.0 + 5.7.1 A GraphQL library for .NET Core. Compiles queries into .NET Expressions (LinqProvider) for runtime execution against object graphs. E.g. against an ORM data model (EntityFramework or others) or just an in-memory object. Luke Murray https://github.com/lukemurray/EntityGraphQL