Describe the bug
Copy constructors doesn't create a new instance of OpenApiPathItem and its constituent properties on new OpenApiDocument(document).
To Reproduce
I have created a breaking test to demonstrate this:
|
[Fact] |
|
public void CopyConstructorForAdvancedDocumentWorks() |
|
{ |
|
// Arrange & Act |
|
var doc = new OpenApiDocument(AdvancedDocument); |
|
|
|
// Change value of operation id for a given url |
|
var docOpId = doc.Paths["/pets"].Operations[OperationType.Get].OperationId = "findAllMyPets"; |
|
var advancedDocOpId = AdvancedDocument.Paths["/pets"].Operations[OperationType.Get].OperationId; |
|
|
|
// 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); |
|
} |
This is in the branch:
is/copy-ctrs
Expected behavior
In the test, I change the operationId of the cloned OpenAPI document. I don't expect the operationId of the original OpenAPI document to also be updated.
Describe the bug
Copy constructors doesn't create a new instance of
OpenApiPathItemand its constituent properties onnew OpenApiDocument(document).To Reproduce
I have created a breaking test to demonstrate this:
OpenAPI.NET/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs
Lines 1341 to 1358 in d5a5f8a
This is in the branch:
is/copy-ctrsExpected behavior
In the test, I change the operationId of the cloned OpenAPI document. I don't expect the
operationIdof the original OpenAPI document to also be updated.