@@ -26,25 +26,29 @@ public bool Equals(OpenApiSchema? x, OpenApiSchema? y)
2626 return true ;
2727 }
2828
29- return Instance . Equals ( x . AdditionalProperties , y . AdditionalProperties ) &&
29+ // Compare property equality in an order that should help us find inequality faster
30+ return
31+ x . Type == y . Type &&
32+ x . Format == y . Format &&
33+ SchemaIdEquals ( x , y ) &&
34+ x . Properties . Keys . All ( k => y . Properties . TryGetValue ( k , out var yValue ) && Instance . Equals ( x . Properties [ k ] , yValue ) ) &&
35+ OpenApiDiscriminatorComparer . Instance . Equals ( x . Discriminator , y . Discriminator ) &&
36+ Instance . Equals ( x . AdditionalProperties , y . AdditionalProperties ) &&
3037 x . AdditionalPropertiesAllowed == y . AdditionalPropertiesAllowed &&
3138 x . AllOf . SequenceEqual ( y . AllOf , Instance ) &&
3239 x . AnyOf . SequenceEqual ( y . AnyOf , Instance ) &&
3340 x . Deprecated == y . Deprecated &&
3441 OpenApiAnyComparer . Instance . Equals ( x . Default , y . Default ) &&
3542 x . Description == y . Description &&
36- OpenApiDiscriminatorComparer . Instance . Equals ( x . Discriminator , y . Discriminator ) &&
3743 OpenApiAnyComparer . Instance . Equals ( x . Example , y . Example ) &&
3844 x . ExclusiveMaximum == y . ExclusiveMaximum &&
3945 x . ExclusiveMinimum == y . ExclusiveMinimum &&
40- x . Extensions . Count == y . Extensions . Count
41- && x . Extensions . Keys . All ( k => y . Extensions . ContainsKey ( k ) && x . Extensions [ k ] is IOpenApiAny anyX && y . Extensions [ k ] is IOpenApiAny anyY && OpenApiAnyComparer . Instance . Equals ( anyX , anyY ) ) &&
46+ x . Extensions . Count == y . Extensions . Count &&
47+ x . Extensions . Keys . All ( k => y . Extensions . TryGetValue ( k , out var yValue ) && x . Extensions [ k ] is IOpenApiAny anyX && yValue is IOpenApiAny anyY && OpenApiAnyComparer . Instance . Equals ( anyX , anyY ) ) &&
4248 OpenApiExternalDocsComparer . Instance . Equals ( x . ExternalDocs , y . ExternalDocs ) &&
4349 x . Enum . SequenceEqual ( y . Enum , OpenApiAnyComparer . Instance ) &&
44- x . Format == y . Format &&
4550 Instance . Equals ( x . Items , y . Items ) &&
4651 x . Title == y . Title &&
47- x . Type == y . Type &&
4852 x . Maximum == y . Maximum &&
4953 x . MaxItems == y . MaxItems &&
5054 x . MaxLength == y . MaxLength &&
@@ -58,15 +62,13 @@ public bool Equals(OpenApiSchema? x, OpenApiSchema? y)
5862 Instance . Equals ( x . Not , y . Not ) &&
5963 x . Nullable == y . Nullable &&
6064 x . Pattern == y . Pattern &&
61- x . Properties . Keys . All ( k => y . Properties . ContainsKey ( k ) && Instance . Equals ( x . Properties [ k ] , y . Properties [ k ] ) ) &&
6265 x . ReadOnly == y . ReadOnly &&
6366 x . Required . Order ( ) . SequenceEqual ( y . Required . Order ( ) ) &&
6467 OpenApiReferenceComparer . Instance . Equals ( x . Reference , y . Reference ) &&
6568 x . UniqueItems == y . UniqueItems &&
6669 x . UnresolvedReference == y . UnresolvedReference &&
6770 x . WriteOnly == y . WriteOnly &&
68- OpenApiXmlComparer . Instance . Equals ( x . Xml , y . Xml ) &&
69- SchemaIdEquals ( x , y ) ;
71+ OpenApiXmlComparer . Instance . Equals ( x . Xml , y . Xml ) ;
7072 }
7173
7274 private static bool SchemaIdEquals ( OpenApiSchema x , OpenApiSchema y )
0 commit comments