diff --git a/BREAKING-CHANGES-EXAMPLES.md b/BREAKING-CHANGES-EXAMPLES.md index 8acfff54..ba7c1749 100644 --- a/BREAKING-CHANGES-EXAMPLES.md +++ b/BREAKING-CHANGES-EXAMPLES.md @@ -40,7 +40,7 @@ These examples are automatically generated from unit tests. [deleting a media-type from response is breaking](checker/checker_breaking_test.go?plain=1#L448) [deleting a non-required non-write-only property in response body is breaking with warning](checker/checker_breaking_property_test.go?plain=1#L511) [deleting a path is breaking](checker/checker_breaking_test.go?plain=1#L43) -[deleting a path with some operations having sunset date in the future is breaking](checker/checker_deprecation_test.go?plain=1#L280) +[deleting a path with some operations having sunset date in the future is breaking](checker/checker_deprecation_test.go?plain=1#L281) [deleting a required property in request is breaking with warn](checker/checker_breaking_property_test.go?plain=1#L368) [deleting a required property in response body is breaking](checker/checker_breaking_property_test.go?plain=1#L420) [deleting a required property under AllOf in response body is breaking](checker/checker_breaking_property_test.go?plain=1#L450) @@ -49,7 +49,7 @@ These examples are automatically generated from unit tests. [deleting an operation before sunset date is breaking](checker/checker_deprecation_test.go?plain=1#L33) [deleting an operation is breaking](checker/checker_breaking_test.go?plain=1#L51) [deleting an operation without sunset date is breaking](checker/checker_deprecation_test.go?plain=1#L51) -[deleting sunset header for a deprecated endpoint is breaking](checker/checker_deprecation_test.go?plain=1#L298) +[deleting sunset header for a deprecated endpoint is breaking](checker/checker_deprecation_test.go?plain=1#L299) [deprecating an operation with a deprecation policy and sunset date before required deprecation period is breaking](checker/checker_deprecation_test.go?plain=1#L223) [deprecating an operation with a deprecation policy but without specifying sunset date is breaking](checker/checker_deprecation_test.go?plain=1#L84) [increasing max length in response is breaking](checker/checker_breaking_min_max_test.go?plain=1#L93) @@ -114,7 +114,7 @@ These examples are automatically generated from unit tests. [changing response's body schema type from number to integer is not breaking](checker/checker_breaking_response_type_changed_test.go?plain=1#L51) [changing response's body schema type from number/none to integer/int32 is not breaking](checker/checker_breaking_response_type_changed_test.go?plain=1#L89) [changing servers is not breaking](checker/checker_not_breaking_test.go?plain=1#L253) -[deleting a path after sunset date of all contained operations is not breaking](checker/checker_deprecation_test.go?plain=1#L265) +[deleting a path after sunset date of all contained operations is not breaking](checker/checker_deprecation_test.go?plain=1#L266) [deleting a pattern from a schema is not breaking](checker/checker_breaking_test.go?plain=1#L465) [deleting a required write-only property in response body is not breaking](checker/checker_breaking_property_test.go?plain=1#L494) [deleting a tag is not breaking](checker/checker_not_breaking_test.go?plain=1#L71) @@ -122,7 +122,7 @@ These examples are automatically generated from unit tests. [deprecating a header is not breaking](checker/checker_not_breaking_test.go?plain=1#L227) [deprecating a parameter is not breaking](checker/checker_not_breaking_test.go?plain=1#L214) [deprecating a schema is not breaking](checker/checker_not_breaking_test.go?plain=1#L240) -[deprecating an operation with a deprecation policy and sunset date after required deprecation period is not breaking](checker/checker_deprecation_test.go?plain=1#L243) +[deprecating an operation with a deprecation policy and sunset date after required deprecation period is not breaking](checker/checker_deprecation_test.go?plain=1#L244) [deprecating an operation without a deprecation policy and without specifying sunset date is not breaking for draft level](checker/checker_deprecation_test.go?plain=1#L158) [deprecating an operation without a deprecation policy and without specifying sunset date is not breaking](checker/checker_deprecation_test.go?plain=1#L104) [increasing max length in request is not breaking](checker/checker_breaking_min_max_test.go?plain=1#L76) @@ -270,8 +270,8 @@ These examples are automatically generated from unit tests. [increasing request property maximum value](checker/check-request-property-max-updated_test.go?plain=1#L37) [new header, query and cookie request params](checker/check-new-request-non-path-parameter_test.go?plain=1#L11) [new paths or path operations](checker/check-api-added_test.go?plain=1#L11) -[path operations that became deprecated](checker/checker_deprecation_test.go?plain=1#L334) -[path operations that were re-activated](checker/checker_deprecation_test.go?plain=1#L357) +[path operations that became deprecated](checker/checker_deprecation_test.go?plain=1#L335) +[path operations that were re-activated](checker/checker_deprecation_test.go?plain=1#L358) [removing 'allOf' subschema from the request body or request body property](checker/check-request-property-all-of-updated_test.go?plain=1#L45) [removing 'allOf' subschema from the response body or response body property](checker/check-response-property-all-of-updated_test.go?plain=1#L45) [removing 'anyOf' schema from the request body or request body property](checker/check-request-property-any-of-updated_test.go?plain=1#L45) diff --git a/checker/checker_deprecation_test.go b/checker/checker_deprecation_test.go index b264cc2e..09927615 100644 --- a/checker/checker_deprecation_test.go +++ b/checker/checker_deprecation_test.go @@ -227,7 +227,8 @@ func TestBreaking_DeprecationWithEarlySunset(t *testing.T) { s2, err := open(getDeprecationFile("deprecated-future.yaml")) require.NoError(t, err) - s2.Spec.Paths.Value("/api/test").Get.Extensions[diff.SunsetExtension] = toJson(t, civil.DateOf(time.Now()).AddDays(9).String()) + sunsetDate := civil.DateOf(time.Now()).AddDays(9).String() + s2.Spec.Paths.Value("/api/test").Get.Extensions[diff.SunsetExtension] = toJson(t, sunsetDate) d, osm, err := diff.GetWithOperationsSourcesMap(getConfig(), s1, s2) require.NoError(t, err) @@ -237,7 +238,7 @@ func TestBreaking_DeprecationWithEarlySunset(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.APISunsetDateTooSmallId, errs[0].GetId()) - require.Equal(t, "api sunset date '2023-12-16' is too small, must be at least '10' days from now", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, fmt.Sprintf("api sunset date '%s' is too small, must be at least '10' days from now", sunsetDate), errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: deprecating an operation with a deprecation policy and sunset date after required deprecation period is not breaking