diff --git a/src/Microsoft.OpenApi/Services/OpenApiComparerBase.cs b/src/Microsoft.OpenApi/Services/OpenApiComparerBase.cs
index d08b5e644..1fe80577e 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiComparerBase.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiComparerBase.cs
@@ -2,6 +2,8 @@
// Licensed under the MIT license.
using System;
+using System.Collections.Generic;
+using System.Linq;
using Microsoft.OpenApi.Models;
namespace Microsoft.OpenApi.Services
@@ -46,6 +48,32 @@ internal void Compare(string source, string target, ComparisonContext comparison
}
}
+ ///
+ /// Compares two Uri object.
+ ///
+ /// The source.
+ /// The target.
+ /// The context under which to compare the objects.
+ internal void Compare(Uri source, Uri target, ComparisonContext comparisonContext)
+ {
+ if (source == null && target == null)
+ {
+ return;
+ }
+
+ if (source != target)
+ {
+ comparisonContext.AddOpenApiDifference(new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ OpenApiComparedElementType = typeof(Uri),
+ SourceValue = source,
+ TargetValue = target,
+ Pointer = comparisonContext.PathString
+ });
+ }
+ }
+
///
/// Compares two boolean object.
///
@@ -138,6 +166,67 @@ internal void Compare(Enum source, Enum target, ComparisonContext compari
}
}
+ ///
+ /// Compares where TKey is and TValue is
+ /// .
+ ///
+ /// The source.
+ /// The target.
+ /// The context under which to compare the objects.
+ internal void Compare(IDictionary source, IDictionary target,
+ ComparisonContext comparisonContext)
+ {
+ if (source == null && target == null)
+ {
+ return;
+ }
+
+ if (source == null || target == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = source,
+ TargetValue = target,
+ OpenApiComparedElementType = typeof(IDictionary),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ var newKeysInTarget = target.Keys.Except(source.Keys).ToList();
+
+ foreach (var newKeyInTarget in newKeysInTarget)
+ {
+ WalkAndAddOpenApiDifference(
+ comparisonContext,
+ newKeyInTarget,
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Add,
+ TargetValue = target[newKeyInTarget],
+ OpenApiComparedElementType = typeof(string)
+ });
+ }
+
+ var removedKeysFromSource = source.Keys.Except(target.Keys).ToList();
+
+ foreach (var removedKeyFromSource in removedKeysFromSource)
+ {
+ WalkAndAddOpenApiDifference(
+ comparisonContext,
+ removedKeyFromSource,
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Remove,
+ SourceValue = source[removedKeyFromSource],
+ OpenApiComparedElementType = typeof(string)
+ });
+ }
+ }
+
///
/// Adds a segment to the context path to enable pointing to the current location in the document.
///
diff --git a/src/Microsoft.OpenApi/Services/OpenApiComparerFactory.cs b/src/Microsoft.OpenApi/Services/OpenApiComparerFactory.cs
index e10f0aa5f..e5c9a7da5 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiComparerFactory.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiComparerFactory.cs
@@ -33,6 +33,10 @@ public class OpenApiComparerFactory
{typeof(IDictionary), new OpenApiDictionaryComparer()},
{typeof(IDictionary), new OpenApiDictionaryComparer()},
{typeof(IDictionary), new OpenApiDictionaryComparer()},
+ {
+ typeof(IDictionary),
+ new OpenApiDictionaryComparer()
+ },
{typeof(OpenApiHeader), new OpenApiHeaderComparer()},
{typeof(OpenApiRequestBody), new OpenApiRequestBodyComparer()},
{typeof(OpenApiResponse), new OpenApiResponseComparer()},
@@ -40,7 +44,18 @@ public class OpenApiComparerFactory
{typeof(OpenApiEncoding), new OpenApiEncodingComparer()},
{typeof(IList), new OpenApiServersComparer()},
{typeof(OpenApiServer), new OpenApiServerComparer()},
- {typeof(OpenApiServerVariable), new OpenApiServerVariableComparer()}
+ {typeof(OpenApiServerVariable), new OpenApiServerVariableComparer()},
+ {typeof(OpenApiOAuthFlow), new OpenApiOAuthFlowComparer()},
+ {typeof(OpenApiOAuthFlows), new OpenApiOAuthFlowsComparer()},
+ {typeof(OpenApiSecurityRequirement), new OpenApiSecurityRequirementComparer()},
+ {typeof(OpenApiInfo), new OpenApiInfoComparer()},
+ {typeof(OpenApiContact), new OpenApiContactComparer()},
+ {typeof(OpenApiLicense), new OpenApiLicenseComparer()},
+ {typeof(IList), new OpenApiOrderedListComparer()},
+ {typeof(IList), new OpenApiOrderedListComparer()},
+ {typeof(OpenApiExternalDocs), new OpenApiExternalDocsComparer()},
+ {typeof(OpenApiTag), new OpenApiTagComparer()},
+ {typeof(OpenApiSecurityScheme), new OpenApiSecuritySchemeComparer()}
};
private readonly Dictionary _typeToComparerMap = new Dictionary();
diff --git a/src/Microsoft.OpenApi/Services/OpenApiComponentsComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiComponentsComparer.cs
index bdb2ed3e5..23bdc629f 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiComponentsComparer.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiComponentsComparer.cs
@@ -77,8 +77,14 @@ public override void Compare(
.GetComparer>()
.Compare(sourceComponents.Headers, targetComponents.Headers, comparisonContext));
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.SecuritySchemes,
+ () => comparisonContext
+ .GetComparer>()
+ .Compare(sourceComponents.SecuritySchemes, targetComponents.SecuritySchemes, comparisonContext));
+
// To Do compare Examples
- // To Do compare SecuritySchemes
// To Do compare Links
// To Do compare Callbacks
// To Do compare Extensions
diff --git a/src/Microsoft.OpenApi/Services/OpenApiContactComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiContactComparer.cs
new file mode 100644
index 000000000..06f65c62c
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiContactComparer.cs
@@ -0,0 +1,54 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiContactComparer : OpenApiComparerBase
+ {
+ ///
+ /// Executes comparision against source and target .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(
+ OpenApiContact sourceContact,
+ OpenApiContact targetContact,
+ ComparisonContext comparisonContext)
+ {
+ if (sourceContact == null && targetContact == null)
+ {
+ return;
+ }
+
+ if (sourceContact == null || targetContact == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceContact,
+ TargetValue = targetContact,
+ OpenApiComparedElementType = typeof(OpenApiContact),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Name,
+ () => Compare(sourceContact.Name, targetContact.Name, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Email,
+ () => Compare(sourceContact.Email, targetContact.Email, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Url,
+ () => Compare(sourceContact.Url, targetContact.Url, comparisonContext));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiDictionaryComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiDictionaryComparer.cs
index 0a82ad0b1..34c797f14 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiDictionaryComparer.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiDictionaryComparer.cs
@@ -56,10 +56,8 @@ public override void Compare(
new OpenApiDifference
{
OpenApiDifferenceOperation = OpenApiDifferenceOperation.Add,
- TargetValue = new KeyValuePair(
- newKeyInTarget,
- targetFragment[newKeyInTarget]),
- OpenApiComparedElementType = typeof(KeyValuePair)
+ TargetValue = targetFragment[newKeyInTarget],
+ OpenApiComparedElementType = typeof(T)
});
}
@@ -80,8 +78,8 @@ public override void Compare(
new OpenApiDifference
{
OpenApiDifferenceOperation = OpenApiDifferenceOperation.Remove,
- SourceValue = source,
- OpenApiComparedElementType = typeof(KeyValuePair)
+ SourceValue = source.Value,
+ OpenApiComparedElementType = typeof(T)
});
}
}
diff --git a/src/Microsoft.OpenApi/Services/OpenApiDocumentComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiDocumentComparer.cs
index 41e3dc046..5e1c6ecf5 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiDocumentComparer.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiDocumentComparer.cs
@@ -43,11 +43,34 @@ public override void Compare(
.GetComparer>()
.Compare(sourceDocument.Servers, targetDocument.Servers, comparisonContext));
- // To Do Compare Info
- // To Do Compare Security Requirements
- // To Do Compare Tags
- // To Do Compare External Docs
- // To Do Compare Extensions
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Info,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceDocument.Info, targetDocument.Info, comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Security,
+ () => comparisonContext
+ .GetComparer>()
+ .Compare(sourceDocument.SecurityRequirements, targetDocument.SecurityRequirements,
+ comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Tags,
+ () => comparisonContext
+ .GetComparer>()
+ .Compare(sourceDocument.Tags, targetDocument.Tags, comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.ExternalDocs,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceDocument.ExternalDocs, targetDocument.ExternalDocs, comparisonContext));
}
}
}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiExternalDocsComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiExternalDocsComparer.cs
new file mode 100644
index 000000000..31e9d5bcf
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiExternalDocsComparer.cs
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiExternalDocsComparer : OpenApiComparerBase
+ {
+ ///
+ /// Executes comparision against source and target .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(OpenApiExternalDocs sourceDocs, OpenApiExternalDocs targetDocs,
+ ComparisonContext comparisonContext)
+ {
+ if (sourceDocs == null && targetDocs == null)
+ {
+ return;
+ }
+
+ if (sourceDocs == null || targetDocs == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceDocs,
+ TargetValue = targetDocs,
+ OpenApiComparedElementType = typeof(OpenApiExternalDocs),
+ Pointer = comparisonContext.PathString
+ });
+ return;
+ }
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Description,
+ () => Compare(sourceDocs.Description, targetDocs.Description, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Url,
+ () => Compare(sourceDocs.Url, targetDocs.Url, comparisonContext));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiInfoComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiInfoComparer.cs
new file mode 100644
index 000000000..ec71059dc
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiInfoComparer.cs
@@ -0,0 +1,71 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiInfoComparer : OpenApiComparerBase
+ {
+ ///
+ /// Executes comparision against source and target .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(
+ OpenApiInfo sourceInfo,
+ OpenApiInfo targetInfo,
+ ComparisonContext comparisonContext)
+ {
+ if (sourceInfo == null && targetInfo == null)
+ {
+ return;
+ }
+
+ if (sourceInfo == null || targetInfo == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceInfo,
+ TargetValue = targetInfo,
+ OpenApiComparedElementType = typeof(OpenApiInfo),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Title,
+ () => Compare(sourceInfo.Title, targetInfo.Title, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Description,
+ () => Compare(sourceInfo.Description, targetInfo.Description, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.TermsOfService,
+ () => Compare(sourceInfo.TermsOfService, targetInfo.TermsOfService, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Version,
+ () => Compare(sourceInfo.Version, targetInfo.Version, comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Contact,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceInfo.Contact, targetInfo.Contact, comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.License,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceInfo.License, targetInfo.License, comparisonContext));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiLicenseComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiLicenseComparer.cs
new file mode 100644
index 000000000..be61db7c8
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiLicenseComparer.cs
@@ -0,0 +1,51 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiLicenseComparer : OpenApiComparerBase
+ {
+ ///
+ /// Executes comparision against source and target .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(
+ OpenApiLicense sourceLicense,
+ OpenApiLicense targetLicense,
+ ComparisonContext comparisonContext)
+ {
+ if (sourceLicense == null && targetLicense == null)
+ {
+ return;
+ }
+
+ if (sourceLicense == null || targetLicense == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceLicense,
+ TargetValue = targetLicense,
+ OpenApiComparedElementType = typeof(OpenApiLicense),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Name,
+ () => Compare(sourceLicense.Name, targetLicense.Name, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Url,
+ () => Compare(sourceLicense.Url, targetLicense.Url, comparisonContext));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiOAuthFlowComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiOAuthFlowComparer.cs
new file mode 100644
index 000000000..cfee18a60
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiOAuthFlowComparer.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiOAuthFlowComparer : OpenApiComparerBase
+ {
+ ///
+ /// Executes comparision against source and target .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(OpenApiOAuthFlow sourceFlow, OpenApiOAuthFlow targetFlow,
+ ComparisonContext comparisonContext)
+ {
+ if (sourceFlow == null && targetFlow == null)
+ {
+ return;
+ }
+
+ if (sourceFlow == null || targetFlow == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceFlow,
+ TargetValue = targetFlow,
+ OpenApiComparedElementType = typeof(OpenApiOAuthFlow),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.AuthorizationUrl,
+ () => Compare(sourceFlow.AuthorizationUrl, targetFlow.AuthorizationUrl, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.TokenUrl,
+ () => Compare(sourceFlow.TokenUrl, targetFlow.TokenUrl, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.RefreshUrl,
+ () => Compare(sourceFlow.RefreshUrl, targetFlow.RefreshUrl, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Scopes,
+ () => Compare(sourceFlow.Scopes, targetFlow.Scopes, comparisonContext));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiOAuthFlowsComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiOAuthFlowsComparer.cs
new file mode 100644
index 000000000..9334bc9b0
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiOAuthFlowsComparer.cs
@@ -0,0 +1,73 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiOAuthFlowsComparer : OpenApiComparerBase
+ {
+ ///
+ /// Executes comparision against source and target .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(
+ OpenApiOAuthFlows sourceFlows,
+ OpenApiOAuthFlows targetFlows,
+ ComparisonContext comparisonContext)
+ {
+ if (sourceFlows == null && targetFlows == null)
+ {
+ return;
+ }
+
+ if (sourceFlows == null || targetFlows == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceFlows,
+ TargetValue = targetFlows,
+ OpenApiComparedElementType = typeof(OpenApiOAuthFlows),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Implicit,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceFlows.Implicit, targetFlows.Implicit, comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Password,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceFlows.Password, targetFlows.Password, comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.ClientCredentials,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceFlows.ClientCredentials, targetFlows.ClientCredentials, comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.AuthorizationCode,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceFlows.AuthorizationCode, targetFlows.AuthorizationCode, comparisonContext));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiOperationComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiOperationComparer.cs
index 98879e013..354e36906 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiOperationComparer.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiOperationComparer.cs
@@ -69,11 +69,28 @@ public override void Compare(
.GetComparer>()
.Compare(sourceOperation?.Servers, targetOperation?.Servers, comparisonContext));
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Tags,
+ () => comparisonContext
+ .GetComparer>()
+ .Compare(sourceOperation?.Tags, targetOperation?.Tags, comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Security,
+ () => comparisonContext
+ .GetComparer>()
+ .Compare(sourceOperation?.Security, targetOperation?.Security, comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.ExternalDocs,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceOperation?.ExternalDocs, targetOperation?.ExternalDocs, comparisonContext));
+
// Compare CallBack
- // Compare Security Requirements
- // Compare Extensions
- // Compare External Docs
- // Compare Tags
}
}
}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiOperationsComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiOperationsComparer.cs
index 0aace1a3e..d64351302 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiOperationsComparer.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiOperationsComparer.cs
@@ -56,10 +56,8 @@ public override void Compare(
new OpenApiDifference
{
OpenApiDifferenceOperation = OpenApiDifferenceOperation.Add,
- TargetValue = new KeyValuePair(
- newOperationKeyInTarget,
- targetOperations[newOperationKeyInTarget]),
- OpenApiComparedElementType = typeof(KeyValuePair)
+ TargetValue = targetOperations[newOperationKeyInTarget],
+ OpenApiComparedElementType = typeof(OpenApiOperation)
});
}
@@ -80,8 +78,8 @@ public override void Compare(
new OpenApiDifference
{
OpenApiDifferenceOperation = OpenApiDifferenceOperation.Remove,
- SourceValue = sourceOperation,
- OpenApiComparedElementType = typeof(KeyValuePair)
+ SourceValue = sourceOperation.Value,
+ OpenApiComparedElementType = typeof(OpenApiOperation)
});
}
}
diff --git a/src/Microsoft.OpenApi/Services/OpenApiOrderedListComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiOrderedListComparer.cs
new file mode 100644
index 000000000..405f06e21
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiOrderedListComparer.cs
@@ -0,0 +1,90 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using System.Collections.Generic;
+using Microsoft.OpenApi.Interfaces;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing where T is .
+ ///
+ public class OpenApiOrderedListComparer : OpenApiComparerBase> where T : IOpenApiSerializable
+ {
+ ///
+ /// Executes comparision against based on the order of the list for source and target
+ /// where T is .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(
+ IList sourceFragment,
+ IList targetFragment,
+ ComparisonContext comparisonContext)
+ {
+ if (sourceFragment == null && targetFragment == null)
+ {
+ return;
+ }
+
+ if (sourceFragment == null || targetFragment == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceFragment,
+ TargetValue = sourceFragment,
+ OpenApiComparedElementType = typeof(IList),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ for (var i = 0; i < sourceFragment.Count; i++)
+ {
+ if (i >= targetFragment.Count)
+ {
+ WalkAndAddOpenApiDifference(
+ comparisonContext,
+ i.ToString(),
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Remove,
+ SourceValue = sourceFragment[i],
+ OpenApiComparedElementType = typeof(T)
+ });
+ }
+ else
+ {
+ WalkAndCompare(comparisonContext,
+ i.ToString(),
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceFragment[i], targetFragment[i], comparisonContext));
+ }
+ }
+
+ if (targetFragment.Count <= sourceFragment.Count)
+ {
+ return;
+ }
+
+ // Loop through remaining elements in target that are not in source.
+ for (var i = sourceFragment.Count; i < targetFragment.Count; i++)
+ {
+ WalkAndAddOpenApiDifference(
+ comparisonContext,
+ i.ToString(),
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Add,
+ TargetValue = targetFragment[i],
+ OpenApiComparedElementType = typeof(T)
+ });
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiParameterComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiParameterComparer.cs
index 53d3e6619..ee4df45cf 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiParameterComparer.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiParameterComparer.cs
@@ -42,6 +42,9 @@ public override void Compare(
return;
}
+ new OpenApiReferenceComparer()
+ .Compare(sourceParameter.Reference, targetParameter.Reference, comparisonContext);
+
WalkAndCompare(
comparisonContext,
OpenApiConstants.Content,
@@ -83,7 +86,6 @@ public override void Compare(
.GetComparer()
.Compare(sourceParameter.Schema, targetParameter.Schema, comparisonContext));
- // To Do Add compare for reference object
// To Do Compare Examples
// To Do Compare parameter as IOpenApiExtensible
}
diff --git a/src/Microsoft.OpenApi/Services/OpenApiReferenceComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiReferenceComparer.cs
new file mode 100644
index 000000000..9a819db08
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiReferenceComparer.cs
@@ -0,0 +1,72 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.OpenApi.Interfaces;
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiReferenceComparer : OpenApiComparerBase where T : IOpenApiReferenceable
+ {
+ ///
+ /// Compares object.
+ ///
+ /// The source.
+ /// The target.
+ /// The context under which to compare the objects.
+ public override void Compare(
+ OpenApiReference sourceReference,
+ OpenApiReference targetReference,
+ ComparisonContext comparisonContext)
+ {
+ if (sourceReference == null && targetReference == null)
+ {
+ return;
+ }
+
+ if (sourceReference == null || targetReference == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceReference,
+ TargetValue = targetReference,
+ OpenApiComparedElementType = typeof(OpenApiReference),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ if (sourceReference.Id != targetReference.Id || sourceReference.Type != targetReference.Type)
+ {
+ WalkAndAddOpenApiDifference(
+ comparisonContext,
+ OpenApiConstants.DollarRef,
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceReference,
+ TargetValue = targetReference,
+ OpenApiComparedElementType = typeof(OpenApiReference)
+ });
+
+ return;
+ }
+
+ var source = (T) comparisonContext.SourceDocument.ResolveReference(
+ sourceReference);
+
+ var target = (T) comparisonContext.TargetDocument.ResolveReference(
+ targetReference);
+
+ comparisonContext
+ .GetComparer()
+ .Compare(source, target, comparisonContext);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiRequestBodyComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiRequestBodyComparer.cs
index 880c654cf..d3ca3fc65 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiRequestBodyComparer.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiRequestBodyComparer.cs
@@ -42,35 +42,8 @@ public override void Compare(
return;
}
- if (sourceRequestBody.Reference != null
- && targetRequestBody.Reference != null
- && sourceRequestBody.Reference.Id != targetRequestBody.Reference.Id)
- {
- WalkAndAddOpenApiDifference(
- comparisonContext,
- OpenApiConstants.DollarRef,
- new OpenApiDifference
- {
- OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
- SourceValue = sourceRequestBody.Reference,
- TargetValue = targetRequestBody.Reference,
- OpenApiComparedElementType = typeof(OpenApiReference)
- });
-
- return;
- }
-
- if (sourceRequestBody.Reference != null)
- {
- sourceRequestBody = (OpenApiRequestBody) comparisonContext.SourceDocument.ResolveReference(
- sourceRequestBody.Reference);
- }
-
- if (targetRequestBody.Reference != null)
- {
- targetRequestBody = (OpenApiRequestBody) comparisonContext.TargetDocument.ResolveReference(
- targetRequestBody.Reference);
- }
+ new OpenApiReferenceComparer()
+ .Compare(sourceRequestBody.Reference, targetRequestBody.Reference, comparisonContext);
WalkAndCompare(comparisonContext, OpenApiConstants.Description,
() => Compare(sourceRequestBody.Description, targetRequestBody.Description, comparisonContext));
diff --git a/src/Microsoft.OpenApi/Services/OpenApiSchemaComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiSchemaComparer.cs
index e320854fd..5d9561209 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiSchemaComparer.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiSchemaComparer.cs
@@ -2,7 +2,6 @@
// Licensed under the MIT license.
using System.Collections.Generic;
-using System.Linq;
using Microsoft.OpenApi.Models;
namespace Microsoft.OpenApi.Services
@@ -52,6 +51,36 @@ public override void Compare(
comparisonContext.SourceSchemaLoop.Push(sourceSchema);
comparisonContext.TargetSchemaLoop.Push(targetSchema);
+ if (sourceSchema.Reference != null
+ && targetSchema.Reference != null
+ && sourceSchema.Reference.Id != targetSchema.Reference.Id)
+ {
+ WalkAndAddOpenApiDifference(
+ comparisonContext,
+ OpenApiConstants.DollarRef,
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceSchema.Reference?.Id,
+ TargetValue = targetSchema.Reference?.Id,
+ OpenApiComparedElementType = typeof(string)
+ });
+
+ return;
+ }
+
+ if (sourceSchema.Reference != null)
+ {
+ sourceSchema = (OpenApiSchema) comparisonContext.SourceDocument.ResolveReference(
+ sourceSchema.Reference);
+ }
+
+ if (targetSchema.Reference != null)
+ {
+ targetSchema = (OpenApiSchema) comparisonContext.TargetDocument.ResolveReference(
+ targetSchema.Reference);
+ }
+
WalkAndCompare(
comparisonContext,
OpenApiConstants.Title,
@@ -115,96 +144,23 @@ public override void Compare(
.Compare(sourceSchema.Items, targetSchema.Items, comparisonContext));
}
- if (sourceSchema.Reference != null
- && targetSchema.Reference != null
- && sourceSchema.Reference.Id != targetSchema.Reference.Id)
- {
- WalkAndAddOpenApiDifference(
- comparisonContext,
- OpenApiConstants.DollarRef,
- new OpenApiDifference
- {
- OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
- SourceValue = sourceSchema.Reference?.Id,
- TargetValue = targetSchema.Reference?.Id,
- OpenApiComparedElementType = typeof(string)
- });
-
- return;
- }
-
- if (sourceSchema.Reference != null)
- {
- sourceSchema = (OpenApiSchema) comparisonContext.SourceDocument.ResolveReference(
- sourceSchema.Reference);
- }
-
- if (targetSchema.Reference != null)
- {
- targetSchema = (OpenApiSchema) comparisonContext.TargetDocument.ResolveReference(
- targetSchema.Reference);
- }
-
- if (targetSchema.Properties != null)
- {
- IEnumerable newPropertiesInTarget = sourceSchema.Properties == null
- ? targetSchema.Properties.Keys
- : targetSchema.Properties.Keys.Except(sourceSchema.Properties.Keys)
- .ToList();
-
- WalkAndCompare(comparisonContext, OpenApiConstants.Properties, () =>
- {
- foreach (var newPropertyInTarget in newPropertiesInTarget)
- {
- WalkAndAddOpenApiDifference(
- comparisonContext,
- newPropertyInTarget,
- new OpenApiDifference
- {
- OpenApiDifferenceOperation = OpenApiDifferenceOperation.Add,
- TargetValue = new KeyValuePair(newPropertyInTarget,
- targetSchema.Properties[newPropertyInTarget]),
- OpenApiComparedElementType = typeof(KeyValuePair)
- });
- }
- });
- }
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Properties,
+ () => comparisonContext
+ .GetComparer>()
+ .Compare(sourceSchema.Properties,
+ targetSchema.Properties, comparisonContext));
- if (sourceSchema.Properties != null)
- {
- WalkAndCompare(comparisonContext, OpenApiConstants.Properties, () =>
- {
- foreach (var sourceSchemaProperty in sourceSchema.Properties)
- {
- if (targetSchema.Properties.ContainsKey(sourceSchemaProperty.Key))
- {
- WalkAndCompare(
- comparisonContext,
- sourceSchemaProperty.Key,
- () => comparisonContext
- .GetComparer()
- .Compare(sourceSchemaProperty.Value,
- targetSchema.Properties[sourceSchemaProperty.Key], comparisonContext));
- }
- else
- {
- WalkAndAddOpenApiDifference(
- comparisonContext,
- sourceSchemaProperty.Key,
- new OpenApiDifference
- {
- OpenApiDifferenceOperation = OpenApiDifferenceOperation.Remove,
- SourceValue = sourceSchemaProperty,
- OpenApiComparedElementType = typeof(KeyValuePair)
- });
- }
- }
- });
- }
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.ExternalDocs,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceSchema?.ExternalDocs, targetSchema?.ExternalDocs, comparisonContext));
// To Do Compare schema.AllOf
// To Do Compare schema.AnyOf
- // To Do compare external Docs
// To Do compare schema as IOpenApiExtensible
comparisonContext.SourceSchemaLoop.Pop();
diff --git a/src/Microsoft.OpenApi/Services/OpenApiSecurityRequirementComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiSecurityRequirementComparer.cs
new file mode 100644
index 000000000..c9e5422e7
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiSecurityRequirementComparer.cs
@@ -0,0 +1,92 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiSecurityRequirementComparer : OpenApiComparerBase
+ {
+ ///
+ /// Executes comparision against source and target .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(
+ OpenApiSecurityRequirement sourceSecurityRequirement,
+ OpenApiSecurityRequirement targetSecurityRequirement,
+ ComparisonContext comparisonContext)
+ {
+ if (sourceSecurityRequirement == null && targetSecurityRequirement == null)
+ {
+ return;
+ }
+
+ if (sourceSecurityRequirement == null || targetSecurityRequirement == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceSecurityRequirement,
+ TargetValue = targetSecurityRequirement,
+ OpenApiComparedElementType = typeof(OpenApiSecurityRequirement),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ var newSecuritySchemesInTarget = targetSecurityRequirement.Keys
+ .Where(targetReq => sourceSecurityRequirement.Keys.All(
+ sourceReq => sourceReq.Reference.Id != targetReq.Reference.Id)).ToList();
+
+ foreach (var newSecuritySchemeInTarget in newSecuritySchemesInTarget)
+ {
+ WalkAndAddOpenApiDifference(
+ comparisonContext,
+ newSecuritySchemeInTarget.Reference.Id,
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Add,
+ TargetValue = targetSecurityRequirement[newSecuritySchemeInTarget],
+ OpenApiComparedElementType = typeof(IList)
+ });
+ }
+
+ foreach (var sourceSecurityScheme in sourceSecurityRequirement.Keys)
+ {
+ var targetSecurityScheme =
+ targetSecurityRequirement.Keys.FirstOrDefault(
+ i => i.Reference.Id == sourceSecurityScheme.Reference.Id);
+
+ if (targetSecurityScheme == null)
+ {
+ WalkAndAddOpenApiDifference(
+ comparisonContext,
+ sourceSecurityScheme.Reference.Id,
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Remove,
+ SourceValue = sourceSecurityRequirement[sourceSecurityScheme],
+ OpenApiComparedElementType = typeof(IList)
+ });
+ }
+ else
+ {
+ WalkAndCompare(comparisonContext,
+ sourceSecurityScheme.Reference.Id,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceSecurityScheme, targetSecurityScheme, comparisonContext));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiSecuritySchemeComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiSecuritySchemeComparer.cs
new file mode 100644
index 000000000..bdee35bf4
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiSecuritySchemeComparer.cs
@@ -0,0 +1,80 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiSecuritySchemeComparer : OpenApiComparerBase
+ {
+ ///
+ /// Executes comparision against source and target .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(
+ OpenApiSecurityScheme sourcecSecurityScheme,
+ OpenApiSecurityScheme targetSecurityScheme,
+ ComparisonContext comparisonContext)
+ {
+ if (sourcecSecurityScheme == null && targetSecurityScheme == null)
+ {
+ return;
+ }
+
+ if (sourcecSecurityScheme == null || targetSecurityScheme == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourcecSecurityScheme,
+ TargetValue = targetSecurityScheme,
+ OpenApiComparedElementType = typeof(OpenApiSecurityScheme),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ new OpenApiReferenceComparer()
+ .Compare(sourcecSecurityScheme.Reference, targetSecurityScheme.Reference,
+ comparisonContext);
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Description,
+ () => Compare(sourcecSecurityScheme.Description, targetSecurityScheme.Description, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Type,
+ () => Compare(sourcecSecurityScheme.Type, targetSecurityScheme.Type,
+ comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Name,
+ () => Compare(sourcecSecurityScheme.Name, targetSecurityScheme.Name, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.In,
+ () => Compare(sourcecSecurityScheme.In, targetSecurityScheme.In, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Scheme,
+ () => Compare(sourcecSecurityScheme.Scheme, targetSecurityScheme.Scheme, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.BearerFormat,
+ () => Compare(sourcecSecurityScheme.BearerFormat, targetSecurityScheme.BearerFormat,
+ comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.OpenIdConnectUrl,
+ () => Compare(sourcecSecurityScheme.OpenIdConnectUrl, targetSecurityScheme.OpenIdConnectUrl,
+ comparisonContext));
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.Flows,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourcecSecurityScheme.Flows, targetSecurityScheme.Flows, comparisonContext));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.OpenApi/Services/OpenApiTagComparer.cs b/src/Microsoft.OpenApi/Services/OpenApiTagComparer.cs
new file mode 100644
index 000000000..6290f38f3
--- /dev/null
+++ b/src/Microsoft.OpenApi/Services/OpenApiTagComparer.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using Microsoft.OpenApi.Models;
+
+namespace Microsoft.OpenApi.Services
+{
+ ///
+ /// Defines behavior for comparing properties of .
+ ///
+ public class OpenApiTagComparer : OpenApiComparerBase
+ {
+ ///
+ /// Executes comparision against source and target .
+ ///
+ /// The source.
+ /// The target.
+ /// Context under which to compare the source and target.
+ public override void Compare(OpenApiTag sourceTag, OpenApiTag targetTag, ComparisonContext comparisonContext)
+ {
+ if (sourceTag == null && targetTag == null)
+ {
+ return;
+ }
+
+ if (sourceTag == null || targetTag == null)
+ {
+ comparisonContext.AddOpenApiDifference(
+ new OpenApiDifference
+ {
+ OpenApiDifferenceOperation = OpenApiDifferenceOperation.Update,
+ SourceValue = sourceTag,
+ TargetValue = targetTag,
+ OpenApiComparedElementType = typeof(OpenApiTag),
+ Pointer = comparisonContext.PathString
+ });
+
+ return;
+ }
+
+ WalkAndCompare(
+ comparisonContext,
+ OpenApiConstants.ExternalDocs,
+ () => comparisonContext
+ .GetComparer()
+ .Compare(sourceTag.ExternalDocs, targetTag.ExternalDocs, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Description,
+ () => Compare(sourceTag.Description, targetTag.Description, comparisonContext));
+
+ WalkAndCompare(comparisonContext, OpenApiConstants.Name,
+ () => Compare(sourceTag.Name, targetTag.Name, comparisonContext));
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiComparerTestCases.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiComparerTestCases.cs
index 7728a7932..7471440a5 100644
--- a/test/Microsoft.OpenApi.Tests/Services/OpenApiComparerTestCases.cs
+++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiComparerTestCases.cs
@@ -150,21 +150,17 @@ public static IEnumerable