diff --git a/checker/check_api_removed_test.go b/checker/check_api_removed_test.go index 05f7cdf0..e479c597 100644 --- a/checker/check_api_removed_test.go +++ b/checker/check_api_removed_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// BC: deleting a path is breaking +// BC: deleting a path without deprecation is breaking func TestBreaking_DeletedPath(t *testing.T) { errs := d(t, diff.NewConfig(), 1, 701) require.Len(t, errs, 1) diff --git a/checker/check_request_parameter_removed_test.go b/checker/check_request_parameter_removed_test.go index 17cc9462..b16d9b34 100644 --- a/checker/check_request_parameter_removed_test.go +++ b/checker/check_request_parameter_removed_test.go @@ -58,10 +58,10 @@ func TestBreaking_ParameterDeprecationFuture(t *testing.T) { require.Equal(t, "deleted the 'query' request parameter 'id' before the sunset date '9999-08-10'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing a deprecated parameter with an invalid date is breaking -func TestBreaking_RemoveParameterWithInvalidSunset(t *testing.T) { +// BC: deleting a deprecated parameter without sunset date is not breaking +func TestBreaking_ParameterDeprecationNoSunset(t *testing.T) { - s1, err := open(getParameterDeprecationFile("deprecated-invalid.yaml")) + s1, err := open(getParameterDeprecationFile("deprecated-no-sunset.yaml")) require.NoError(t, err) s2, err := open(getParameterDeprecationFile("sunset.yaml")) @@ -70,14 +70,10 @@ func TestBreaking_RemoveParameterWithInvalidSunset(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) errs := checker.CheckBackwardCompatibility(singleCheckConfig(checker.RequestParameterRemovedCheck), d, osm) - require.NotEmpty(t, errs) - require.Len(t, errs, 1) - require.Equal(t, checker.RequestParameterSunsetParseId, errs[0].GetId()) - require.Equal(t, "failed to parse sunset date for the 'query' request parameter 'id': 'sunset date doesn't conform with RFC3339: invalid-date'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) - require.Equal(t, "../data/param-deprecation/sunset.yaml", errs[0].GetSource()) + require.Empty(t, errs) } -// BC: removing the parameter without a deprecation policy and without specifying sunset date is not breaking for alpha level +// BC: removing a parameter without a deprecation policy and without specifying sunset date is not breaking for alpha level func TestBreaking_RemovedParameterForAlpha(t *testing.T) { s1, err := open(getParameterDeprecationFile("base-alpha-stability.yaml")) require.NoError(t, err) @@ -90,3 +86,22 @@ func TestBreaking_RemovedParameterForAlpha(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Empty(t, errs) } + +// BC: removing a deprecated parameter with an invalid date is breaking +func TestBreaking_RemoveParameterWithInvalidSunset(t *testing.T) { + + s1, err := open(getParameterDeprecationFile("deprecated-invalid.yaml")) + require.NoError(t, err) + + s2, err := open(getParameterDeprecationFile("sunset.yaml")) + require.NoError(t, err) + + d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) + require.NoError(t, err) + errs := checker.CheckBackwardCompatibility(singleCheckConfig(checker.RequestParameterRemovedCheck), d, osm) + require.NotEmpty(t, errs) + require.Len(t, errs, 1) + require.Equal(t, checker.RequestParameterSunsetParseId, errs[0].GetId()) + require.Equal(t, "failed to parse sunset date for the 'query' request parameter 'id': 'sunset date doesn't conform with RFC3339: invalid-date'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "../data/param-deprecation/sunset.yaml", errs[0].GetSource()) +} diff --git a/checker/localizations/localizations.go b/checker/localizations/localizations.go index 7ed82a74..b16db2a6 100644 --- a/checker/localizations/localizations.go +++ b/checker/localizations/localizations.go @@ -1,6 +1,6 @@ // Code generated by go-localize; DO NOT EDIT. // This file was generated by robots at -// 2025-02-04 20:47:40.333085 +0200 IST m=+0.006864167 +// 2025-02-04 21:57:59.510671 +0200 IST m=+0.008341376 package localizations diff --git a/docs/BREAKING-CHANGES-EXAMPLES.md b/docs/BREAKING-CHANGES-EXAMPLES.md index 22aa13be..681124f8 100644 --- a/docs/BREAKING-CHANGES-EXAMPLES.md +++ b/docs/BREAKING-CHANGES-EXAMPLES.md @@ -55,8 +55,8 @@ These examples are automatically generated from unit tests. [deleting a non-required non-write-only property in response body is breaking with warning](../checker/check_breaking_property_test.go?plain=1#L512) [deleting a parameter before sunset date is breaking](../checker/check_request_parameter_removed_test.go?plain=1#L43) [deleting a parameter without deprecation is breaking](../checker/check_request_parameter_removed_test.go?plain=1#L11) -[deleting a path is breaking](../checker/check_api_removed_test.go?plain=1#L12) [deleting a path with some operations having sunset date in the future is breaking](../checker/check_api_removed_test.go?plain=1#L172) +[deleting a path without deprecation is breaking](../checker/check_api_removed_test.go?plain=1#L12) [deleting a required property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L369) [deleting a required property in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L421) [deleting a required property under AllOf in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L451) @@ -91,7 +91,7 @@ These examples are automatically generated from unit tests. [removing 'anyOf' schema from the request body or request body property is breaking](../checker/check_breaking_test.go?plain=1#L660) [removing 'oneOf' schema from the request body or request body property is breaking](../checker/check_breaking_test.go?plain=1#L682) [removing a deprecated enpoint with an invalid date is breaking](../checker/check_api_removed_test.go?plain=1#L213) -[removing a deprecated parameter with an invalid date is breaking](../checker/check_request_parameter_removed_test.go?plain=1#L61) +[removing a deprecated parameter with an invalid date is breaking](../checker/check_request_parameter_removed_test.go?plain=1#L90) [removing a media type from request body is breaking](../checker/check_breaking_test.go?plain=1#L644) [removing a success status is breaking](../checker/check_response_status_updated_test.go?plain=1#L87) [removing an existing optional response header is breaking as warn](../checker/check_breaking_test.go?plain=1#L398) @@ -144,6 +144,7 @@ These examples are automatically generated from unit tests. [changing servers is not breaking](../checker/check_not_breaking_test.go?plain=1#L252) [decreasing maxItems of common request parameters without --flatten-params is not breaking](../checker/check_request_parameters_max_items_updated_test.go?plain=1#L57) [deleting a deprecated operation without sunset date is not breaking](../checker/check_api_removed_test.go?plain=1#L69) +[deleting a deprecated parameter without sunset date is not breaking](../checker/check_request_parameter_removed_test.go?plain=1#L61) [deleting a parameter after sunset date is not breaking](../checker/check_request_parameter_removed_test.go?plain=1#L28) [deleting a path after sunset date of all contained operations is not breaking](../checker/check_api_removed_test.go?plain=1#L157) [deleting a path with deprecated operations without sunset date is not breaking](../checker/check_api_removed_test.go?plain=1#L190) @@ -181,9 +182,9 @@ These examples are automatically generated from unit tests. [reducing max length in response is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L31) [reducing min items in request is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L206) [reducing min length in request is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L48) +[removing a parameter without a deprecation policy and without specifying sunset date is not breaking for alpha level](../checker/check_request_parameter_removed_test.go?plain=1#L76) [removing an existing response with error status is not breaking](../checker/check_breaking_test.go?plain=1#L382) [removing an existing response with unparseable status is not breaking](../checker/check_breaking_test.go?plain=1#L366) -[removing the parameter without a deprecation policy and without specifying sunset date is not breaking for alpha level](../checker/check_request_parameter_removed_test.go?plain=1#L80) [removing the path without a deprecation policy and without specifying sunset date is not breaking for alpha level](../checker/check_api_removed_test.go?plain=1#L87) [removing the path without a deprecation policy and without specifying sunset date is not breaking for draft level](../checker/check_api_removed_test.go?plain=1#L106) [renaming a path parameter is not breaking](../checker/check_breaking_test.go?plain=1#L112)