diff --git a/diff/discriminator_diff.go b/diff/discriminator_diff.go index c0d24b29..acbb466f 100644 --- a/diff/discriminator_diff.go +++ b/diff/discriminator_diff.go @@ -2,6 +2,7 @@ package diff import ( "github.com/getkin/kin-openapi/openapi3" + "github.com/tufin/oasdiff/utils" ) // DiscriminatorDiff describes the changes between a pair of discriminator objects: https://swagger.io/specification/#discriminator-object @@ -60,7 +61,7 @@ func getDiscriminatorDiffInternal(config *Config, state *state, discriminator1, return nil, err } result.PropertyNameDiff = getValueDiff(discriminator1.PropertyName, discriminator2.PropertyName) - result.MappingDiff = getStringMapDiff(discriminator1.Mapping, discriminator2.Mapping) + result.MappingDiff = getStringMapDiff(utils.StringMap(discriminator1.Mapping), utils.StringMap(discriminator2.Mapping)) return result, nil } diff --git a/diff/oauth_flow.go b/diff/oauth_flow.go index 4befb6a7..a6ee119f 100644 --- a/diff/oauth_flow.go +++ b/diff/oauth_flow.go @@ -60,7 +60,7 @@ func getOAuthFlowDiffInternal(config *Config, state *state, flow1, flow2 *openap result.AuthorizationURLDiff = getValueDiff(flow1.AuthorizationURL, flow2.AuthorizationURL) result.TokenURLDiff = getValueDiff(flow1.TokenURL, flow2.TokenURL) result.RefreshURLDiff = getValueDiff(flow1.RefreshURL, flow2.RefreshURL) - result.ScopesDiff = getStringMapDiff(flow1.Scopes, flow2.Scopes) + result.ScopesDiff = getScopesDiff(flow1.Scopes, flow2.Scopes) return &result, nil } diff --git a/diff/scopes.go b/diff/scopes.go new file mode 100644 index 00000000..6ceab60f --- /dev/null +++ b/diff/scopes.go @@ -0,0 +1,16 @@ +package diff + +import ( + "github.com/getkin/kin-openapi/openapi3" + "github.com/tufin/oasdiff/utils" +) + +func getScopesDiff(scopes1, scopes2 openapi3.StringMap) *StringMapDiff { + diff := getStringMapDiff(utils.StringMap(scopes1), utils.StringMap(scopes2)) + + if diff.Empty() { + return nil + } + + return diff +} diff --git a/go.mod b/go.mod index acdd0e3e..cbec1ab3 100644 --- a/go.mod +++ b/go.mod @@ -2,11 +2,11 @@ module github.com/tufin/oasdiff go 1.22.5 -replace gopkg.in/yaml.v3 => github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe +replace gopkg.in/yaml.v3 => github.com/oasdiff/yaml3 v0.0.0-20240920135353-c185dc6ea7c6 -replace github.com/invopop/yaml => github.com/oasdiff/yaml v0.0.0-20240822113848-2830227c9671 +replace github.com/invopop/yaml => github.com/oasdiff/yaml v0.0.0-20240920191703-3e5a9fb5bdf3 -replace github.com/getkin/kin-openapi => github.com/oasdiff/kin-openapi v0.0.0-20240822114340-77f909bcefa1 +replace github.com/getkin/kin-openapi => github.com/oasdiff/kin-openapi v0.0.0-20240921075217-8a00ba059558 require ( cloud.google.com/go v0.115.0 diff --git a/go.sum b/go.sum index 7df205fe..3fb115b7 100644 --- a/go.sum +++ b/go.sum @@ -41,14 +41,14 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/oasdiff/kin-openapi v0.0.0-20240822114340-77f909bcefa1 h1:ljShh904MDrvao/PtQTzfaAnonDA3tYupY9R5NuuL8w= -github.com/oasdiff/kin-openapi v0.0.0-20240822114340-77f909bcefa1/go.mod h1:dttoAiKGJ89CXBRPozVnlbkS6QI2CA1bL2uziw1uQmE= +github.com/oasdiff/kin-openapi v0.0.0-20240921075217-8a00ba059558 h1:aIfXRW0EbLKQsUA9RdAcIDvShF6I4DqQO3viCFEpnzw= +github.com/oasdiff/kin-openapi v0.0.0-20240921075217-8a00ba059558/go.mod h1:5MaNKmkfVAFfhyQtzgwYLynYAHgFA0KSykwF6+NoGMc= github.com/oasdiff/telemetry v0.1.2 h1:hkmA5YTISVF2/zWa23y29WdPws1Q53pyLOFYMHXoZ1U= github.com/oasdiff/telemetry v0.1.2/go.mod h1:Y0DaW/CasxZ+vzR54btj430XsL6DGF+rMbJkRld6u3M= -github.com/oasdiff/yaml v0.0.0-20240822113848-2830227c9671 h1:qM2AH1Js3b+0wWCE5SrfSwa/rIXtqMyQZyXx3YaIb5Q= -github.com/oasdiff/yaml v0.0.0-20240822113848-2830227c9671/go.mod h1:/hkd7qQO7Qp3G9ytouXHWapZeeq18qNBkyNAHDpqR1U= -github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe h1:sHb5QDQFoFYvM+Ebq0Bo2JC27+U8oHM8Mm50oBwBtnQ= -github.com/oasdiff/yaml3 v0.0.0-20240819204501-233901bce7fe/go.mod h1:lqlOfJRrYpgeWHQj+ky2tf7UJ3PzgHTHRQEpc90nbp0= +github.com/oasdiff/yaml v0.0.0-20240920191703-3e5a9fb5bdf3 h1:nqCxALSUgWobWkFGIrhLRzR/bpImQdGj+3JS4/scTJo= +github.com/oasdiff/yaml v0.0.0-20240920191703-3e5a9fb5bdf3/go.mod h1:AOyUNV9ElKz7EEZeBm/48U54UtjtgCMT9fFbZEsClQc= +github.com/oasdiff/yaml3 v0.0.0-20240920135353-c185dc6ea7c6 h1:+ZsuDTdapTJxfMQk7SOJiNMg0v36pui01L7FEO615r8= +github.com/oasdiff/yaml3 v0.0.0-20240920135353-c185dc6ea7c6/go.mod h1:lqlOfJRrYpgeWHQj+ky2tf7UJ3PzgHTHRQEpc90nbp0= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s=