@@ -11,6 +11,7 @@ import (
1111 "strings"
1212 "testing"
1313
14+ whatChangedModel "github.com/pb33f/libopenapi/what-changed/model"
1415 htmlReport "github.com/pb33f/openapi-changes/html-report"
1516 "github.com/pb33f/openapi-changes/model"
1617 "github.com/stretchr/testify/assert"
@@ -273,6 +274,27 @@ func TestBuildHTMLReportItems_SplitsStandardAndChangeExplorerGraphs(t *testing.T
273274 assert .Contains (t , explorerNodeWithChildChanges , "childChanges" , "change explorer nodes render change summaries" )
274275}
275276
277+ func TestBuildHTMLReportItems_ComposedSchemaTitleRemovalPreservesPropertyLabel (t * testing.T ) {
278+ leftPath , rightPath := createComposedSchemaTitleRemovalSpecPair (t , "allOf" )
279+
280+ commits , err := loadLeftRightCommits (leftPath , rightPath , summaryOpts {noColor : true })
281+ require .NoError (t , err )
282+ require .Len (t , commits , 1 )
283+
284+ items , err := buildHTMLReportItems (commits , nil )
285+ require .NoError (t , err )
286+ require .Len (t , items , 1 )
287+
288+ var changes []* whatChangedModel.Change
289+ require .NoError (t , json .Unmarshal (items [0 ].Graph .Changes , & changes ))
290+ require .Len (t , changes , 1 )
291+
292+ assert .Equal (t , "title" , changes [0 ].Property )
293+ assert .Equal (t , "schema" , changes [0 ].Type )
294+ assert .Equal (t , "$.components.schemas['Contract']" , changes [0 ].Path )
295+ assert .NotContains (t , string (items [0 ].Graph .Changes ), `"property":"anyOf"` )
296+ }
297+
276298type newHtmlNodeGraph struct {
277299 Nodes []map [string ]any
278300 Root map [string ]any
0 commit comments