77using JsonApiDotNetCore . OpenApi . Swashbuckle . JsonApiMetadata ;
88using JsonApiDotNetCore . OpenApi . Swashbuckle . JsonApiObjects . ResourceObjects ;
99using 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 ;
1511using Swashbuckle . AspNetCore . SwaggerGen ;
1612
1713namespace JsonApiDotNetCore . OpenApi . Swashbuckle . SchemaGenerators . Components ;
@@ -226,7 +222,7 @@ public OpenApiSchemaReference GenerateSchemaForCommonData(Type commonDataSchemaT
226222 var fullSchema = new OpenApiSchema
227223 {
228224 Type = JsonSchemaType . Object ,
229- Required = [ JsonApiPropertyName . Type ] ,
225+ Required = new SortedSet < string > ( [ JsonApiPropertyName . Type ] ) ,
230226 Properties = new Dictionary < string , IOpenApiSchema >
231227 {
232228 [ JsonApiPropertyName . Type ] = referenceSchemaForResourceType . WrapInExtendedSchema ( ) ,
@@ -236,9 +232,9 @@ public OpenApiSchemaReference GenerateSchemaForCommonData(Type commonDataSchemaT
236232 Discriminator = new OpenApiDiscriminator
237233 {
238234 PropertyName = JsonApiPropertyName . Type ,
239- Mapping = new Dictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
235+ Mapping = new SortedDictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
240236 } ,
241- Extensions = new Dictionary < string , IOpenApiExtension >
237+ Extensions = new SortedDictionary < string , IOpenApiExtension >
242238 {
243239 [ "x-abstract" ] = new JsonNodeExtension ( true )
244240 }
@@ -302,8 +298,8 @@ private void AdaptResourceIdentity(OpenApiSchema fullSchema, ResourceSchemaType
302298
303299 bool hasAtomicOperationsEndpoint = _generationCacheSchemaGenerator . HasAtomicOperationsEndpoint ( schemaRepository ) ;
304300
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 ! ;
307303
308304 if ( ! hasAtomicOperationsEndpoint )
309305 {
@@ -461,7 +457,7 @@ private OpenApiSchemaReference GenerateSchemaForCommonFields(Type commonFieldsSc
461457 var fullSchema = new OpenApiSchema
462458 {
463459 Type = JsonSchemaType . Object ,
464- Required = [ OpenApiMediaTypeExtension . FullyQualifiedOpenApiDiscriminatorPropertyName ] ,
460+ Required = new SortedSet < string > ( [ OpenApiMediaTypeExtension . FullyQualifiedOpenApiDiscriminatorPropertyName ] ) ,
465461 Properties = new Dictionary < string , IOpenApiSchema >
466462 {
467463 [ OpenApiMediaTypeExtension . FullyQualifiedOpenApiDiscriminatorPropertyName ] = referenceSchemaForResourceType . WrapInExtendedSchema ( )
@@ -470,9 +466,9 @@ private OpenApiSchemaReference GenerateSchemaForCommonFields(Type commonFieldsSc
470466 Discriminator = new OpenApiDiscriminator
471467 {
472468 PropertyName = OpenApiMediaTypeExtension . FullyQualifiedOpenApiDiscriminatorPropertyName ,
473- Mapping = new Dictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
469+ Mapping = new SortedDictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
474470 } ,
475- Extensions = new Dictionary < string , IOpenApiExtension >
471+ Extensions = new SortedDictionary < string , IOpenApiExtension >
476472 {
477473 [ "x-abstract" ] = new JsonNodeExtension ( true )
478474 }
@@ -504,17 +500,17 @@ private void MapInDiscriminator(ResourceSchemaType resourceSchemaType, bool forR
504500 inlineSchemaForBase . Discriminator ??= new OpenApiDiscriminator
505501 {
506502 PropertyName = discriminatorPropertyName ,
507- Mapping = new Dictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
503+ Mapping = new SortedDictionary < string , OpenApiSchemaReference > ( StringComparer . Ordinal )
508504 } ;
509505
510506 if ( RepeatDiscriminatorInResponseDerivedTypes && ! forRequestSchema )
511507 {
512- inlineSchemaForBase . Required ??= [ ] ;
508+ inlineSchemaForBase . Required ??= new SortedSet < string > ( ) ;
513509 inlineSchemaForBase . Required . Add ( discriminatorPropertyName ) ;
514510 }
515511
516512 string publicName = resourceSchemaType . ResourceType . PublicName ;
517- inlineSchemaForBase . Discriminator . Mapping ??= [ ] ;
513+ inlineSchemaForBase . Discriminator . Mapping ??= new SortedDictionary < string , OpenApiSchemaReference > ( ) ;
518514
519515 if ( inlineSchemaForBase . Discriminator . Mapping . TryAdd ( publicName , referenceSchemaForDerived ) && baseResourceType == null )
520516 {
0 commit comments