@@ -28,16 +28,9 @@ internal sealed class JsonApiSchemaGenerator : ISchemaGenerator
28
28
typeof ( SecondaryResourceResponseDocument < > )
29
29
} ;
30
30
31
- private static readonly Type [ ] JsonApiResourceIdentifierDocumentOpenTypes =
32
- {
33
- typeof ( ResourceIdentifierCollectionResponseDocument < > ) ,
34
- typeof ( ResourceIdentifierResponseDocument < > )
35
- } ;
36
-
37
31
private readonly ISchemaGenerator _defaultSchemaGenerator ;
38
32
private readonly ResourceObjectSchemaGenerator _resourceObjectSchemaGenerator ;
39
33
private readonly NullableReferenceSchemaGenerator _nullableReferenceSchemaGenerator ;
40
- private readonly JsonApiObjectNullabilityProcessor _jsonApiObjectNullabilityProcessor ;
41
34
private readonly SchemaRepositoryAccessor _schemaRepositoryAccessor = new ( ) ;
42
35
43
36
public JsonApiSchemaGenerator ( SchemaGenerator defaultSchemaGenerator , IResourceGraph resourceGraph , IJsonApiOptions options )
@@ -48,7 +41,6 @@ public JsonApiSchemaGenerator(SchemaGenerator defaultSchemaGenerator, IResourceG
48
41
49
42
_defaultSchemaGenerator = defaultSchemaGenerator ;
50
43
_nullableReferenceSchemaGenerator = new NullableReferenceSchemaGenerator ( _schemaRepositoryAccessor ) ;
51
- _jsonApiObjectNullabilityProcessor = new JsonApiObjectNullabilityProcessor ( _schemaRepositoryAccessor ) ;
52
44
_resourceObjectSchemaGenerator = new ResourceObjectSchemaGenerator ( defaultSchemaGenerator , resourceGraph , options , _schemaRepositoryAccessor ) ;
53
45
}
54
46
@@ -73,11 +65,6 @@ public OpenApiSchema GenerateSchema(Type type, SchemaRepository schemaRepository
73
65
SetDataObjectSchemaToNullable ( schema ) ;
74
66
}
75
67
76
- if ( IsJsonApiDocument ( type ) )
77
- {
78
- RemoveNotApplicableNullability ( schema ) ;
79
- }
80
-
81
68
return schema ;
82
69
}
83
70
@@ -86,16 +73,6 @@ private static bool IsJsonApiResourceDocument(Type type)
86
73
return type . IsConstructedGenericType && JsonApiResourceDocumentOpenTypes . Contains ( type . GetGenericTypeDefinition ( ) ) ;
87
74
}
88
75
89
- private static bool IsJsonApiDocument ( Type type )
90
- {
91
- return IsJsonApiResourceDocument ( type ) || IsJsonApiResourceIdentifierDocument ( type ) ;
92
- }
93
-
94
- private static bool IsJsonApiResourceIdentifierDocument ( Type type )
95
- {
96
- return type . IsConstructedGenericType && JsonApiResourceIdentifierDocumentOpenTypes . Contains ( type . GetGenericTypeDefinition ( ) ) ;
97
- }
98
-
99
76
private OpenApiSchema GenerateResourceJsonApiDocumentSchema ( Type type )
100
77
{
101
78
Type resourceObjectType = type . BaseType ! . GenericTypeArguments [ 0 ] ;
@@ -141,10 +118,5 @@ private static OpenApiSchema CreateArrayTypeDataSchema(OpenApiSchema referenceSc
141
118
Type = "array"
142
119
} ;
143
120
}
144
-
145
- private void RemoveNotApplicableNullability ( OpenApiSchema schema )
146
- {
147
- _jsonApiObjectNullabilityProcessor . ClearDocumentProperties ( schema ) ;
148
- }
149
121
}
150
122
}
0 commit comments