mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 12:37:49 +00:00
@@ -1675,3 +1675,32 @@ parameters:
|
|||||||
assert.Len(t, extChanges.GetAllChanges(), 1)
|
assert.Len(t, extChanges.GetAllChanges(), 1)
|
||||||
assert.Equal(t, 1, extChanges.TotalBreakingChanges())
|
assert.Equal(t, 1, extChanges.TotalBreakingChanges())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestComparePathItem_V2_AddRequiredParam(t *testing.T) {
|
||||||
|
|
||||||
|
left := `operationId: listBurgerDressings`
|
||||||
|
|
||||||
|
right := `operationId: listBurgerDressings
|
||||||
|
parameters:
|
||||||
|
- in: head
|
||||||
|
name: burgerId
|
||||||
|
required: true`
|
||||||
|
|
||||||
|
var lNode, rNode yaml.Node
|
||||||
|
_ = yaml.Unmarshal([]byte(left), &lNode)
|
||||||
|
_ = yaml.Unmarshal([]byte(right), &rNode)
|
||||||
|
|
||||||
|
// create low level objects
|
||||||
|
var lDoc v2.Operation
|
||||||
|
var rDoc v2.Operation
|
||||||
|
_ = low.BuildModel(lNode.Content[0], &lDoc)
|
||||||
|
_ = low.BuildModel(rNode.Content[0], &rDoc)
|
||||||
|
_ = lDoc.Build(context.Background(), nil, lNode.Content[0], nil)
|
||||||
|
_ = rDoc.Build(context.Background(), nil, rNode.Content[0], nil)
|
||||||
|
|
||||||
|
// compare.
|
||||||
|
extChanges := CompareOperations(&lDoc, &rDoc)
|
||||||
|
assert.Equal(t, 1, extChanges.TotalChanges())
|
||||||
|
assert.Len(t, extChanges.GetAllChanges(), 1)
|
||||||
|
assert.Equal(t, 1, extChanges.TotalBreakingChanges())
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user