diff --git a/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj b/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj
index e73151943..69597d978 100644
--- a/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj
+++ b/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj
@@ -10,7 +10,7 @@
Microsoft
Microsoft.OpenApi.Readers
Microsoft.OpenApi.Readers
- 1.6.4-preview1
+ 1.6.4-preview2
OpenAPI.NET Readers for JSON and YAML documents
© Microsoft Corporation. All rights reserved.
OpenAPI .NET
diff --git a/src/Microsoft.OpenApi/Helpers/DictionaryCloneHelper.cs b/src/Microsoft.OpenApi/Helpers/DictionaryCloneHelper.cs
new file mode 100644
index 000000000..279e4639d
--- /dev/null
+++ b/src/Microsoft.OpenApi/Helpers/DictionaryCloneHelper.cs
@@ -0,0 +1,36 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.OpenApi.Helpers
+{
+ ///
+ /// Helper class for deep cloning dictionaries.
+ ///
+ internal class DictionaryCloneHelper
+ {
+ ///
+ /// Deep clone key value pairs in a dictionary.
+ ///
+ /// The type of the key of the dictionary.
+ /// The type of the value of the dictionary.
+ /// The target dictionary to clone.
+ /// The cloned dictionary.
+ internal static Dictionary Clone(IDictionary dictionary)
+ {
+ if (dictionary is null) return null;
+ var clonedDictionary = new Dictionary(dictionary.Keys.Count);
+
+ foreach (var kvp in dictionary)
+ {
+ // Create instance of the specified type using the constructor matching the specified parameter types.
+ clonedDictionary[kvp.Key] = (U)Activator.CreateInstance(kvp.Value.GetType(), kvp.Value);
+ }
+
+
+ return clonedDictionary;
+ }
+ }
+}
diff --git a/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj b/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
index 86f49db98..c996acbaf 100644
--- a/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
+++ b/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
@@ -11,7 +11,7 @@
Microsoft
Microsoft.OpenApi
Microsoft.OpenApi
- 1.6.4-preview1
+ 1.6.4-preview2
.NET models with JSON and YAML writers for OpenAPI specification
© Microsoft Corporation. All rights reserved.
OpenAPI .NET
diff --git a/src/Microsoft.OpenApi/Models/OpenApiCallback.cs b/src/Microsoft.OpenApi/Models/OpenApiCallback.cs
index 2dcae12d1..b25ed8578 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiCallback.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiCallback.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Expressions;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
diff --git a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs
index 1f41080bc..9a397b1b0 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs
@@ -1,10 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
-using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -78,15 +77,15 @@ public OpenApiComponents() { }
///
public OpenApiComponents(OpenApiComponents components)
{
- Schemas = components?.Schemas != null ? new Dictionary(components.Schemas) : null;
- Responses = components?.Responses != null ? new Dictionary(components.Responses) : null;
- Parameters = components?.Parameters != null ? new Dictionary(components.Parameters) : null;
- Examples = components?.Examples != null ? new Dictionary(components.Examples) : null;
- RequestBodies = components?.RequestBodies != null ? new Dictionary(components.RequestBodies) : null;
- Headers = components?.Headers != null ? new Dictionary(components.Headers) : null;
- SecuritySchemes = components?.SecuritySchemes != null ? new Dictionary(components.SecuritySchemes) : null;
- Links = components?.Links != null ? new Dictionary(components.Links) : null;
- Callbacks = components?.Callbacks != null ? new Dictionary(components.Callbacks) : null;
+ Schemas = DictionaryCloneHelper.Clone(components?.Schemas);
+ Responses = DictionaryCloneHelper.Clone(components?.Responses);
+ Parameters = DictionaryCloneHelper.Clone(components?.Parameters);
+ Examples = DictionaryCloneHelper.Clone(components?.Examples);
+ RequestBodies = DictionaryCloneHelper.Clone(components?.RequestBodies);
+ Headers = DictionaryCloneHelper.Clone(components?.Headers);
+ SecuritySchemes = DictionaryCloneHelper.Clone(components?.SecuritySchemes);
+ Links = DictionaryCloneHelper.Clone(components?.Links);
+ Callbacks = DictionaryCloneHelper.Clone(components?.Callbacks);
Extensions = components?.Extensions != null ? new Dictionary(components.Extensions) : null;
}
diff --git a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs
index 5177e4f45..2bf5dd2f2 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs
@@ -8,6 +8,7 @@
using System.Security.Cryptography;
using System.Text;
using Microsoft.OpenApi.Exceptions;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Services;
using Microsoft.OpenApi.Writers;
diff --git a/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs b/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs
index ddb4162bc..94c8e5888 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -64,7 +65,7 @@ public OpenApiEncoding() {}
public OpenApiEncoding(OpenApiEncoding encoding)
{
ContentType = encoding?.ContentType ?? ContentType;
- Headers = encoding?.Headers != null ? new Dictionary(encoding.Headers) : null;
+ Headers = DictionaryCloneHelper.Clone(encoding?.Headers);
Style = encoding?.Style ?? Style;
Explode = encoding?.Explode ?? Explode;
AllowReserved = encoding?.AllowReserved ?? AllowReserved;
diff --git a/src/Microsoft.OpenApi/Models/OpenApiExample.cs b/src/Microsoft.OpenApi/Models/OpenApiExample.cs
index 4d091a361..d8ac064c0 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiExample.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiExample.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
diff --git a/src/Microsoft.OpenApi/Models/OpenApiHeader.cs b/src/Microsoft.OpenApi/Models/OpenApiHeader.cs
index fb4411478..91882aade 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiHeader.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiHeader.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -107,8 +108,8 @@ public OpenApiHeader(OpenApiHeader header)
AllowReserved = header?.AllowReserved ?? AllowReserved;
Schema = header?.Schema != null ? new(header?.Schema) : null;
Example = OpenApiAnyCloneHelper.CloneFromCopyConstructor(header?.Example);
- Examples = header?.Examples != null ? new Dictionary(header.Examples) : null;
- Content = header?.Content != null ? new Dictionary(header.Content) : null;
+ Examples = DictionaryCloneHelper.Clone(header?.Examples);
+ Content = DictionaryCloneHelper.Clone(header?.Content);
Extensions = header?.Extensions != null ? new Dictionary(header.Extensions) : null;
}
diff --git a/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs b/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs
index 63a58cd02..a8a0497f4 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -55,8 +56,8 @@ public OpenApiMediaType(OpenApiMediaType mediaType)
{
Schema = mediaType?.Schema != null ? new(mediaType?.Schema) : null;
Example = OpenApiAnyCloneHelper.CloneFromCopyConstructor(mediaType?.Example);
- Examples = mediaType?.Examples != null ? new Dictionary(mediaType.Examples) : null;
- Encoding = mediaType?.Encoding != null ? new Dictionary(mediaType.Encoding) : null;
+ Examples = DictionaryCloneHelper.Clone(mediaType?.Examples);
+ Encoding = DictionaryCloneHelper.Clone(mediaType?.Encoding);
Extensions = mediaType?.Extensions != null ? new Dictionary(mediaType.Extensions) : null;
}
diff --git a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs
index a1d822a8e..526e4c7ca 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -124,7 +125,7 @@ public OpenApiOperation(OpenApiOperation operation)
Parameters = operation?.Parameters != null ? new List(operation.Parameters) : null;
RequestBody = operation?.RequestBody != null ? new(operation?.RequestBody) : null;
Responses = operation?.Responses != null ? new(operation?.Responses) : null;
- Callbacks = operation?.Callbacks != null ? new Dictionary(operation.Callbacks) : null;
+ Callbacks = DictionaryCloneHelper.Clone(operation?.Callbacks);
Deprecated = operation?.Deprecated ?? Deprecated;
Security = operation?.Security != null ? new List(operation.Security) : null;
Servers = operation?.Servers != null ? new List(operation.Servers) : null;
diff --git a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs
index 616422165..e140e1f35 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs
@@ -6,6 +6,7 @@
using System.Runtime;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -162,9 +163,9 @@ public OpenApiParameter(OpenApiParameter parameter)
Explode = parameter?.Explode ?? Explode;
AllowReserved = parameter?.AllowReserved ?? AllowReserved;
Schema = parameter?.Schema != null ? new(parameter?.Schema) : null;
- Examples = parameter?.Examples != null ? new Dictionary(parameter.Examples) : null;
+ Examples = DictionaryCloneHelper.Clone(parameter?.Examples);
Example = OpenApiAnyCloneHelper.CloneFromCopyConstructor(parameter?.Example);
- Content = parameter?.Content != null ? new Dictionary(parameter.Content) : null;
+ Content = DictionaryCloneHelper.Clone(parameter?.Content);
Extensions = parameter?.Extensions != null ? new Dictionary(parameter.Extensions) : null;
AllowEmptyValue = parameter?.AllowEmptyValue ?? AllowEmptyValue;
Deprecated = parameter?.Deprecated ?? Deprecated;
diff --git a/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs b/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs
index ddd358dc2..a669c67bc 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs
@@ -1,8 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
+using System;
using System.Collections.Generic;
using Microsoft.OpenApi.Extensions;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -77,7 +79,7 @@ public OpenApiPathItem(OpenApiPathItem pathItem)
{
Summary = pathItem?.Summary ?? Summary;
Description = pathItem?.Description ?? Description;
- Operations = pathItem?.Operations != null ? new Dictionary(pathItem.Operations) : null;
+ Operations = DictionaryCloneHelper.Clone(pathItem?.Operations);
Servers = pathItem?.Servers != null ? new List(pathItem.Servers) : null;
Parameters = pathItem?.Parameters != null ? new List(pathItem.Parameters) : null;
Extensions = pathItem?.Extensions != null ? new Dictionary(pathItem.Extensions) : null;
diff --git a/src/Microsoft.OpenApi/Models/OpenApiPaths.cs b/src/Microsoft.OpenApi/Models/OpenApiPaths.cs
index 9b48b4908..53f56c5ad 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiPaths.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiPaths.cs
@@ -1,6 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using Microsoft.OpenApi.Helpers;
+
namespace Microsoft.OpenApi.Models
{
///
@@ -17,6 +22,6 @@ public OpenApiPaths() {}
/// Initializes a copy of object
///
/// The .
- public OpenApiPaths(OpenApiPaths paths) : base(dictionary: paths) {}
+ public OpenApiPaths(OpenApiPaths paths) : base(DictionaryCloneHelper.Clone(paths)) { }
}
}
diff --git a/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs b/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs
index 70f1f742a..10603256c 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -61,7 +62,7 @@ public OpenApiRequestBody(OpenApiRequestBody requestBody)
Reference = requestBody?.Reference != null ? new(requestBody?.Reference) : null;
Description = requestBody?.Description ?? Description;
Required = requestBody?.Required ?? Required;
- Content = requestBody?.Content != null ? new Dictionary(requestBody.Content) : null;
+ Content = DictionaryCloneHelper.Clone(requestBody?.Content);
Extensions = requestBody?.Extensions != null ? new Dictionary(requestBody.Extensions) : null;
}
diff --git a/src/Microsoft.OpenApi/Models/OpenApiResponse.cs b/src/Microsoft.OpenApi/Models/OpenApiResponse.cs
index a173f6c1a..958f20f61 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiResponse.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiResponse.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -62,9 +63,9 @@ public OpenApiResponse() {}
public OpenApiResponse(OpenApiResponse response)
{
Description = response?.Description ?? Description;
- Headers = response?.Headers != null ? new Dictionary(response.Headers) : null;
- Content = response?.Content != null ? new Dictionary(response.Content) : null;
- Links = response?.Links != null ? new Dictionary(response.Links) : null;
+ Headers = DictionaryCloneHelper.Clone(response?.Headers);
+ Content = DictionaryCloneHelper.Clone(response?.Content);
+ Links = DictionaryCloneHelper.Clone(response?.Links);
Extensions = response?.Extensions != null ? new Dictionary(response.Extensions) : null;
UnresolvedReference = response?.UnresolvedReference ?? UnresolvedReference;
Reference = response?.Reference != null ? new(response?.Reference) : null;
diff --git a/src/Microsoft.OpenApi/Models/OpenApiResponses.cs b/src/Microsoft.OpenApi/Models/OpenApiResponses.cs
index aa7a8c984..86b484408 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiResponses.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiResponses.cs
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
+using Microsoft.OpenApi.Helpers;
+
namespace Microsoft.OpenApi.Models
{
///
@@ -17,6 +19,6 @@ public OpenApiResponses() { }
/// Initializes a copy of object
///
/// The
- public OpenApiResponses(OpenApiResponses openApiResponses) : base(dictionary: openApiResponses) {}
+ public OpenApiResponses(OpenApiResponses openApiResponses) : base(DictionaryCloneHelper.Clone(openApiResponses)) {}
}
}
diff --git a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs
index 0176ea1d9..0b1722bc4 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -276,7 +277,7 @@ public OpenApiSchema(OpenApiSchema schema)
MaxItems = schema?.MaxItems ?? MaxItems;
MinItems = schema?.MinItems ?? MinItems;
UniqueItems = schema?.UniqueItems ?? UniqueItems;
- Properties = schema?.Properties != null ? new Dictionary(schema.Properties) : null;
+ Properties = DictionaryCloneHelper.Clone(schema?.Properties);
MaxProperties = schema?.MaxProperties ?? MaxProperties;
MinProperties = schema?.MinProperties ?? MinProperties;
AdditionalPropertiesAllowed = schema?.AdditionalPropertiesAllowed ?? AdditionalPropertiesAllowed;
diff --git a/src/Microsoft.OpenApi/Models/OpenApiServer.cs b/src/Microsoft.OpenApi/Models/OpenApiServer.cs
index b3b1d1287..8f9baed45 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiServer.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiServer.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -48,7 +49,7 @@ public OpenApiServer(OpenApiServer server)
{
Description = server?.Description ?? Description;
Url = server?.Url ?? Url;
- Variables = server?.Variables != null ? new Dictionary(server.Variables) : null;
+ Variables = DictionaryCloneHelper.Clone(server?.Variables);
Extensions = server?.Extensions != null ? new Dictionary(server.Extensions) : null;
}
diff --git a/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs b/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs
index c8e2da03f..9f4ccb8be 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs
@@ -26,7 +26,7 @@ public class OpenApiUrlTreeNode
///
/// The relative directory path of the current node from the root node.
///
- public string Path { get; private set; } = "";
+ public string Path { get; set; } = "";
///
/// Dictionary of labels and Path Item objects that describe the operations available on a node.
diff --git a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj
index fb7ee1bd6..89c2bacf2 100644
--- a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj
+++ b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj
@@ -28,7 +28,7 @@
-
+
all
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs
index c4876db7a..ceed06bb9 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs
@@ -12,6 +12,7 @@
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Readers;
+using Microsoft.OpenApi.Services;
using Microsoft.OpenApi.Writers;
using VerifyXunit;
using Xunit;
@@ -1344,12 +1345,19 @@ public void CopyConstructorForAdvancedDocumentWorks()
// Arrange & Act
var doc = new OpenApiDocument(AdvancedDocument);
+ var docOpId = doc.Paths["/pets"].Operations[OperationType.Get].OperationId = "findAllMyPets";
+ var advancedDocOpId = AdvancedDocument.Paths["/pets"].Operations[OperationType.Get].OperationId;
+ var responseSchemaTypeCopy = doc.Paths["/pets"].Operations[OperationType.Get].Responses["200"].Content["application/json"].Schema.Type = "object";
+ var advancedDocResponseSchemaType = AdvancedDocument.Paths["/pets"].Operations[OperationType.Get].Responses["200"].Content["application/json"].Schema.Type;
+
// Assert
Assert.NotNull(doc.Info);
Assert.NotNull(doc.Servers);
Assert.NotNull(doc.Paths);
Assert.Equal(2, doc.Paths.Count);
Assert.NotNull(doc.Components);
+ Assert.NotEqual(docOpId, advancedDocOpId);
+ Assert.NotEqual(responseSchemaTypeCopy, advancedDocResponseSchemaType);
}
[Fact]
diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt
index 63cd0f535..d993a259e 100755
--- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt
+++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt
@@ -1111,7 +1111,7 @@ namespace Microsoft.OpenApi.Services
public System.Collections.Generic.IDictionary> AdditionalData { get; set; }
public System.Collections.Generic.IDictionary Children { get; }
public bool IsParameter { get; }
- public string Path { get; }
+ public string Path { get; set; }
public System.Collections.Generic.IDictionary PathItems { get; }
public string Segment { get; }
public void AddAdditionalData(System.Collections.Generic.Dictionary> additionalData) { }