Skip to content

Commit

Permalink
adding schema to oneOf is breaking (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
reuvenharrison authored Sep 25, 2024
1 parent 95604f1 commit 451d054
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions checker/check_response_property_one_of_updated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/tufin/oasdiff/load"
)

// CL: adding 'oneOf' schema to the response body or response body property
// BC: adding 'oneOf' schema to the response body or response body property is breaking
func TestResponsePropertyOneOfAdded(t *testing.T) {
s1, err := open("../data/checker/response_property_one_of_added_base.yaml")
require.NoError(t, err)
Expand All @@ -26,7 +26,7 @@ func TestResponsePropertyOneOfAdded(t *testing.T) {
{
Id: checker.ResponseBodyOneOfAddedId,
Args: []any{"#/components/schemas/Rabbit", "200"},
Level: checker.INFO,
Level: checker.ERR,
Operation: "GET",
Path: "/pets",
Source: load.NewSource("../data/checker/response_property_one_of_added_revision.yaml"),
Expand All @@ -35,7 +35,7 @@ func TestResponsePropertyOneOfAdded(t *testing.T) {
{
Id: checker.ResponsePropertyOneOfAddedId,
Args: []any{"#/components/schemas/Breed3", "/oneOf[#/components/schemas/Dog]/breed", "200"},
Level: checker.INFO,
Level: checker.ERR,
Operation: "GET",
Path: "/pets",
Source: load.NewSource("../data/checker/response_property_one_of_added_revision.yaml"),
Expand All @@ -44,7 +44,7 @@ func TestResponsePropertyOneOfAdded(t *testing.T) {
{
Id: checker.ResponsePropertyOneOfAddedId,
Args: []any{"subschema #2: Dark brown types", "/oneOf[#/components/schemas/Fox]/breed", "200"},
Level: checker.INFO,
Level: checker.ERR,
Operation: "GET",
Path: "/pets",
Source: load.NewSource("../data/checker/response_property_one_of_added_revision.yaml"),
Expand Down
4 changes: 2 additions & 2 deletions checker/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,9 @@ func GetAllRules() BackwardCompatibilityRules {
newBackwardCompatibilityRule(ResponseBodyMinLengthDecreasedId, ERR, ResponsePropertyMinLengthDecreasedCheck, DirectionResponse, LocationBody, ActionDecrease),
newBackwardCompatibilityRule(ResponsePropertyMinLengthDecreasedId, ERR, ResponsePropertyMinLengthDecreasedCheck, DirectionResponse, LocationProperties, ActionDecrease),
// ResponsePropertyOneOfUpdated
newBackwardCompatibilityRule(ResponseBodyOneOfAddedId, INFO, ResponsePropertyOneOfUpdated, DirectionResponse, LocationBody, ActionAdd),
newBackwardCompatibilityRule(ResponseBodyOneOfAddedId, ERR, ResponsePropertyOneOfUpdated, DirectionResponse, LocationBody, ActionAdd),
newBackwardCompatibilityRule(ResponseBodyOneOfRemovedId, INFO, ResponsePropertyOneOfUpdated, DirectionResponse, LocationBody, ActionRemove),
newBackwardCompatibilityRule(ResponsePropertyOneOfAddedId, INFO, ResponsePropertyOneOfUpdated, DirectionResponse, LocationProperties, ActionAdd),
newBackwardCompatibilityRule(ResponsePropertyOneOfAddedId, ERR, ResponsePropertyOneOfUpdated, DirectionResponse, LocationProperties, ActionAdd),
newBackwardCompatibilityRule(ResponsePropertyOneOfRemovedId, INFO, ResponsePropertyOneOfUpdated, DirectionResponse, LocationProperties, ActionRemove),
// ResponsePropertyTypeChangedCheck
newBackwardCompatibilityRule(ResponseBodyTypeChangedId, ERR, ResponsePropertyTypeChangedCheck, DirectionResponse, LocationBody, ActionChange),
Expand Down
2 changes: 1 addition & 1 deletion docs/BREAKING-CHANGES-EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ These examples are automatically generated from unit tests.
[Deleting a value from an x-extensible-enum parameter is breaking](../checker/check_request_parameter_x_extensible_enum_value_removed_test.go?plain=1#L11)
[Deleting a value from an x-extensible-enum property is breaking](../checker/check_request_property_x_extensible_enum_value_removed_test.go?plain=1#L11)
[adding 'allOf' subschema to the request body or request body property is breaking](../checker/check_breaking_test.go?plain=1#L727)
[adding 'oneOf' schema to the response body or response body property is breaking](../checker/check_response_property_one_of_updated_test.go?plain=1#L12)
[adding a new required property in request body is breaking](../checker/check_breaking_property_test.go?plain=1#L353)
[adding a pattern to a schema is breaking for recursive properties](../checker/check_breaking_test.go?plain=1#L490)
[adding a pattern to a schema is breaking](../checker/check_breaking_test.go?plain=1#L473)
Expand Down Expand Up @@ -174,7 +175,6 @@ These examples are automatically generated from unit tests.
[adding 'anyOf' schema to the request body or request body property](../checker/check_request_property_any_of_updated_test.go?plain=1#L12)
[adding 'anyOf' schema to the response body or response body property](../checker/check_response_property_any_of_updated_test.go?plain=1#L12)
[adding 'oneOf' schema to the request body or request body property](../checker/check_request_property_one_of_updated_test.go?plain=1#L12)
[adding 'oneOf' schema to the response body or response body property](../checker/check_response_property_one_of_updated_test.go?plain=1#L12)
[adding a new global security to the API](../checker/check_api_security_updated_test.go?plain=1#L12)
[adding a new media type to request body](../checker/check_request_body_mediatype_updated_test.go?plain=1#L12)
[adding a new media type to response](../checker/check_response_mediatype_updated_test.go?plain=1#L12)
Expand Down

0 comments on commit 451d054

Please sign in to comment.