File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
src/Microsoft.OpenApi/Models Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,27 @@ public IOpenApiReferenceable ResolveReference(OpenApiReference reference)
375
375
return ResolveReference ( reference , false ) ;
376
376
}
377
377
378
+ /// <summary>
379
+ /// Computes the hash code for an OpenApiDocument and its property values.
380
+ /// </summary>
381
+ /// <returns> The hash code.</returns>
382
+ public override int GetHashCode ( )
383
+ {
384
+ // select two random prime numbers e.g 1 and 3 and use them to compute hash codes
385
+ int hash = 1 ;
386
+ hash = hash * 3 + ( Workspace == null ? 0 : Workspace . GetHashCode ( ) ) ;
387
+ hash = hash * 3 + ( Info == null ? 0 : Info . GetHashCode ( ) ) ;
388
+ hash = hash * 3 + ( Servers == null ? 0 : Servers . GetHashCode ( ) ) ;
389
+ hash = hash * 3 + ( Paths == null ? 0 : Paths . GetHashCode ( ) ) ;
390
+ hash = hash * 3 + ( Components == null ? 0 : Components . GetHashCode ( ) ) ;
391
+ hash = hash * 3 + ( SecurityRequirements == null ? 0 : SecurityRequirements . GetHashCode ( ) ) ;
392
+ hash = hash * 3 + ( Tags == null ? 0 : Tags . GetHashCode ( ) ) ;
393
+ hash = hash * 3 + ( ExternalDocs == null ? 0 : ExternalDocs . GetHashCode ( ) ) ;
394
+ hash = hash * 3 + ( Extensions == null ? 0 : Extensions . GetHashCode ( ) ) ;
395
+
396
+ return hash ;
397
+ }
398
+
378
399
/// <summary>
379
400
/// Load the referenced <see cref="IOpenApiReferenceable"/> object from a <see cref="OpenApiReference"/> object
380
401
/// </summary>
You can’t perform that action at this time.
0 commit comments