Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies including map abstraction and multi-types in kin-openapi #526

Merged
43,203 changes: 43,203 additions & 0 deletions 2023-02-07.yaml

Large diffs are not rendered by default.

609 changes: 306 additions & 303 deletions BREAKING-CHANGES-EXAMPLES.md

Large diffs are not rendered by default.

89 changes: 0 additions & 89 deletions checker/check-request-parameters-type-changed.go

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestBreaking_NewRequiredProperty(t *testing.T) {

s2.Spec.Paths.Value(installCommandPath).Get.Parameters.GetByInAndName(openapi3.ParameterInHeader, "network-policies").Schema.Value.Properties["courseId"] = &openapi3.SchemaRef{
Value: &openapi3.Schema{
Type: "string",
Type: &openapi3.Types{"string"},
Description: "Unique ID of the course",
},
}
Expand All @@ -43,7 +43,7 @@ func TestBreaking_NewNonRequiredProperty(t *testing.T) {

s2.Spec.Paths.Value(installCommandPath).Get.Parameters.GetByInAndName(openapi3.ParameterInHeader, "network-policies").Schema.Value.Properties["courseId"] = &openapi3.SchemaRef{
Value: &openapi3.Schema{
Type: "string",
Type: &openapi3.Types{"string"},
Description: "Unique ID of the course",
},
}
Expand All @@ -61,7 +61,7 @@ func TestBreaking_PropertyRequiredEnabled(t *testing.T) {

sr := openapi3.SchemaRef{
Value: &openapi3.Schema{
Type: "string",
Type: &openapi3.Types{"string"},
Description: "Unique ID of the course",
},
}
Expand All @@ -87,7 +87,7 @@ func TestBreaking_PropertyRequiredDisabled(t *testing.T) {

sr := openapi3.SchemaRef{
Value: &openapi3.Schema{
Type: "string",
Type: &openapi3.Types{"string"},
Description: "Unique ID of the course",
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package checker_test
import (
"testing"

"github.com/getkin/kin-openapi/openapi3"
"github.com/stretchr/testify/require"
"github.com/tufin/oasdiff/checker"
"github.com/tufin/oasdiff/diff"
Expand All @@ -14,11 +15,11 @@ func TestBreaking_ReqTypeStringToNumber(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "string"
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"string"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "number"
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -34,11 +35,11 @@ func TestBreaking_ReqTypeNumberToString(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "number"
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "string"
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"string"}

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -54,11 +55,11 @@ func TestBreaking_ReqTypeNumberToInteger(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "number"
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "integer"
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"integer"}

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -74,11 +75,11 @@ func TestBreaking_ReqTypeIntegerToNumber(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "integer"
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"integer"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "number"
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -92,11 +93,11 @@ func TestBreaking_ReqTypeNumberToInt32(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "number"
s1.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = "integer"
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"integer"}
s2.Spec.Paths.Value("/test").Post.RequestBody.Value.Content["application/json"].Schema.Value.Format = "int32"

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package checker_test
import (
"testing"

"github.com/getkin/kin-openapi/openapi3"
"github.com/stretchr/testify/require"
"github.com/tufin/oasdiff/checker"
"github.com/tufin/oasdiff/diff"
Expand All @@ -14,11 +15,11 @@ func TestBreaking_RespTypeStringToNumber(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "string"
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"string"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "number"
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -34,11 +35,11 @@ func TestBreaking_RespTypeNumberToString(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "number"
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "string"
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"string"}

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -54,11 +55,11 @@ func TestBreaking_RespTypeNumberToInteger(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "number"
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "integer"
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"integer"}

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -72,11 +73,11 @@ func TestBreaking_RespTypeIntegerToNumber(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "integer"
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"integer"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "number"
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -92,11 +93,11 @@ func TestBreaking_RespTypeNumberToInt32(t *testing.T) {

s1, err := open(file)
require.NoError(t, err)
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "number"
s1.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"number"}

s2, err := open(file)
require.NoError(t, err)
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = "integer"
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type = &openapi3.Types{"integer"}
s2.Spec.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Format = "int32"

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func TestBreaking_ResponseSuccessStatusUpdated(t *testing.T) {
s1 := l(t, 1)
s2 := l(t, 1)

delete(s2.Spec.Paths.Value(securityScorePath).Get.Responses.Map(), "200")
s2.Spec.Paths.Value(securityScorePath).Get.Responses.Delete("200")

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -273,7 +273,7 @@ func TestBreaking_ResponseNonSuccessStatusUpdated(t *testing.T) {
s1 := l(t, 1)
s2 := l(t, 1)

delete(s2.Spec.Paths.Value(securityScorePath).Get.Responses.Map(), "400")
s2.Spec.Paths.Value(securityScorePath).Get.Responses.Delete("400")

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand Down Expand Up @@ -393,7 +393,7 @@ func TestBreaking_ResponseUnparseableStatusRemoved(t *testing.T) {
s1 := l(t, 1)
s2 := l(t, 1)

delete(s2.Spec.Paths.Value(installCommandPath).Get.Responses.Map(), "default")
s2.Spec.Paths.Value(installCommandPath).Get.Responses.Delete("default")

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -409,7 +409,7 @@ func TestBreaking_ResponseErrorStatusRemoved(t *testing.T) {
s1 := l(t, 1)
s2 := l(t, 1)

delete(s2.Spec.Paths.Value(securityScorePath).Get.Responses.Map(), "400")
s2.Spec.Paths.Value(securityScorePath).Get.Responses.Delete("400")

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func TestBreaking_RemovedPathForAlpha(t *testing.T) {
s2, err := open(getDeprecationFile("base-alpha-stability.yaml"))
require.NoError(t, err)

delete(s2.Spec.Paths.Map(), "/api/test")
s2.Spec.Paths.Delete("/api/test")

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -143,7 +143,7 @@ func TestBreaking_RemovedPathForAlphaBreaking(t *testing.T) {
s2, err := open(getDeprecationFile("base-alpha-stability.yaml"))
require.NoError(t, err)

delete(s2.Spec.Paths.Map(), "/api/test")
s2.Spec.Paths.Delete("/api/test")

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestBreaking_RemovedPathForDraft(t *testing.T) {
s2, err := open(getDeprecationFile("base-alpha-stability.yaml"))
require.NoError(t, err)

delete(s2.Spec.Paths.Map(), "/api/test")
s2.Spec.Paths.Delete("/api/test")

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand All @@ -201,7 +201,7 @@ func TestBreaking_RemovedPathForDraftBreaking(t *testing.T) {
s2, err := open(getDeprecationFile("base-alpha-stability.yaml"))
require.NoError(t, err)

delete(s2.Spec.Paths.Map(), "/api/test")
s2.Spec.Paths.Delete("/api/test")

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
Expand Down
Loading
Loading