Skip to content

Commit ed4c8ac

Browse files
committed
Run inspect & cleanup code
1 parent b6d3f9a commit ed4c8ac

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/JsonApiDotNetCore.OpenApi/ServiceCollectionExtensions.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static void AddSwaggerGenerator(IServiceScope scope, IServiceCollection
5959
var controllerResourceMapping = scope.ServiceProvider.GetRequiredService<IControllerResourceMapping>();
6060
var resourceGraph = scope.ServiceProvider.GetRequiredService<IResourceGraph>();
6161
var jsonApiOptions = scope.ServiceProvider.GetRequiredService<IJsonApiOptions>();
62-
var namingPolicy = jsonApiOptions.SerializerOptions.PropertyNamingPolicy;
62+
JsonNamingPolicy namingPolicy = jsonApiOptions.SerializerOptions.PropertyNamingPolicy;
6363

6464
AddSchemaGenerator(services);
6565

@@ -101,8 +101,7 @@ private static IList<string> GetOperationTags(ApiDescription description, IContr
101101
};
102102
}
103103

104-
private static void SetSchemaIdSelector(SwaggerGenOptions swaggerGenOptions, IResourceGraph resourceGraph,
105-
JsonNamingPolicy namingPolicy)
104+
private static void SetSchemaIdSelector(SwaggerGenOptions swaggerGenOptions, IResourceGraph resourceGraph, JsonNamingPolicy namingPolicy)
106105
{
107106
ResourceNameFormatter resourceNameFormatter = new(namingPolicy);
108107
JsonApiSchemaIdSelector jsonApiObjectSchemaSelector = new(resourceNameFormatter, resourceGraph);

src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceObjectSchemaGenerator.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Text.Json;
34
using JsonApiDotNetCore.Configuration;
45
using JsonApiDotNetCore.OpenApi.JsonApiObjects.ResourceObjects;
56
using Microsoft.OpenApi.Models;
@@ -16,8 +17,8 @@ internal sealed class ResourceObjectSchemaGenerator
1617
private readonly bool _allowClientGeneratedIds;
1718
private readonly Func<ResourceTypeInfo, ResourceFieldObjectSchemaBuilder> _createFieldObjectBuilderFactory;
1819

19-
public ResourceObjectSchemaGenerator(SchemaGenerator defaultSchemaGenerator, IResourceGraph resourceGraph,
20-
IJsonApiOptions jsonApiOptions, ISchemaRepositoryAccessor schemaRepositoryAccessor)
20+
public ResourceObjectSchemaGenerator(SchemaGenerator defaultSchemaGenerator, IResourceGraph resourceGraph, IJsonApiOptions jsonApiOptions,
21+
ISchemaRepositoryAccessor schemaRepositoryAccessor)
2122
{
2223
ArgumentGuard.NotNull(defaultSchemaGenerator, nameof(defaultSchemaGenerator));
2324
ArgumentGuard.NotNull(resourceGraph, nameof(resourceGraph));
@@ -31,15 +32,15 @@ public ResourceObjectSchemaGenerator(SchemaGenerator defaultSchemaGenerator, IRe
3132
_resourceTypeSchemaGenerator = new ResourceTypeSchemaGenerator(schemaRepositoryAccessor, resourceGraph);
3233
_allowClientGeneratedIds = jsonApiOptions.AllowClientGeneratedIds;
3334

34-
_createFieldObjectBuilderFactory = CreateFieldObjectBuilderFactory(defaultSchemaGenerator, resourceGraph, jsonApiOptions,
35-
schemaRepositoryAccessor, _resourceTypeSchemaGenerator);
35+
_createFieldObjectBuilderFactory = CreateFieldObjectBuilderFactory(defaultSchemaGenerator, resourceGraph, jsonApiOptions, schemaRepositoryAccessor,
36+
_resourceTypeSchemaGenerator);
3637
}
3738

3839
private static Func<ResourceTypeInfo, ResourceFieldObjectSchemaBuilder> CreateFieldObjectBuilderFactory(SchemaGenerator defaultSchemaGenerator,
3940
IResourceGraph resourceGraph, IJsonApiOptions jsonApiOptions, ISchemaRepositoryAccessor schemaRepositoryAccessor,
4041
ResourceTypeSchemaGenerator resourceTypeSchemaGenerator)
4142
{
42-
var namingPolicy = jsonApiOptions.SerializerOptions.PropertyNamingPolicy;
43+
JsonNamingPolicy namingPolicy = jsonApiOptions.SerializerOptions.PropertyNamingPolicy;
4344
ResourceNameFormatter resourceNameFormatter = new(namingPolicy);
4445
var jsonApiSchemaIdSelector = new JsonApiSchemaIdSelector(resourceNameFormatter, resourceGraph);
4546

0 commit comments

Comments
 (0)