diff --git a/go.mod b/go.mod index 837c3874..394692fc 100644 --- a/go.mod +++ b/go.mod @@ -148,6 +148,7 @@ require ( github.com/wI2L/jsondiff v0.6.0 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/yargevad/filepathx v1.0.0 // indirect + github.com/yuin/goldmark v1.7.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect diff --git a/go.sum b/go.sum index 7698e3f8..567fbf05 100644 --- a/go.sum +++ b/go.sum @@ -532,6 +532,8 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U= +github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= diff --git a/internal/simplebuild/build.go b/internal/simplebuild/build.go index be603a5d..68c8280c 100644 --- a/internal/simplebuild/build.go +++ b/internal/simplebuild/build.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/tufin/oasdiff/formatters" "io" "net/http" "os" @@ -420,8 +421,17 @@ func CheckBreakingChanges(docs DocSet) error { } } if !breakingChange { - return fmt.Errorf("no breaking change detected between versions %s and %s: \n %s", - prevDoc.VersionDate, currDoc.VersionDate, changes) + formatter, err := formatters.Lookup(string(formatters.FormatText), formatters.FormatterOpts{}) + if err != nil { + return err + } + diffDetails, err := formatter.RenderDiff(diffReport, formatters.RenderOpts{}) + if err != nil { + return err + } + return fmt.Errorf("no breaking changes detected between versions %s and %s, %s should not be created, merge changes into %s\n %s", + prevDoc.VersionDate.Format(time.DateOnly), currDoc.VersionDate.Format(time.DateOnly), + currDoc.VersionDate.Format(time.DateOnly), prevDoc.VersionDate.Format(time.DateOnly), string(diffDetails)) } } return nil