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/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 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 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 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 }); } 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() {