7
7
using JsonApiDotNetCore . OpenApi . Swashbuckle . JsonApiMetadata ;
8
8
using JsonApiDotNetCore . OpenApi . Swashbuckle . JsonApiObjects . ResourceObjects ;
9
9
using JsonApiDotNetCore . OpenApi . Swashbuckle . SwaggerComponents ;
10
- using Microsoft . OpenApi . Extensions ;
11
- using Microsoft . OpenApi . Interfaces ;
12
- using Microsoft . OpenApi . Models ;
13
- using Microsoft . OpenApi . Models . Interfaces ;
14
- using Microsoft . OpenApi . Models . References ;
10
+ using Microsoft . OpenApi ;
15
11
using Swashbuckle . AspNetCore . SwaggerGen ;
16
12
17
13
namespace JsonApiDotNetCore . OpenApi . Swashbuckle . SchemaGenerators . Components ;
@@ -226,7 +222,7 @@ public OpenApiSchemaReference GenerateSchemaForCommonData(Type commonDataSchemaT
226
222
var fullSchema = new OpenApiSchema
227
223
{
228
224
Type = JsonSchemaType . Object ,
229
- Required = [ JsonApiPropertyName . Type ] ,
225
+ Required = new SortedSet < string > ( [ JsonApiPropertyName . Type ] ) ,
230
226
Properties = new Dictionary < string , IOpenApiSchema >
231
227
{
232
228
[ JsonApiPropertyName . Type ] = referenceSchemaForResourceType . WrapInExtendedSchema ( ) ,
@@ -236,9 +232,9 @@ public OpenApiSchemaReference GenerateSchemaForCommonData(Type commonDataSchemaT
236
232
Discriminator = new OpenApiDiscriminator
237
233
{
238
234
PropertyName = JsonApiPropertyName . Type ,
239
- Mapping = new Dictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
235
+ Mapping = new SortedDictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
240
236
} ,
241
- Extensions = new Dictionary < string , IOpenApiExtension >
237
+ Extensions = new SortedDictionary < string , IOpenApiExtension >
242
238
{
243
239
[ "x-abstract" ] = new JsonNodeExtension ( true )
244
240
}
@@ -302,8 +298,8 @@ private void AdaptResourceIdentity(OpenApiSchema fullSchema, ResourceSchemaType
302
298
303
299
bool hasAtomicOperationsEndpoint = _generationCacheSchemaGenerator . HasAtomicOperationsEndpoint ( schemaRepository ) ;
304
300
305
- Dictionary < string , IOpenApiSchema > fullSchemaProperties = fullSchema . Properties ! ;
306
- HashSet < string > fullSchemaRequired = fullSchema . Required ! ;
301
+ IDictionary < string , IOpenApiSchema > fullSchemaProperties = fullSchema . Properties ! ;
302
+ ISet < string > fullSchemaRequired = fullSchema . Required ! ;
307
303
308
304
if ( ! hasAtomicOperationsEndpoint )
309
305
{
@@ -461,7 +457,7 @@ private OpenApiSchemaReference GenerateSchemaForCommonFields(Type commonFieldsSc
461
457
var fullSchema = new OpenApiSchema
462
458
{
463
459
Type = JsonSchemaType . Object ,
464
- Required = [ OpenApiMediaTypeExtension . FullyQualifiedOpenApiDiscriminatorPropertyName ] ,
460
+ Required = new SortedSet < string > ( [ OpenApiMediaTypeExtension . FullyQualifiedOpenApiDiscriminatorPropertyName ] ) ,
465
461
Properties = new Dictionary < string , IOpenApiSchema >
466
462
{
467
463
[ OpenApiMediaTypeExtension . FullyQualifiedOpenApiDiscriminatorPropertyName ] = referenceSchemaForResourceType . WrapInExtendedSchema ( )
@@ -470,9 +466,9 @@ private OpenApiSchemaReference GenerateSchemaForCommonFields(Type commonFieldsSc
470
466
Discriminator = new OpenApiDiscriminator
471
467
{
472
468
PropertyName = OpenApiMediaTypeExtension . FullyQualifiedOpenApiDiscriminatorPropertyName ,
473
- Mapping = new Dictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
469
+ Mapping = new SortedDictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
474
470
} ,
475
- Extensions = new Dictionary < string , IOpenApiExtension >
471
+ Extensions = new SortedDictionary < string , IOpenApiExtension >
476
472
{
477
473
[ "x-abstract" ] = new JsonNodeExtension ( true )
478
474
}
@@ -504,17 +500,17 @@ private void MapInDiscriminator(ResourceSchemaType resourceSchemaType, bool forR
504
500
inlineSchemaForBase . Discriminator ??= new OpenApiDiscriminator
505
501
{
506
502
PropertyName = discriminatorPropertyName ,
507
- Mapping = new Dictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
503
+ Mapping = new SortedDictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
508
504
} ;
509
505
510
506
if ( RepeatDiscriminatorInResponseDerivedTypes && ! forRequestSchema )
511
507
{
512
- inlineSchemaForBase . Required ??= [ ] ;
508
+ inlineSchemaForBase . Required ??= new SortedSet < string > ( ) ;
513
509
inlineSchemaForBase . Required . Add ( discriminatorPropertyName ) ;
514
510
}
515
511
516
512
string publicName = resourceSchemaType . ResourceType . PublicName ;
517
- inlineSchemaForBase . Discriminator . Mapping ??= [ ] ;
513
+ inlineSchemaForBase . Discriminator . Mapping ??= new SortedDictionary < string , OpenApiSchemaReference > ( ) ;
518
514
519
515
if ( inlineSchemaForBase . Discriminator . Mapping . TryAdd ( publicName , referenceSchemaForDerived ) && baseResourceType == null )
520
516
{
0 commit comments