-
Notifications
You must be signed in to change notification settings - Fork 262
Open
Labels
type:bugA broken experienceA broken experience
Description
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:
OpenAPI.NET/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs
Lines 1341 to 1358 in d5a5f8a
[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.
peombwa
Metadata
Metadata
Assignees
Labels
type:bugA broken experienceA broken experience