|
3 | 3 | using JsonApiDotNetCore.OpenApi.JsonApiObjects;
|
4 | 4 | using JsonApiDotNetCore.OpenApi.JsonApiObjects.Documents;
|
5 | 5 | using JsonApiDotNetCore.OpenApi.JsonApiObjects.Relationships;
|
| 6 | +using Microsoft.AspNetCore.Mvc.ApiExplorer; |
6 | 7 | using Microsoft.OpenApi.Models;
|
7 | 8 | using Swashbuckle.AspNetCore.SwaggerGen;
|
8 | 9 |
|
@@ -42,29 +43,30 @@ public JsonApiSchemaGenerator(SchemaGenerator defaultSchemaGenerator, IResourceG
|
42 | 43 | _resourceObjectSchemaGenerator = new ResourceObjectSchemaGenerator(defaultSchemaGenerator, resourceGraph, options, _schemaRepositoryAccessor);
|
43 | 44 | }
|
44 | 45 |
|
45 |
| - public OpenApiSchema GenerateSchema(Type type, SchemaRepository schemaRepository, MemberInfo? memberInfo = null, ParameterInfo? parameterInfo = null) |
| 46 | + public OpenApiSchema GenerateSchema(Type modelType, SchemaRepository schemaRepository, MemberInfo? memberInfo = null, ParameterInfo? parameterInfo = null, |
| 47 | + ApiParameterRouteInfo? routeInfo = null) |
46 | 48 | {
|
47 |
| - ArgumentGuard.NotNull(type, nameof(type)); |
| 49 | + ArgumentGuard.NotNull(modelType, nameof(modelType)); |
48 | 50 | ArgumentGuard.NotNull(schemaRepository, nameof(schemaRepository));
|
49 | 51 |
|
50 | 52 | _schemaRepositoryAccessor.Current = schemaRepository;
|
51 | 53 |
|
52 |
| - if (schemaRepository.TryLookupByType(type, out OpenApiSchema jsonApiDocumentSchema)) |
| 54 | + if (schemaRepository.TryLookupByType(modelType, out OpenApiSchema jsonApiDocumentSchema)) |
53 | 55 | {
|
54 | 56 | return jsonApiDocumentSchema;
|
55 | 57 | }
|
56 | 58 |
|
57 |
| - if (IsJsonApiDocument(type)) |
| 59 | + if (IsJsonApiDocument(modelType)) |
58 | 60 | {
|
59 |
| - OpenApiSchema schema = GenerateJsonApiDocumentSchema(type); |
| 61 | + OpenApiSchema schema = GenerateJsonApiDocumentSchema(modelType); |
60 | 62 |
|
61 |
| - if (IsDataPropertyNullable(type)) |
| 63 | + if (IsDataPropertyNullable(modelType)) |
62 | 64 | {
|
63 | 65 | SetDataObjectSchemaToNullable(schema);
|
64 | 66 | }
|
65 | 67 | }
|
66 | 68 |
|
67 |
| - return _defaultSchemaGenerator.GenerateSchema(type, schemaRepository, memberInfo, parameterInfo); |
| 69 | + return _defaultSchemaGenerator.GenerateSchema(modelType, schemaRepository, memberInfo, parameterInfo); |
68 | 70 | }
|
69 | 71 |
|
70 | 72 | private static bool IsJsonApiDocument(Type type)
|
|
0 commit comments