Skip to content

Commit c948466

Browse files
Return enums outside NW assembly as numbers
1 parent 9c2c4f4 commit c948466

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

NorthwindCRUD.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "analysis-rules", "analysis-
2222
NorthwindCRUD.ruleset = NorthwindCRUD.ruleset
2323
EndProjectSection
2424
EndProject
25+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infragistics.QueryBuilder.Executor", "..\Infragistics.QueryBuilder.Executor\Infragistics.QueryBuilder.Executor.csproj", "{BEC2BBD3-9A9E-B549-7020-0751B11B6AB9}"
26+
EndProject
2527
Global
2628
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2729
Debug|Any CPU = Debug|Any CPU
@@ -36,6 +38,10 @@ Global
3638
{F2C392E4-219B-41F3-8010-10E69EBF434D}.Debug|Any CPU.Build.0 = Debug|Any CPU
3739
{F2C392E4-219B-41F3-8010-10E69EBF434D}.Release|Any CPU.ActiveCfg = Release|Any CPU
3840
{F2C392E4-219B-41F3-8010-10E69EBF434D}.Release|Any CPU.Build.0 = Release|Any CPU
41+
{BEC2BBD3-9A9E-B549-7020-0751B11B6AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42+
{BEC2BBD3-9A9E-B549-7020-0751B11B6AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{BEC2BBD3-9A9E-B549-7020-0751B11B6AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
44+
{BEC2BBD3-9A9E-B549-7020-0751B11B6AB9}.Release|Any CPU.Build.0 = Release|Any CPU
3945
EndGlobalSection
4046
GlobalSection(SolutionProperties) = preSolution
4147
HideSolutionNode = FALSE

NorthwindCRUD/Filters/EnumSchemaFilter.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
using Microsoft.OpenApi.Any;
1+
using System.Reflection;
2+
using Microsoft.OpenApi.Any;
23
using Microsoft.OpenApi.Models;
34
using Swashbuckle.AspNetCore.SwaggerGen;
45

56
namespace NorthwindCRUD.Filters
67
{
78
public class EnumSchemaFilter : ISchemaFilter
89
{
10+
private static readonly Assembly CurrentAssembly = typeof(EnumSchemaFilter).Assembly;
11+
912
public void Apply(OpenApiSchema schema, SchemaFilterContext context)
1013
{
11-
if (context.Type.IsEnum)
14+
if (context.Type.IsEnum && context.Type.Assembly == CurrentAssembly)
1215
{
1316
schema.Type = "string";
1417
schema.Enum = context.Type
1518
.GetEnumNames()
1619
.Select(name => new OpenApiString(name))
1720
.ToList<IOpenApiAny>();
21+
schema.Format = null;
1822
}
1923
}
2024
}

NorthwindCRUD/NorthwindCRUD.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<PackageReference Include="AutoMapper" Version="14.0.0" />
2424
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
2525
<PackageReference Include="GraphQL.AspNet" Version="0.12.2-beta" />
26-
<PackageReference Include="Infragistics.QueryBuilder.Executor" Version="0.1.1-prerelease.2" />
2726
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.6" />
2827
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.6" />
2928
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.6">
@@ -53,4 +52,8 @@
5352
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
5453
</None>
5554
</ItemGroup>
55+
56+
<ItemGroup>
57+
<ProjectReference Include="..\..\Infragistics.QueryBuilder.Executor\Infragistics.QueryBuilder.Executor.csproj" />
58+
</ItemGroup>
5659
</Project>

0 commit comments

Comments
 (0)