From 4cc205eea0c381e63ad3a58ae769b2da24db6b92 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Wed, 28 Aug 2024 17:03:02 +0300 Subject: [PATCH 01/26] updated messages and fixed tests --- checker/check_api_security_updated_test.go | 16 +- checker/check_breaking_property_test.go | 11 +- ...heck_breaking_request_type_changed_test.go | 10 +- ...eck_breaking_response_type_changed_test.go | 8 +- checker/check_breaking_test.go | 68 +-- .../check_components_security_updated_test.go | 16 +- checker/check_request_body_became_enum.go | 4 +- checker/check_request_body_enum_deleted.go | 4 +- ...heck_request_parameter_became_enum_test.go | 2 +- ...parameter_pattern_added_or_changed_test.go | 6 +- ...ck_request_parameters_type_changed_test.go | 14 +- .../check_request_property_all_of_updated.go | 10 +- ...ck_request_property_all_of_updated_test.go | 80 +-- .../check_request_property_any_of_updated.go | 10 +- ...ck_request_property_any_of_updated_test.go | 80 +-- ...k_request_property_became_not_nuallable.go | 6 +- ...uest_property_became_not_nuallable_test.go | 4 +- ...eck_request_property_enum_value_updated.go | 6 +- ...equest_property_enum_value_updated_test.go | 12 +- ...eck_request_property_max_length_updated.go | 10 +- ...equest_property_max_length_updated_test.go | 17 +- ...eck_request_property_min_length_updated.go | 10 +- ...equest_property_min_length_updated_test.go | 12 +- .../check_request_property_one_of_updated.go | 10 +- ...ck_request_property_one_of_updated_test.go | 80 +-- ...quest_property_pattern_added_or_changed.go | 8 +- ..._property_pattern_added_or_changed_test.go | 12 +- ...check_request_property_required_updated.go | 8 +- ..._request_property_required_updated_test.go | 9 +- .../check_request_property_type_changed.go | 4 +- ...heck_request_property_type_changed_test.go | 29 +- ..._response_pattern_added_or_changed_test.go | 6 +- ...ired_property_write_only_read_only_test.go | 4 +- checker/example_test.go | 2 +- checker/localizations/localizations.go | 468 ++++++++--------- checker/localizations_src/en/messages.yaml | 478 +++++++++--------- data/ignore-err-example.txt | 6 +- 37 files changed, 798 insertions(+), 742 deletions(-) diff --git a/checker/check_api_security_updated_test.go b/checker/check_api_security_updated_test.go index 70cfe244..16a281fc 100644 --- a/checker/check_api_security_updated_test.go +++ b/checker/check_api_security_updated_test.go @@ -25,7 +25,7 @@ func TestAPIGlobalSecurityyAdded(t *testing.T) { Args: []any{"petstore_auth"}, Level: checker.INFO, }, errs[0]) - require.Equal(t, "the security scheme 'petstore_auth' was added to the API", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "security scheme 'petstore_auth' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a global security from the API @@ -44,7 +44,7 @@ func TestAPIGlobalSecurityyDeleted(t *testing.T) { Args: []any{"petstore_auth"}, Level: checker.INFO, }, errs[0]) - require.Equal(t, "the security scheme 'petstore_auth' was removed from the API", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "security scheme 'petstore_auth' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a security scope from an API global security @@ -64,7 +64,7 @@ func TestAPIGlobalSecurityScopeRemoved(t *testing.T) { Args: []any{"read:pets", "petstore_auth"}, Level: checker.INFO, }, errs[0]) - require.Equal(t, "the security scope 'read:pets' was removed from the global security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "security scope 'read:pets' was removed from global security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a security scope from an API global security @@ -84,7 +84,7 @@ func TestAPIGlobalSecurityScopeAdded(t *testing.T) { Args: []any{"read:pets", "petstore_auth"}, Level: checker.INFO, }, errs[0]) - require.Equal(t, "the security scope 'read:pets' was added to the global security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "security scope 'read:pets' was added to global security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a new security to the API endpoint @@ -106,7 +106,7 @@ func TestAPISecurityAdded(t *testing.T) { Path: "/subscribe", Source: load.NewSource("../data/checker/api_security_added_revision.yaml"), }, errs[0]) - require.Equal(t, "the endpoint scheme security 'petstore_auth' was added to the API", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "endpoint scheme security 'petstore_auth' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a new security to the API endpoint @@ -128,7 +128,7 @@ func TestAPISecurityDeleted(t *testing.T) { Path: "/subscribe", Source: load.NewSource("../data/checker/api_security_added_base.yaml"), }, errs[0]) - require.Equal(t, "the endpoint scheme security 'petstore_auth' was removed from the API", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "endpoint scheme security 'petstore_auth' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a security scope from an API endpoint security @@ -150,7 +150,7 @@ func TestAPISecurityScopeRemoved(t *testing.T) { Path: "/subscribe", Source: load.NewSource("../data/checker/api_security_updated_revision.yaml"), }, errs[0]) - require.Equal(t, "the security scope 'read:pets' was removed from the endpoint's security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "security scope 'read:pets' was removed from endpoint security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a security scope to an API endpoint security @@ -172,5 +172,5 @@ func TestAPISecurityScopeAdded(t *testing.T) { Path: "/subscribe", Source: load.NewSource("../data/checker/api_security_updated_base.yaml"), }, errs[0]) - require.Equal(t, "the security scope 'read:pets' was added to the endpoint's security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "security scope 'read:pets' was added to endpoint security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_breaking_property_test.go b/checker/check_breaking_property_test.go index f1df2f99..ac501413 100644 --- a/checker/check_breaking_property_test.go +++ b/checker/check_breaking_property_test.go @@ -591,7 +591,8 @@ func TestBreaking_Body(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyBecameRequiredId, errs[0].GetId()) - require.Equal(t, []interface{}{"id"}, errs[0].GetArgs()) + require.Equal(t, []interface{}{"id", "application/json"}, errs[0].GetArgs()) + require.Equal(t, "request property 'id' of media-type 'application/json' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing property in request body items to required is breaking @@ -608,7 +609,8 @@ func TestBreaking_Items(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyBecameRequiredId, errs[0].GetId()) - require.Equal(t, []interface{}{"/items/id"}, errs[0].GetArgs()) + require.Equal(t, []interface{}{"/items/id", "application/json"}, errs[0].GetArgs()) + require.Equal(t, "request property '/items/id' of media-type 'application/json' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing property in request body items to required with a default value is not breaking @@ -639,6 +641,7 @@ func TestBreaking_AnyOf(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyBecameRequiredId, errs[0].GetId()) + require.Equal(t, "request property '/anyOf[subschema #1]/id' of media-type 'application/json' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing property under another property in request body to required is breaking @@ -655,6 +658,7 @@ func TestBreaking_NestedProp(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyBecameRequiredId, errs[0].GetId()) + require.Equal(t, "request property 'id/userId' of media-type 'application/json' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing a response property to optional under AllOf, AnyOf or OneOf is breaking @@ -669,4 +673,7 @@ func TestBreaking_OneOf(t *testing.T) { require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 3) + require.Equal(t, "property '/allOf[#/components/schemas/ProblemSchema]/changedProperty' became optional for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "property '/anyOf[#/components/schemas/ProblemSchema]/changedProperty' became optional for response status '200'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "property '/oneOf[#/components/schemas/ProblemSchema]/changedProperty' became optional for response status '200'", errs[2].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_breaking_request_type_changed_test.go b/checker/check_breaking_request_type_changed_test.go index dbe3658a..f7adbd96 100644 --- a/checker/check_breaking_request_type_changed_test.go +++ b/checker/check_breaking_request_type_changed_test.go @@ -26,7 +26,7 @@ func TestBreaking_ReqTypeStringToNumber(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, checker.RequestBodyTypeChangedId, errs[0].GetId()) - require.Equal(t, "the request's body type/format changed from 'string'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'string'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing request's body schema type from number to string is breaking @@ -46,7 +46,7 @@ func TestBreaking_ReqTypeNumberToString(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, checker.RequestBodyTypeChangedId, errs[0].GetId()) - require.Equal(t, "the request's body type/format changed from 'number'/'' to 'string'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'number'/'' to 'string'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing request's body schema type from number to integer is breaking @@ -66,7 +66,7 @@ func TestBreaking_ReqTypeNumberToInteger(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, checker.RequestBodyTypeChangedId, errs[0].GetId()) - require.Equal(t, "the request's body type/format changed from 'number'/'' to 'integer'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'number'/'' to 'integer'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing request's body schema type from integer to number is not breaking @@ -86,7 +86,7 @@ func TestBreaking_ReqTypeIntegerToNumber(t *testing.T) { errs := checker.CheckBackwardCompatibilityUntilLevel(allChecksConfig(), d, osm, checker.INFO) require.Len(t, errs, 1) require.Equal(t, checker.RequestBodyTypeGeneralizedId, errs[0].GetId()) - require.Equal(t, "the request's body type/format was generalized from 'integer'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "type/format of media-type 'application/json' of request body was generalized from 'integer'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing request's body schema type from number/none to integer/int32 is breaking @@ -107,5 +107,5 @@ func TestBreaking_ReqTypeNumberToInt32(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, checker.RequestBodyTypeChangedId, errs[0].GetId()) - require.Equal(t, "the request's body type/format changed from 'number'/'' to 'integer'/'int32'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'number'/'' to 'integer'/'int32'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_breaking_response_type_changed_test.go b/checker/check_breaking_response_type_changed_test.go index 2c6cb178..e9f5248a 100644 --- a/checker/check_breaking_response_type_changed_test.go +++ b/checker/check_breaking_response_type_changed_test.go @@ -26,7 +26,7 @@ func TestBreaking_RespTypeStringToNumber(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, checker.ResponseBodyTypeChangedId, errs[0].GetId()) - require.Equal(t, "the response's body type/format changed from 'string'/'' to 'number'/'' for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "body type/format changed from 'string'/'' to 'number'/'' for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing response's body schema type from number to string is breaking @@ -46,7 +46,7 @@ func TestBreaking_RespTypeNumberToString(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, checker.ResponseBodyTypeChangedId, errs[0].GetId()) - require.Equal(t, "the response's body type/format changed from 'number'/'' to 'string'/'' for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "body type/format changed from 'number'/'' to 'string'/'' for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing response's body schema type from number to integer is not breaking @@ -84,7 +84,7 @@ func TestBreaking_RespTypeIntegerToNumber(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, checker.ResponseBodyTypeChangedId, errs[0].GetId()) - require.Equal(t, "the response's body type/format changed from 'integer'/'' to 'number'/'' for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "body type/format changed from 'integer'/'' to 'number'/'' for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing response's body schema type from number/none to integer/int32 is not breaking @@ -119,5 +119,5 @@ func TestBreaking_RespTypeChanged(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, "response-property-type-changed", errs[0].GetId()) - require.Equal(t, "the '/items/testField' response's property type/format changed from 'string'/'' to 'integer'/'int32' for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "'/items/testField' response property type/format changed from 'string'/'' to 'integer'/'int32' for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_breaking_test.go b/checker/check_breaking_test.go index a48dc683..8f36c863 100644 --- a/checker/check_breaking_test.go +++ b/checker/check_breaking_test.go @@ -104,7 +104,7 @@ func TestBreaking_DeletedEnum(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterEnumValueRemovedId, errs[0].GetId()) - require.Equal(t, "removed the enum value 'removed-value' from the 'path' request parameter 'domain'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed enum value 'removed-value' from the 'path' request parameter 'domain'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: added an enum value to response breaking @@ -113,9 +113,9 @@ func TestBreaking_AddedResponseEnum(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 2) require.Equal(t, checker.ResponsePropertyEnumValueAddedId, errs[0].GetId()) - require.Equal(t, "added the new 'QWE' enum value to the 'respenum' response property for the response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added 'QWE' enum value to the 'respenum' response property for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.ResponsePropertyEnumValueAddedId, errs[1].GetId()) - require.Equal(t, "added the new 'TER2' enum value to the 'respenum2/respenum3' response property for the response status 'default'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added 'TER2' enum value to the 'respenum2/respenum3' response property for response status 'default'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } func deleteParam(op *openapi3.Operation, in string, name string) { @@ -167,7 +167,7 @@ func TestBreaking_NewPathParam(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.NewRequestPathParameterId, errs[0].GetId()) - require.Equal(t, "added the new path request parameter 'project'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added path request parameter 'project'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: new required header param is breaking @@ -184,7 +184,7 @@ func TestBreaking_NewRequiredHeaderParam(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.NewRequiredRequestParameterId, errs[0].GetId()) - require.Equal(t, "added the new required 'header' request parameter 'network-policies'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added required 'header' request parameter 'network-policies'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing header param from optional to required is breaking @@ -208,7 +208,7 @@ func TestBreaking_HeaderParamRequiredEnabled(t *testing.T) { Path: "/api/{domain}/{project}/install-command", Source: load.NewSource("../data/openapi-test1.yaml"), }, errs[0]) - require.Equal(t, "the 'header' request parameter 'network-policies' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "'header' request parameter 'network-policies' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing response header from required to optional is breaking @@ -225,7 +225,7 @@ func TestBreaking_ResponseHeaderParamRequiredDisabled(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponseHeaderBecameOptionalId, errs[0].GetId()) - require.Equal(t, "the response header 'X-RateLimit-Limit' became optional for the status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "header 'X-RateLimit-Limit' became optional for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing an existing required response header is breaking as error @@ -245,7 +245,7 @@ func TestBreaking_ResponseHeaderRemoved(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequiredResponseHeaderRemovedId, errs[0].GetId()) - require.Equal(t, "the mandatory response header 'X-RateLimit-Limit' removed for the status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "mandatory header 'X-RateLimit-Limit' was removed for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing an existing response with successful status is breaking @@ -264,7 +264,7 @@ func TestBreaking_ResponseSuccessStatusUpdated(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponseSuccessStatusRemovedId, errs[0].GetId()) - require.Equal(t, "removed the success response with the status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed success response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing an existing response with non-successful status is breaking (optional) @@ -283,7 +283,7 @@ func TestBreaking_ResponseNonSuccessStatusUpdated(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponseNonSuccessStatusRemovedId, errs[0].GetId()) - require.Equal(t, "removed the non-success response with the status '400'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed non-success response status '400'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing/updating an operation id is breaking (optional) @@ -327,7 +327,7 @@ func TestBreaking_RequestBodyEnumRemoved(t *testing.T) { require.Len(t, errs, 3) require.Equal(t, checker.RequestBodyEnumValueRemovedId, errs[0].GetId()) - require.Equal(t, "request body enum value removed 'VALUE_1'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "enum value 'VALUE_1' removed from media-type 'application/json' of request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing/updating a property enum in response is breaking (optional) @@ -345,7 +345,7 @@ func TestBreaking_ResponsePropertyEnumRemoved(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 2) require.Equal(t, checker.ResponsePropertyEnumValueRemovedId, errs[0].GetId()) - require.Equal(t, "removed the 'QWE' enum value from the 'respenum' response property for the response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed 'QWE' enum value from 'respenum' response property for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing/updating a tag is breaking (optional) @@ -436,7 +436,7 @@ func TestBreaking_OptionalResponseHeaderRemoved(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.OptionalResponseHeaderRemovedId, errs[0].GetId()) - require.Equal(t, "the optional response header 'X-RateLimit-Limit' removed for the status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "optional header 'X-RateLimit-Limit' was removed for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: deleting a media-type from response is breaking @@ -453,7 +453,7 @@ func TestBreaking_ResponseDeleteMediaType(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponseMediaTypeRemovedId, errs[0].GetId()) - require.Equal(t, "removed the media type 'application/json' for the response with the status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed media type 'application/json' for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: deleting a pattern from a schema is not breaking @@ -483,8 +483,8 @@ func TestBreaking_AddPattern(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.NotEmpty(t, errs) require.Len(t, errs, 1) - require.Equal(t, "request-property-pattern-added", errs[0].GetId()) - require.Equal(t, "added the pattern '^[a-z]+$' to the request property 'created'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, checker.RequestPropertyPatternAddedId, errs[0].GetId()) + require.Equal(t, "added pattern '^[a-z]+$' to the request property 'created' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: adding a pattern to a schema is breaking for recursive properties @@ -500,8 +500,8 @@ func TestBreaking_AddPatternRecursive(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.NotEmpty(t, errs) require.Len(t, errs, 1) - require.Equal(t, "request-property-pattern-added", errs[0].GetId()) - require.Equal(t, "added the pattern '^[a-z]+$' to the request property 'data/created'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, checker.RequestPropertyPatternAddedId, errs[0].GetId()) + require.Equal(t, "added pattern '^[a-z]+$' to the request property 'data/created' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: modifying a pattern in a schema is breaking @@ -518,7 +518,7 @@ func TestBreaking_ModifyPattern(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyPatternChangedId, errs[0].GetId()) - require.Equal(t, "changed the pattern of the request property 'created' from '^[a-z]+$' to '.+'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "changed pattern of the request property 'created' of media-type 'application/json' from '^[a-z]+$' to '.+'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.WARN, errs[0].GetLevel()) } @@ -550,7 +550,7 @@ func TestBreaking_ModifyParameterPattern(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterPatternChangedId, errs[0].GetId()) - require.Equal(t, "changed the pattern of the 'path' request parameter 'groupId' from '[0-9a-f]+' to '[0-9]+'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "changed pattern of the 'path' request parameter 'groupId' from '[0-9a-f]+' to '[0-9]+'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: modifying a pattern to ".*" in a schema is not breaking @@ -582,7 +582,7 @@ func TestBreaking_ModifyRequiredOptionalParamDefaultValue(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterDefaultValueChangedId, errs[0].GetId()) - require.Equal(t, "for the 'header' request parameter 'network-policies', default value was changed from 'X' to 'Y'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "for 'header' request parameter 'network-policies', default value was changed from 'X' to 'Y'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: setting the default value of an optional request parameter is breaking @@ -600,7 +600,7 @@ func TestBreaking_SettingOptionalParamDefaultValue(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterDefaultValueAddedId, errs[0].GetId()) - require.Equal(t, "for the 'header' request parameter 'network-policies', default value 'Y' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "for 'header' request parameter 'network-policies', default value 'Y' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing the default value of an optional request parameter is breaking @@ -618,7 +618,7 @@ func TestBreaking_RemovingOptionalParamDefaultValue(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) require.Equal(t, "request-parameter-default-value-removed", errs[0].GetId()) - require.Equal(t, "for the 'header' request parameter 'network-policies', default value 'Y' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "for 'header' request parameter 'network-policies', default value 'Y' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: modifying the default value of a required request parameter is not breaking @@ -660,9 +660,9 @@ func TestBreaking_SchemaRemoved(t *testing.T) { } require.NotEmpty(t, errs) require.Equal(t, checker.APISchemasRemovedId, errs[0].GetId()) - require.Equal(t, "removed the schema 'network-policies'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed schema 'network-policies'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.APISchemasRemovedId, errs[1].GetId()) - require.Equal(t, "removed the schema 'rules'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed schema 'rules'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing a media type from request body is breaking @@ -678,7 +678,7 @@ func TestBreaking_RequestBodyMediaTypeRemoved(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.NotEmpty(t, errs) require.Equal(t, "request-body-media-type-removed", errs[0].GetId()) - require.Equal(t, "removed the media type 'application/json' from the request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed media type 'application/json' from the request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing 'anyOf' schema from the request body or request body property is breaking @@ -696,11 +696,11 @@ func TestBreaking_RequestPropertyAnyOfRemoved(t *testing.T) { require.Equal(t, checker.RequestBodyAnyOfRemovedId, errs[0].GetId()) require.Equal(t, checker.ERR, errs[0].GetLevel()) - require.Equal(t, "removed '#/components/schemas/Rabbit' from the request body 'anyOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed '#/components/schemas/Rabbit' from media-type 'application/json' of request body 'anyOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.RequestPropertyAnyOfRemovedId, errs[1].GetId()) require.Equal(t, checker.ERR, errs[1].GetLevel()) - require.Equal(t, "removed '#/components/schemas/Breed3' from the '/anyOf[#/components/schemas/Dog]/breed' request property 'anyOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed '#/components/schemas/Breed3' from '/anyOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'anyOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing 'oneOf' schema from the request body or request body property is breaking @@ -717,11 +717,11 @@ func TestBreaking_RequestPropertyOneOfRemoved(t *testing.T) { require.Len(t, errs, 2) require.Equal(t, checker.RequestBodyOneOfRemovedId, errs[0].GetId()) require.Equal(t, checker.ERR, errs[0].GetLevel()) - require.Equal(t, "removed '#/components/schemas/Rabbit' from the request body 'oneOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed '#/components/schemas/Rabbit' from media-type 'application/json' of request body 'oneOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.RequestPropertyOneOfRemovedId, errs[1].GetId()) require.Equal(t, checker.ERR, errs[1].GetLevel()) - require.Equal(t, "removed '#/components/schemas/Breed3' from the '/oneOf[#/components/schemas/Dog]/breed' request property 'oneOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed '#/components/schemas/Breed3' from '/oneOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'oneOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: adding 'allOf' subschema to the request body or request body property is breaking @@ -739,11 +739,11 @@ func TestBreaking_RequestPropertyAllOfAdded(t *testing.T) { require.Equal(t, checker.RequestBodyAllOfAddedId, errs[0].GetId()) require.Equal(t, checker.ERR, errs[0].GetLevel()) - require.Equal(t, "added '#/components/schemas/Rabbit' to the request body 'allOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added '#/components/schemas/Rabbit' to media-type 'application/json' of request body 'allOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.RequestPropertyAllOfAddedId, errs[1].GetId()) require.Equal(t, checker.ERR, errs[1].GetLevel()) - require.Equal(t, "added '#/components/schemas/Breed3' to the '/allOf[#/components/schemas/Dog]/breed' request property 'allOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added '#/components/schemas/Breed3' to '/allOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'allOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing 'allOf' subschema from the request body or request body property is breaking with warn @@ -761,9 +761,9 @@ func TestBreaking_RequestPropertyAllOfRemoved(t *testing.T) { require.Equal(t, checker.RequestBodyAllOfRemovedId, errs[0].GetId()) require.Equal(t, checker.WARN, errs[0].GetLevel()) - require.Equal(t, "removed '#/components/schemas/Rabbit' from the request body 'allOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed '#/components/schemas/Rabbit' from media-type 'application/json' of request body 'allOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.RequestPropertyAllOfRemovedId, errs[1].GetId()) require.Equal(t, checker.WARN, errs[1].GetLevel()) - require.Equal(t, "removed '#/components/schemas/Breed3' from the '/allOf[#/components/schemas/Dog]/breed' request property 'allOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed '#/components/schemas/Breed3' from '/allOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'allOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_components_security_updated_test.go b/checker/check_components_security_updated_test.go index c6799eb1..8b100470 100644 --- a/checker/check_components_security_updated_test.go +++ b/checker/check_components_security_updated_test.go @@ -27,7 +27,7 @@ func TestComponentSecurityOauthURLUpdated(t *testing.T) { Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "the component security scheme 'petstore_auth' oauth url changed from 'http://example.org/api/oauth/dialog' to 'http://example.new.org/api/oauth/dialog'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "component security scheme 'petstore_auth' oauth url changed from 'http://example.org/api/oauth/dialog' to 'http://example.new.org/api/oauth/dialog'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing security component token url @@ -49,7 +49,7 @@ func TestComponentSecurityOauthTokenUpdated(t *testing.T) { Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "the component security scheme 'petstore_auth' oauth token url changed from '' to 'http://example.new.org/api/oauth/dialog'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "component security scheme 'petstore_auth' oauth token url changed from '' to 'http://example.new.org/api/oauth/dialog'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing security component type @@ -71,7 +71,7 @@ func TestComponentSecurityTypeUpdated(t *testing.T) { Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "the component security scheme 'petstore_auth' type changed from 'oauth2' to 'http'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "component security scheme 'petstore_auth' type changed from 'oauth2' to 'http'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a new security component @@ -91,7 +91,7 @@ func TestComponentSecurityAdded(t *testing.T) { Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "the component security scheme 'BasicAuth' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "component security scheme 'BasicAuth' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a new security component @@ -111,7 +111,7 @@ func TestComponentSecurityRemoved(t *testing.T) { Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "the component security scheme 'BasicAuth' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "component security scheme 'BasicAuth' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a new oauth security scope @@ -133,7 +133,7 @@ func TestComponentSecurityOauthScopeAdded(t *testing.T) { Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "the component security scheme 'petstore_auth' oauth scope 'admin:pets' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "component security scheme 'petstore_auth' oauth scope 'admin:pets' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a new oauth security scope @@ -156,7 +156,7 @@ func TestComponentSecurityOauthScopeRemoved(t *testing.T) { Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "the component security scheme 'petstore_auth' oauth scope 'admin:pets' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "component security scheme 'petstore_auth' oauth scope 'admin:pets' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a new oauth security scope @@ -178,5 +178,5 @@ func TestComponentSecurityOauthScopeUpdated(t *testing.T) { Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "the component security scheme 'petstore_auth' oauth scope 'read:pets' was updated from 'read your pets' to 'grants access to pets (deprecated)'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "component security scheme 'petstore_auth' oauth scope 'read:pets' was updated from 'read your pets' to 'grants access to pets (deprecated)'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_body_became_enum.go b/checker/check_request_body_became_enum.go index c438187f..7e38f004 100644 --- a/checker/check_request_body_became_enum.go +++ b/checker/check_request_body_became_enum.go @@ -27,7 +27,7 @@ func RequestBodyBecameEnumCheck(diffReport *diff.Diff, operationsSources *diff.O modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { if mediaTypeDiff.SchemaDiff == nil { continue } @@ -37,7 +37,7 @@ func RequestBodyBecameEnumCheck(diffReport *diff.Diff, operationsSources *diff.O result = append(result, NewApiChange( RequestBodyBecameEnumId, config, - nil, + []any{mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_body_enum_deleted.go b/checker/check_request_body_enum_deleted.go index f5734389..0bd8dce5 100644 --- a/checker/check_request_body_enum_deleted.go +++ b/checker/check_request_body_enum_deleted.go @@ -30,7 +30,7 @@ func RequestBodyEnumValueRemovedCheck(diffReport *diff.Diff, operationsSources * mediaTypeChanges := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeItem := range mediaTypeChanges { + for mediaType, mediaTypeItem := range mediaTypeChanges { if mediaTypeItem.SchemaDiff == nil { continue } @@ -43,7 +43,7 @@ func RequestBodyEnumValueRemovedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestBodyEnumValueRemovedId, config, - []any{enumVal}, + []any{enumVal, mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_parameter_became_enum_test.go b/checker/check_request_parameter_became_enum_test.go index d046c087..3387b762 100644 --- a/checker/check_request_parameter_became_enum_test.go +++ b/checker/check_request_parameter_became_enum_test.go @@ -29,5 +29,5 @@ func TestRequestParameterBecameEnum(t *testing.T) { Source: load.NewSource("../data/checker/request_parameter_became_enum_revision.yaml"), OperationId: "createOneGroup", }, errs[0]) - require.Equal(t, "the 'path' request parameter 'groupId' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "'path' request parameter 'groupId' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_parameter_pattern_added_or_changed_test.go b/checker/check_request_parameter_pattern_added_or_changed_test.go index 529da6a3..1b002f29 100644 --- a/checker/check_request_parameter_pattern_added_or_changed_test.go +++ b/checker/check_request_parameter_pattern_added_or_changed_test.go @@ -30,7 +30,7 @@ func TestRequestParameterPatternChanged(t *testing.T) { Path: "/test", Source: load.NewSource("../data/checker/request_parameter_pattern_added_or_changed_base.yaml"), }, errs[0]) - require.Equal(t, "changed the pattern of the 'query' request parameter 'category' from '^\\w+$' to '^[\\w\\s]+$'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "changed pattern of the 'query' request parameter 'category' from '^\\w+$' to '^[\\w\\s]+$'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')", errs[0].GetComment(checker.NewDefaultLocalizer())) } @@ -54,7 +54,7 @@ func TestRequestParameterPatternGeneralized(t *testing.T) { Path: "/test", Source: load.NewSource("../data/checker/request_parameter_pattern_added_or_changed_base.yaml"), }, errs[0]) - require.Equal(t, "changed the pattern of the 'query' request parameter 'category' from '^\\w+$' to a more general pattern '.*'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "changed pattern of the 'query' request parameter 'category' from '^\\w+$' to a more general pattern '.*'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding pattern to request parameters @@ -77,6 +77,7 @@ func TestRequestParameterPatternAdded(t *testing.T) { Path: "/test", Source: load.NewSource("../data/checker/request_parameter_pattern_added_or_changed_base.yaml"), }, errs[0]) + require.Equal(t, "added pattern '^\\w+$' to the 'query' request parameter 'category'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')", errs[0].GetComment(checker.NewDefaultLocalizer())) } @@ -99,4 +100,5 @@ func TestRequestParameterPatternRemoved(t *testing.T) { Path: "/test", Source: load.NewSource("../data/checker/request_parameter_pattern_added_or_changed_revision.yaml"), }, errs[0]) + require.Equal(t, "removed pattern '^\\w+$' from the 'query' request parameter 'category'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_parameters_type_changed_test.go b/checker/check_request_parameters_type_changed_test.go index 39c95a2a..727b3f86 100644 --- a/checker/check_request_parameters_type_changed_test.go +++ b/checker/check_request_parameters_type_changed_test.go @@ -33,6 +33,7 @@ func TestRequestPathParamTypeChanged(t *testing.T) { Source: load.NewSource("../data/checker/request_parameter_type_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "for 'path' request parameter 'groupId', type/format was changed from 'string'/'' to 'integer'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request query parameter type @@ -57,6 +58,7 @@ func TestRequestQueryParamTypeChanged(t *testing.T) { Source: load.NewSource("../data/checker/request_parameter_type_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "for 'query' request parameter 'token', type/format was changed from 'string'/'uuid' to 'integer'/'uuid'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request header parameter type @@ -81,6 +83,7 @@ func TestRequestQueryHeaderTypeChanged(t *testing.T) { Source: load.NewSource("../data/checker/request_parameter_type_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "for 'header' request parameter 'X-Request-ID', type/format was changed from 'string'/'uuid' to 'integer'/'uuid'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request path parameter format @@ -105,6 +108,7 @@ func TestRequestPathParamFormatChanged(t *testing.T) { Source: load.NewSource("../data/checker/request_parameter_type_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "for 'path' request parameter 'groupId', type/format was changed from 'string'/'' to 'string'/'uuid'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request query parameter format @@ -129,6 +133,7 @@ func TestRequestQueryParamFormatChanged(t *testing.T) { Source: load.NewSource("../data/checker/request_parameter_type_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "for 'query' request parameter 'token', type/format was changed from 'string'/'uuid' to 'string'/'uri'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request header parameter format @@ -153,6 +158,7 @@ func TestRequestQueryHeaderFormatChanged(t *testing.T) { Source: load.NewSource("../data/checker/request_parameter_type_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "for 'header' request parameter 'X-Request-ID', type/format was changed from 'string'/'uuid' to 'string'/'uri'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request path parameter type by adding "string" @@ -178,6 +184,7 @@ func TestRequestPathParamTypeAddString(t *testing.T) { Source: load.NewSource("../data/checker/request_parameter_type_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "for 'path' request parameter 'groupId', type/format was generalized from 'integer'/'' to 'integer, string'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request path parameter type by replacing "integer" with "number" @@ -203,6 +210,7 @@ func TestRequestPathParamTypeIntegerToNumber(t *testing.T) { Source: load.NewSource("../data/checker/request_parameter_type_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "for 'path' request parameter 'groupId', type/format was generalized from 'integer, string'/'' to 'number, string'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing request's query param property type from number to string is breaking @@ -218,7 +226,7 @@ func TestBreaking_ReqQueryParamTypeNumberToString(t *testing.T) { errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.RequestParameterTypeChangedCheck), d, osm, checker.INFO) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterPropertyTypeChangedId, errs[0].GetId()) - require.Equal(t, "for the 'query' request parameter 'filters', the type/format of property 'groupId' was changed from 'number'/'' to 'string'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "for 'query' request parameter 'filters', type/format of property 'groupId' was changed from 'number'/'' to 'string'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.WARN, errs[0].GetLevel()) } @@ -235,7 +243,7 @@ func TestBreaking_ReqQueryParamTypeStringToNumber(t *testing.T) { errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.RequestParameterTypeChangedCheck), d, osm, checker.INFO) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterPropertyTypeSpecializedId, errs[0].GetId()) - require.Equal(t, "for the 'query' request parameter 'filters', the type/format of property 'groupId' was specialized from 'string'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "for 'query' request parameter 'filters', type/format of property 'groupId' was specialized from 'string'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.ERR, errs[0].GetLevel()) } @@ -252,6 +260,6 @@ func TestBreaking_ReqQueryParamTypeIntegerToNumber(t *testing.T) { errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.RequestParameterTypeChangedCheck), d, osm, checker.INFO) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterPropertyTypeGeneralizedId, errs[0].GetId()) - require.Equal(t, "for the 'query' request parameter 'filters', the type/format of property 'groupId' was generalized from 'integer'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "for 'query' request parameter 'filters', type/format of property 'groupId' was generalized from 'integer'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, checker.INFO, errs[0].GetLevel()) } diff --git a/checker/check_request_property_all_of_updated.go b/checker/check_request_property_all_of_updated.go index b352078a..2b18c089 100644 --- a/checker/check_request_property_all_of_updated.go +++ b/checker/check_request_property_all_of_updated.go @@ -30,7 +30,7 @@ func RequestPropertyAllOfUpdatedCheck(diffReport *diff.Diff, operationsSources * } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { if mediaTypeDiff.SchemaDiff == nil { continue } @@ -39,7 +39,7 @@ func RequestPropertyAllOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestBodyAllOfAddedId, config, - []any{mediaTypeDiff.SchemaDiff.AllOfDiff.Added.String()}, + []any{mediaTypeDiff.SchemaDiff.AllOfDiff.Added.String(), mediaType}, "", operationsSources, operationItem.Revision, @@ -52,7 +52,7 @@ func RequestPropertyAllOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestBodyAllOfRemovedId, config, - []any{mediaTypeDiff.SchemaDiff.AllOfDiff.Deleted.String()}, + []any{mediaTypeDiff.SchemaDiff.AllOfDiff.Deleted.String(), mediaType}, "", operationsSources, operationItem.Revision, @@ -74,7 +74,7 @@ func RequestPropertyAllOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestPropertyAllOfAddedId, config, - []any{propertyDiff.AllOfDiff.Added.String(), propName}, + []any{propertyDiff.AllOfDiff.Added.String(), propName, mediaType}, "", operationsSources, operationItem.Revision, @@ -87,7 +87,7 @@ func RequestPropertyAllOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestPropertyAllOfRemovedId, config, - []any{propertyDiff.AllOfDiff.Deleted.String(), propName}, + []any{propertyDiff.AllOfDiff.Deleted.String(), propName, mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_all_of_updated_test.go b/checker/check_request_property_all_of_updated_test.go index 6b4d6ae1..ea0c095d 100644 --- a/checker/check_request_property_all_of_updated_test.go +++ b/checker/check_request_property_all_of_updated_test.go @@ -22,25 +22,27 @@ func TestRequestPropertyAllOfAdded(t *testing.T) { require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.RequestBodyAllOfAddedId, - Args: []any{"#/components/schemas/Rabbit"}, - Level: checker.ERR, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_all_of_added_revision.yaml"), - OperationId: "updatePets", - }, - { - Id: checker.RequestPropertyAllOfAddedId, - Args: []any{"#/components/schemas/Breed3", "/allOf[#/components/schemas/Dog]/breed"}, - Level: checker.ERR, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_all_of_added_revision.yaml"), - OperationId: "updatePets", - }}, errs) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestBodyAllOfAddedId, + Args: []any{"#/components/schemas/Rabbit", "application/json"}, + Level: checker.ERR, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_all_of_added_revision.yaml"), + OperationId: "updatePets", + }, errs[0]) + require.Equal(t, "added '#/components/schemas/Rabbit' to media-type 'application/json' of request body 'allOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyAllOfAddedId, + Args: []any{"#/components/schemas/Breed3", "/allOf[#/components/schemas/Dog]/breed", "application/json"}, + Level: checker.ERR, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_all_of_added_revision.yaml"), + OperationId: "updatePets", + }, errs[1]) + require.Equal(t, "added '#/components/schemas/Breed3' to '/allOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'allOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing 'allOf' subschema from the request body or request body property @@ -56,23 +58,25 @@ func TestRequestPropertyAllOfRemoved(t *testing.T) { require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.RequestBodyAllOfRemovedId, - Args: []any{"#/components/schemas/Rabbit"}, - Level: checker.WARN, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_all_of_removed_revision.yaml"), - OperationId: "updatePets", - }, - { - Id: checker.RequestPropertyAllOfRemovedId, - Args: []any{"#/components/schemas/Breed3", "/allOf[#/components/schemas/Dog]/breed"}, - Level: checker.WARN, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_all_of_removed_revision.yaml"), - OperationId: "updatePets", - }}, errs) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestBodyAllOfRemovedId, + Args: []any{"#/components/schemas/Rabbit", "application/json"}, + Level: checker.WARN, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_all_of_removed_revision.yaml"), + OperationId: "updatePets", + }, errs[0]) + require.Equal(t, "removed '#/components/schemas/Rabbit' from media-type 'application/json' of request body 'allOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyAllOfRemovedId, + Args: []any{"#/components/schemas/Breed3", "/allOf[#/components/schemas/Dog]/breed", "application/json"}, + Level: checker.WARN, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_all_of_removed_revision.yaml"), + OperationId: "updatePets", + }, errs[1]) + require.Equal(t, "removed '#/components/schemas/Breed3' from '/allOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'allOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_property_any_of_updated.go b/checker/check_request_property_any_of_updated.go index 3c7a41f3..e0c499eb 100644 --- a/checker/check_request_property_any_of_updated.go +++ b/checker/check_request_property_any_of_updated.go @@ -30,7 +30,7 @@ func RequestPropertyAnyOfUpdatedCheck(diffReport *diff.Diff, operationsSources * } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { if mediaTypeDiff.SchemaDiff == nil { continue } @@ -39,7 +39,7 @@ func RequestPropertyAnyOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestBodyAnyOfAddedId, config, - []any{mediaTypeDiff.SchemaDiff.AnyOfDiff.Added.String()}, + []any{mediaTypeDiff.SchemaDiff.AnyOfDiff.Added.String(), mediaType}, "", operationsSources, operationItem.Revision, @@ -52,7 +52,7 @@ func RequestPropertyAnyOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestBodyAnyOfRemovedId, config, - []any{mediaTypeDiff.SchemaDiff.AnyOfDiff.Deleted.String()}, + []any{mediaTypeDiff.SchemaDiff.AnyOfDiff.Deleted.String(), mediaType}, "", operationsSources, operationItem.Revision, @@ -74,7 +74,7 @@ func RequestPropertyAnyOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestPropertyAnyOfAddedId, config, - []any{propertyDiff.AnyOfDiff.Added.String(), propName}, + []any{propertyDiff.AnyOfDiff.Added.String(), propName, mediaType}, "", operationsSources, operationItem.Revision, @@ -87,7 +87,7 @@ func RequestPropertyAnyOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestPropertyAnyOfRemovedId, config, - []any{propertyDiff.AnyOfDiff.Deleted.String(), propName}, + []any{propertyDiff.AnyOfDiff.Deleted.String(), propName, mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_any_of_updated_test.go b/checker/check_request_property_any_of_updated_test.go index 7d852fec..ce362dd0 100644 --- a/checker/check_request_property_any_of_updated_test.go +++ b/checker/check_request_property_any_of_updated_test.go @@ -22,25 +22,27 @@ func TestRequestPropertyAnyOfAdded(t *testing.T) { require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.RequestBodyAnyOfAddedId, - Args: []any{"#/components/schemas/Rabbit"}, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_any_of_added_revision.yaml"), - OperationId: "updatePets", - }, - { - Id: checker.RequestPropertyAnyOfAddedId, - Args: []any{"#/components/schemas/Breed3", "/anyOf[#/components/schemas/Dog]/breed"}, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_any_of_added_revision.yaml"), - OperationId: "updatePets", - }}, errs) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestBodyAnyOfAddedId, + Args: []any{"#/components/schemas/Rabbit", "application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_any_of_added_revision.yaml"), + OperationId: "updatePets", + }, errs[0]) + require.Equal(t, "added '#/components/schemas/Rabbit' to media-type 'application/json' of request body 'anyOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyAnyOfAddedId, + Args: []any{"#/components/schemas/Breed3", "/anyOf[#/components/schemas/Dog]/breed", "application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_any_of_added_revision.yaml"), + OperationId: "updatePets", + }, errs[1]) + require.Equal(t, "added '#/components/schemas/Breed3' to '/anyOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'anyOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing 'anyOf' schema from the request body or request body property @@ -56,23 +58,25 @@ func TestRequestPropertyAnyOfRemoved(t *testing.T) { require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.RequestBodyAnyOfRemovedId, - Args: []any{"#/components/schemas/Rabbit"}, - Level: checker.ERR, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_any_of_removed_revision.yaml"), - OperationId: "updatePets", - }, - { - Id: checker.RequestPropertyAnyOfRemovedId, - Args: []any{"#/components/schemas/Breed3", "/anyOf[#/components/schemas/Dog]/breed"}, - Level: checker.ERR, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_any_of_removed_revision.yaml"), - OperationId: "updatePets", - }}, errs) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestBodyAnyOfRemovedId, + Args: []any{"#/components/schemas/Rabbit", "application/json"}, + Level: checker.ERR, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_any_of_removed_revision.yaml"), + OperationId: "updatePets", + }, errs[0]) + require.Equal(t, "removed '#/components/schemas/Rabbit' from media-type 'application/json' of request body 'anyOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyAnyOfRemovedId, + Args: []any{"#/components/schemas/Breed3", "/anyOf[#/components/schemas/Dog]/breed", "application/json"}, + Level: checker.ERR, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_any_of_removed_revision.yaml"), + OperationId: "updatePets", + }, errs[1]) + require.Equal(t, "removed '#/components/schemas/Breed3' from '/anyOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'anyOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_property_became_not_nuallable.go b/checker/check_request_property_became_not_nuallable.go index 8cbccb7d..03fa1506 100644 --- a/checker/check_request_property_became_not_nuallable.go +++ b/checker/check_request_property_became_not_nuallable.go @@ -28,7 +28,7 @@ func RequestPropertyBecameNotNullableCheck(diffReport *diff.Diff, operationsSour continue } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { if mediaTypeDiff.SchemaDiff == nil { continue } @@ -73,7 +73,7 @@ func RequestPropertyBecameNotNullableCheck(diffReport *diff.Diff, operationsSour result = append(result, NewApiChange( RequestPropertyBecomeNotNullableId, config, - []any{propName}, + []any{propName, mediaType}, "", operationsSources, operationItem.Revision, @@ -84,7 +84,7 @@ func RequestPropertyBecameNotNullableCheck(diffReport *diff.Diff, operationsSour result = append(result, NewApiChange( RequestPropertyBecomeNullableId, config, - []any{propName}, + []any{propName, mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_became_not_nuallable_test.go b/checker/check_request_property_became_not_nuallable_test.go index dbd64069..3c7fad35 100644 --- a/checker/check_request_property_became_not_nuallable_test.go +++ b/checker/check_request_property_became_not_nuallable_test.go @@ -22,7 +22,7 @@ func TestRequestPropertyBecameNotNullable(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyBecomeNotNullableId, - Args: []any{"name"}, + Args: []any{"name", "application/json"}, Level: checker.ERR, Operation: "POST", Path: "/products", @@ -44,7 +44,7 @@ func TestRequestPropertyBecameNullable(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyBecomeNullableId, - Args: []any{"name"}, + Args: []any{"name", "application/json"}, Level: checker.INFO, Operation: "POST", Path: "/products", diff --git a/checker/check_request_property_enum_value_updated.go b/checker/check_request_property_enum_value_updated.go index 09b0b365..1df95ca6 100644 --- a/checker/check_request_property_enum_value_updated.go +++ b/checker/check_request_property_enum_value_updated.go @@ -27,7 +27,7 @@ func RequestPropertyEnumValueUpdatedCheck(diffReport *diff.Diff, operationsSourc } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { CheckModifiedPropertiesDiff( mediaTypeDiff.SchemaDiff, func(propertyPath string, propertyName string, propertyDiff *diff.SchemaDiff, parent *diff.SchemaDiff) { @@ -48,7 +48,7 @@ func RequestPropertyEnumValueUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( id, config, - []any{enumVal, propName}, + []any{enumVal, propName, mediaType}, "", operationsSources, operationItem.Revision, @@ -61,7 +61,7 @@ func RequestPropertyEnumValueUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( RequestPropertyEnumValueAddedId, config, - []any{enumVal, propName}, + []any{enumVal, propName, mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_enum_value_updated_test.go b/checker/check_request_property_enum_value_updated_test.go index b84940d4..1dc6a23a 100644 --- a/checker/check_request_property_enum_value_updated_test.go +++ b/checker/check_request_property_enum_value_updated_test.go @@ -27,13 +27,13 @@ func TestRequestPropertyEnumValueRemovedCheck(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyEnumValueRemovedId, Level: checker.ERR, - Args: []any{"bird", "category"}, + Args: []any{"bird", "category", "application/json"}, Operation: "POST", OperationId: "updatePet", Path: "/pets", Source: load.NewSource("../data/checker/request_property_enum_value_updated_base.yaml"), }, errs[0]) - require.Equal(t, "removed the enum value 'bird' of the request property 'category'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed enum value 'bird' of request property 'category' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing request read-only property enum values @@ -55,13 +55,13 @@ func TestRequestReadOnlyPropertyEnumValueRemovedCheck(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestReadOnlyPropertyEnumValueRemovedId, Level: checker.INFO, - Args: []any{"bird", "category"}, + Args: []any{"bird", "category", "application/json"}, Operation: "POST", OperationId: "updatePet", Path: "/pets", Source: load.NewSource("../data/checker/request_property_enum_value_updated_base.yaml"), }, errs[0]) - require.Equal(t, "removed the enum value 'bird' of the request read-only property 'category'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed enum value 'bird' of request read-only property 'category' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding request property enum values @@ -82,11 +82,11 @@ func TestRequestPropertyEnumValueAddedCheck(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyEnumValueAddedId, Level: checker.INFO, - Args: []any{"bird", "category"}, + Args: []any{"bird", "category", "application/json"}, Operation: "POST", OperationId: "updatePet", Path: "/pets", Source: load.NewSource("../data/checker/request_property_enum_value_updated_base.yaml"), }, errs[0]) - require.Equal(t, "added the new 'bird' enum value to the request property 'category'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added 'bird' enum value to request property 'category' of media type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_property_max_length_updated.go b/checker/check_request_property_max_length_updated.go index 87ecad27..16d111c9 100644 --- a/checker/check_request_property_max_length_updated.go +++ b/checker/check_request_property_max_length_updated.go @@ -29,7 +29,7 @@ func RequestPropertyMaxLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { if mediaTypeDiff.SchemaDiff != nil && mediaTypeDiff.SchemaDiff.MaxLengthDiff != nil { maxLengthDiff := mediaTypeDiff.SchemaDiff.MaxLengthDiff if maxLengthDiff.From != nil && @@ -38,7 +38,7 @@ func RequestPropertyMaxLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( RequestBodyMaxLengthDecreasedId, config, - []any{maxLengthDiff.To}, + []any{mediaType, maxLengthDiff.From, maxLengthDiff.To}, "", operationsSources, operationItem.Revision, @@ -49,7 +49,7 @@ func RequestPropertyMaxLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( RequestBodyMaxLengthIncreasedId, config, - []any{maxLengthDiff.From, maxLengthDiff.To}, + []any{mediaType, maxLengthDiff.From, maxLengthDiff.To}, "", operationsSources, operationItem.Revision, @@ -85,7 +85,7 @@ func RequestPropertyMaxLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( id, config, - []any{propName, maxLengthDiff.To}, + []any{propName, mediaType, maxLengthDiff.From, maxLengthDiff.To}, "", operationsSources, operationItem.Revision, @@ -96,7 +96,7 @@ func RequestPropertyMaxLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( RequestPropertyMaxLengthIncreasedId, config, - []any{propName, maxLengthDiff.From, maxLengthDiff.To}, + []any{propName, mediaType, maxLengthDiff.From, maxLengthDiff.To}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_max_length_updated_test.go b/checker/check_request_property_max_length_updated_test.go index 99f66541..297fda1b 100644 --- a/checker/check_request_property_max_length_updated_test.go +++ b/checker/check_request_property_max_length_updated_test.go @@ -28,13 +28,14 @@ func TestRequestBodyMaxLengthDecreasedCheck(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestBodyMaxLengthIncreasedId, - Args: []any{maxLength, newMaxLength}, + Args: []any{"application/json", maxLength, newMaxLength}, Level: checker.INFO, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_body_max_length_decreased_base.yaml"), OperationId: "addPet", }, errs[0]) + require.Equal(t, "maxLength value of media-type 'application/json' of request body was increased from '50' to '100'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: decreasing max length of request body @@ -56,13 +57,14 @@ func TestRequestBodyMaxLengthIncreasedCheck(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestBodyMaxLengthDecreasedId, - Args: []any{newMaxLength}, + Args: []any{"application/json", maxLength, newMaxLength}, Level: checker.ERR, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_body_max_length_decreased_base.yaml"), OperationId: "addPet", }, errs[0]) + require.Equal(t, "maxLength value of media-type 'application/json' of request body was decreased from '100' to '50'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: decreasing max length of request property @@ -83,14 +85,14 @@ func TestRequestPropertyMaxLengthDecreasedCheck(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyMaxLengthDecreasedId, - Args: []any{"description", newMaxLength}, + Args: []any{"description", "application/json", maxLength, newMaxLength}, Level: checker.ERR, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_body_max_length_decreased_base.yaml"), OperationId: "addPet", }, errs[0]) - require.Equal(t, "the 'description' request property's maxLength was decreased to '50'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "maxLength value of request property 'description' of media-type 'application/json' was decreased from '100' to '50'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: decreasing max length of request read-only property @@ -113,14 +115,14 @@ func TestRequestReadOnlyPropertyMaxLengthDecreasedCheck(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestReadOnlyPropertyMaxLengthDecreasedId, - Args: []any{"description", newMaxLength}, + Args: []any{"description", "application/json", maxLength, newMaxLength}, Level: checker.INFO, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_body_max_length_decreased_base.yaml"), OperationId: "addPet", }, errs[0]) - require.Equal(t, "the 'description' request read-only property's maxLength was decreased to '50'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "maxLength value of request read-only property 'description' of media-type 'application/json' was decreased from '100' to '50'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: increasing max length of request property @@ -141,11 +143,12 @@ func TestRequestPropertyMaxLengthIncreasedCheck(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyMaxLengthIncreasedId, - Args: []any{"description", maxLength, newMaxLength}, + Args: []any{"description", "application/json", maxLength, newMaxLength}, Level: checker.INFO, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_body_max_length_decreased_base.yaml"), OperationId: "addPet", }, errs[0]) + require.Equal(t, "maxLength value of request property 'description' of media-type 'application/json' was increased from '50' to '100'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_property_min_length_updated.go b/checker/check_request_property_min_length_updated.go index edd846aa..6dd15e05 100644 --- a/checker/check_request_property_min_length_updated.go +++ b/checker/check_request_property_min_length_updated.go @@ -28,7 +28,7 @@ func RequestPropertyMinLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { if mediaTypeDiff.SchemaDiff != nil && mediaTypeDiff.SchemaDiff.MinLengthDiff != nil { minLengthDiff := mediaTypeDiff.SchemaDiff.MinLengthDiff if minLengthDiff.From != nil && @@ -37,7 +37,7 @@ func RequestPropertyMinLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( RequestBodyMinLengthIncreasedId, config, - []any{minLengthDiff.From, minLengthDiff.To}, + []any{mediaType, minLengthDiff.From, minLengthDiff.To}, "", operationsSources, operationItem.Revision, @@ -48,7 +48,7 @@ func RequestPropertyMinLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( RequestBodyMinLengthDecreasedId, config, - []any{minLengthDiff.From, minLengthDiff.To}, + []any{mediaType, minLengthDiff.From, minLengthDiff.To}, "", operationsSources, operationItem.Revision, @@ -77,7 +77,7 @@ func RequestPropertyMinLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( RequestPropertyMinLengthDecreasedId, config, - []any{propName, minLengthDiff.From, minLengthDiff.To}, + []any{propName, mediaType, minLengthDiff.From, minLengthDiff.To}, "", operationsSources, operationItem.Revision, @@ -88,7 +88,7 @@ func RequestPropertyMinLengthUpdatedCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( RequestPropertyMinLengthIncreasedId, config, - []any{propName, minLengthDiff.From, minLengthDiff.To}, + []any{propName, mediaType, minLengthDiff.From, minLengthDiff.To}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_min_length_updated_test.go b/checker/check_request_property_min_length_updated_test.go index ee6ce5bd..49e51cc2 100644 --- a/checker/check_request_property_min_length_updated_test.go +++ b/checker/check_request_property_min_length_updated_test.go @@ -24,13 +24,14 @@ func TestRequestPropertyMinLengthDecreased(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyMinLengthDecreasedId, - Args: []any{"name", uint64(3), uint64(2)}, + Args: []any{"name", "application/json", uint64(3), uint64(2)}, Level: checker.INFO, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_min_length_decreased_base.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "minLength value of request property 'name' of media-type 'application/json' was decreased from '3' to '2'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: increasing minLength of request property @@ -48,13 +49,14 @@ func TestRequestPropertyMinLengthIncreased(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyMinLengthIncreasedId, - Args: []any{"name", uint64(3), uint64(5)}, + Args: []any{"name", "application/json", uint64(3), uint64(5)}, Level: checker.ERR, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_min_length_decreased_base.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "minLength value of request property 'name' of media-type 'application/json' was increased from '3' to '5'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: increasing minLength of request body @@ -72,13 +74,14 @@ func TestRequestBodyMinLengthIncreased(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestBodyMinLengthIncreasedId, - Args: []any{uint64(10), uint64(100)}, + Args: []any{"application/json", uint64(10), uint64(100)}, Level: checker.ERR, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_min_length_decreased_base.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "minLength value of media-type 'application/json' of request body was increased from '10' to '100'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: decreasing minLength of request body @@ -96,11 +99,12 @@ func TestRequestBodyMinLengthDecreased(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestBodyMinLengthDecreasedId, - Args: []any{uint64(10), uint64(1)}, + Args: []any{"application/json", uint64(10), uint64(1)}, Level: checker.INFO, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_min_length_decreased_base.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "minLength value of media-type 'application/json' of request body was decreased from '10' to '1'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_property_one_of_updated.go b/checker/check_request_property_one_of_updated.go index bcc182d8..b47d6cfd 100644 --- a/checker/check_request_property_one_of_updated.go +++ b/checker/check_request_property_one_of_updated.go @@ -30,7 +30,7 @@ func RequestPropertyOneOfUpdatedCheck(diffReport *diff.Diff, operationsSources * } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { if mediaTypeDiff.SchemaDiff == nil { continue } @@ -39,7 +39,7 @@ func RequestPropertyOneOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestBodyOneOfAddedId, config, - []any{mediaTypeDiff.SchemaDiff.OneOfDiff.Added.String()}, + []any{mediaTypeDiff.SchemaDiff.OneOfDiff.Added.String(), mediaType}, "", operationsSources, operationItem.Revision, @@ -52,7 +52,7 @@ func RequestPropertyOneOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestBodyOneOfRemovedId, config, - []any{mediaTypeDiff.SchemaDiff.OneOfDiff.Deleted.String()}, + []any{mediaTypeDiff.SchemaDiff.OneOfDiff.Deleted.String(), mediaType}, "", operationsSources, operationItem.Revision, @@ -74,7 +74,7 @@ func RequestPropertyOneOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestPropertyOneOfAddedId, config, - []any{propertyDiff.OneOfDiff.Added.String(), propName}, + []any{propertyDiff.OneOfDiff.Added.String(), propName, mediaType}, "", operationsSources, operationItem.Revision, @@ -87,7 +87,7 @@ func RequestPropertyOneOfUpdatedCheck(diffReport *diff.Diff, operationsSources * result = append(result, NewApiChange( RequestPropertyOneOfRemovedId, config, - []any{propertyDiff.OneOfDiff.Deleted.String(), propName}, + []any{propertyDiff.OneOfDiff.Deleted.String(), propName, mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_one_of_updated_test.go b/checker/check_request_property_one_of_updated_test.go index 91bee3f9..66cc01c0 100644 --- a/checker/check_request_property_one_of_updated_test.go +++ b/checker/check_request_property_one_of_updated_test.go @@ -22,25 +22,27 @@ func TestRequestPropertyOneOfAdded(t *testing.T) { require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.RequestBodyOneOfAddedId, - Args: []any{"#/components/schemas/Rabbit"}, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_one_of_added_revision.yaml"), - OperationId: "updatePets", - }, - { - Id: checker.RequestPropertyOneOfAddedId, - Args: []any{"#/components/schemas/Breed3", "/oneOf[#/components/schemas/Dog]/breed"}, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_one_of_added_revision.yaml"), - OperationId: "updatePets", - }}, errs) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestBodyOneOfAddedId, + Args: []any{"#/components/schemas/Rabbit", "application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_one_of_added_revision.yaml"), + OperationId: "updatePets", + }, errs[0]) + require.Equal(t, "added '#/components/schemas/Rabbit' to media-type 'application/json' of request body 'oneOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyOneOfAddedId, + Args: []any{"#/components/schemas/Breed3", "/oneOf[#/components/schemas/Dog]/breed", "application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_one_of_added_revision.yaml"), + OperationId: "updatePets", + }, errs[1]) + require.Equal(t, "added '#/components/schemas/Breed3' to '/oneOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'oneOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing 'oneOf' schema from the request body or request body property @@ -56,23 +58,25 @@ func TestRequestPropertyOneOfRemoved(t *testing.T) { require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.RequestBodyOneOfRemovedId, - Args: []any{"#/components/schemas/Rabbit"}, - Level: checker.ERR, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_one_of_removed_revision.yaml"), - OperationId: "updatePets", - }, - { - Id: checker.RequestPropertyOneOfRemovedId, - Args: []any{"#/components/schemas/Breed3", "/oneOf[#/components/schemas/Dog]/breed"}, - Level: checker.ERR, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_one_of_removed_revision.yaml"), - OperationId: "updatePets", - }}, errs) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestBodyOneOfRemovedId, + Args: []any{"#/components/schemas/Rabbit", "application/json"}, + Level: checker.ERR, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_one_of_removed_revision.yaml"), + OperationId: "updatePets", + }, errs[0]) + require.Equal(t, "removed '#/components/schemas/Rabbit' from media-type 'application/json' of request body 'oneOf' list", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyOneOfRemovedId, + Args: []any{"#/components/schemas/Breed3", "/oneOf[#/components/schemas/Dog]/breed", "application/json"}, + Level: checker.ERR, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_one_of_removed_revision.yaml"), + OperationId: "updatePets", + }, errs[1]) + require.Equal(t, "removed '#/components/schemas/Breed3' from '/oneOf[#/components/schemas/Dog]/breed' request property of media-type 'application/json' 'oneOf' list", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_property_pattern_added_or_changed.go b/checker/check_request_property_pattern_added_or_changed.go index 3ac2396b..c6336b5e 100644 --- a/checker/check_request_property_pattern_added_or_changed.go +++ b/checker/check_request_property_pattern_added_or_changed.go @@ -27,7 +27,7 @@ func RequestPropertyPatternUpdatedCheck(diffReport *diff.Diff, operationsSources continue } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { CheckModifiedPropertiesDiff( mediaTypeDiff.SchemaDiff, func(propertyPath string, propertyName string, propertyDiff *diff.SchemaDiff, parent *diff.SchemaDiff) { @@ -42,7 +42,7 @@ func RequestPropertyPatternUpdatedCheck(diffReport *diff.Diff, operationsSources result = append(result, NewApiChange( RequestPropertyPatternRemovedId, config, - []any{patternDiff.From, propName}, + []any{patternDiff.From, propName, mediaType}, "", operationsSources, operationItem.Revision, @@ -53,7 +53,7 @@ func RequestPropertyPatternUpdatedCheck(diffReport *diff.Diff, operationsSources result = append(result, NewApiChange( RequestPropertyPatternAddedId, config, - []any{patternDiff.To, propName}, + []any{patternDiff.To, propName, mediaType}, PatternChangedCommentId, operationsSources, operationItem.Revision, @@ -73,7 +73,7 @@ func RequestPropertyPatternUpdatedCheck(diffReport *diff.Diff, operationsSources result = append(result, NewApiChange( id, config, - []any{propName, patternDiff.From, patternDiff.To}, + []any{propName, mediaType, patternDiff.From, patternDiff.To}, comment, operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_pattern_added_or_changed_test.go b/checker/check_request_property_pattern_added_or_changed_test.go index 81bffa65..488c4760 100644 --- a/checker/check_request_property_pattern_added_or_changed_test.go +++ b/checker/check_request_property_pattern_added_or_changed_test.go @@ -24,13 +24,14 @@ func TestRequestPropertyPatternChanged(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyPatternChangedId, - Args: []any{"name", "^\\w+$", "^[\\w\\s]+$"}, + Args: []any{"name", "application/json", "^\\w+$", "^[\\w\\s]+$"}, Level: checker.WARN, Operation: "POST", Path: "/test", Source: load.NewSource("../data/checker/request_property_pattern_added_or_changed_revision.yaml"), Comment: checker.PatternChangedCommentId, }, errs[0]) + require.Equal(t, "changed pattern of the request property 'name' of media-type 'application/json' from '^\\w+$' to '^[\\w\\s]+$'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')", errs[0].GetComment(checker.NewDefaultLocalizer())) } @@ -49,12 +50,13 @@ func TestRequestPropertyPatternGeneralized(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyPatternGeneralizedId, - Args: []any{"name", "^\\w+$", ".*"}, + Args: []any{"name", "application/json", "^\\w+$", ".*"}, Level: checker.INFO, Operation: "POST", Path: "/test", Source: load.NewSource("../data/checker/request_property_pattern_added_or_changed_revision.yaml"), }, errs[0]) + require.Equal(t, "changed pattern of the request property 'name' of media-type 'application/json' from '^\\w+$' to a more general pattern '.*'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding request property pattern @@ -70,7 +72,7 @@ func TestRequestPropertyPatternAdded(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyPatternAddedId, - Args: []any{"^\\w+$", "name"}, + Args: []any{"^\\w+$", "name", "application/json"}, Level: checker.WARN, Operation: "POST", Path: "/test", @@ -78,6 +80,7 @@ func TestRequestPropertyPatternAdded(t *testing.T) { Comment: checker.PatternChangedCommentId, }, errs[0]) require.Equal(t, "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')", errs[0].GetComment(checker.NewDefaultLocalizer())) + require.Equal(t, "added pattern '^\\w+$' to the request property 'name' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing request property pattern @@ -93,10 +96,11 @@ func TestRequestPropertyPatternRemoved(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyPatternRemovedId, - Args: []any{"^\\w+$", "name"}, + Args: []any{"^\\w+$", "name", "application/json"}, Level: checker.INFO, Operation: "POST", Path: "/test", Source: load.NewSource("../data/checker/request_property_pattern_added_or_changed_revision.yaml"), }, errs[0]) + require.Equal(t, "removed pattern '^\\w+$' from the request property 'name' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_property_required_updated.go b/checker/check_request_property_required_updated.go index ebf7fdb2..d191e1e5 100644 --- a/checker/check_request_property_required_updated.go +++ b/checker/check_request_property_required_updated.go @@ -27,7 +27,7 @@ func RequestPropertyRequiredUpdatedCheck(diffReport *diff.Diff, operationsSource continue } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { if mediaTypeDiff.SchemaDiff == nil { continue } @@ -43,7 +43,7 @@ func RequestPropertyRequiredUpdatedCheck(diffReport *diff.Diff, operationsSource result = append(result, NewApiChange( RequestPropertyBecameRequiredId, config, - []any{propertyFullName(propertyPath, propertyFullName(propertyName, changedRequiredPropertyName))}, + []any{propertyFullName(propertyPath, propertyFullName(propertyName, changedRequiredPropertyName)), mediaType}, "", operationsSources, operationItem.Revision, @@ -55,7 +55,7 @@ func RequestPropertyRequiredUpdatedCheck(diffReport *diff.Diff, operationsSource result = append(result, NewApiChange( RequestPropertyBecameRequiredWithDefaultId, config, - []any{propertyFullName(propertyPath, propertyFullName(propertyName, changedRequiredPropertyName))}, + []any{propertyFullName(propertyPath, propertyFullName(propertyName, changedRequiredPropertyName)), mediaType}, "", operationsSources, operationItem.Revision, @@ -72,7 +72,7 @@ func RequestPropertyRequiredUpdatedCheck(diffReport *diff.Diff, operationsSource result = append(result, NewApiChange( RequestPropertyBecameOptionalId, config, - []any{propertyFullName(propertyPath, propertyFullName(propertyName, changedRequiredPropertyName))}, + []any{propertyFullName(propertyPath, propertyFullName(propertyName, changedRequiredPropertyName)), mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_required_updated_test.go b/checker/check_request_property_required_updated_test.go index 72d121f6..3dba2766 100644 --- a/checker/check_request_property_required_updated_test.go +++ b/checker/check_request_property_required_updated_test.go @@ -23,13 +23,14 @@ func TestRequestPropertyMarkedRequired(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyBecameRequiredId, - Args: []any{"name"}, + Args: []any{"name", "application/json"}, Level: checker.ERR, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_became_required_base.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "request property 'name' of media-type 'application/json' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request property required value to false @@ -46,13 +47,14 @@ func TestRequestPropertyMarkedOptional(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyBecameOptionalId, - Args: []any{"name"}, + Args: []any{"name", "application/json"}, Level: checker.INFO, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_became_required_base.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "request property 'name' of media-type 'application/json' became optional", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: making request property required, while also giving it a default value @@ -70,11 +72,12 @@ func TestRequestPropertyWithDefaultMarkedRequired(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyBecameRequiredWithDefaultId, - Args: []any{"name"}, + Args: []any{"name", "application/json"}, Level: checker.INFO, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_became_required_base.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "request property 'name' with a default value became required in media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_property_type_changed.go b/checker/check_request_property_type_changed.go index ed41fc9f..3434bbe3 100644 --- a/checker/check_request_property_type_changed.go +++ b/checker/check_request_property_type_changed.go @@ -48,7 +48,7 @@ func RequestPropertyTypeChangedCheck(diffReport *diff.Diff, operationsSources *d result = append(result, NewApiChange( id, config, - []any{getBaseType(schemaDiff), getBaseFormat(schemaDiff), getRevisionType(schemaDiff), getRevisionFormat(schemaDiff)}, + []any{mediaType, getBaseType(schemaDiff), getBaseFormat(schemaDiff), getRevisionType(schemaDiff), getRevisionFormat(schemaDiff)}, "", operationsSources, operationItem.Revision, @@ -81,7 +81,7 @@ func RequestPropertyTypeChangedCheck(diffReport *diff.Diff, operationsSources *d result = append(result, NewApiChange( id, config, - []any{propertyFullName(propertyPath, propertyName), getBaseType(schemaDiff), getBaseFormat(schemaDiff), getRevisionType(schemaDiff), getRevisionFormat(schemaDiff)}, + []any{propertyFullName(propertyPath, propertyName), mediaType, getBaseType(schemaDiff), getBaseFormat(schemaDiff), getRevisionType(schemaDiff), getRevisionFormat(schemaDiff)}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_type_changed_test.go b/checker/check_request_property_type_changed_test.go index 825b99db..ce7e2358 100644 --- a/checker/check_request_property_type_changed_test.go +++ b/checker/check_request_property_type_changed_test.go @@ -28,12 +28,13 @@ func TestRequestBodyTypeChangedCheck(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestBodyTypeChangedId, Level: checker.ERR, - Args: []any{utils.StringList{"object"}, "", utils.StringList{"array"}, ""}, + Args: []any{"application/json", utils.StringList{"object"}, "", utils.StringList{"array"}, ""}, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_property_type_changed_base.yaml"), OperationId: "addPet", }, errs[0]) + require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'object'/'' to 'array'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request body type @@ -53,12 +54,13 @@ func TestRequestBodyFormatChangedCheck(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestBodyTypeChangedId, Level: checker.ERR, - Args: []any{utils.StringList{"object"}, "", utils.StringList{"object"}, "uuid"}, + Args: []any{"application/json", utils.StringList{"object"}, "", utils.StringList{"object"}, "uuid"}, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_property_type_changed_base.yaml"), OperationId: "addPet", }, errs[0]) + require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'object'/'' to 'object'/'uuid'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request property type @@ -76,12 +78,13 @@ func TestRequestPropertyTypeChangedCheck(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyTypeChangedId, Level: checker.ERR, - Args: []any{"age", utils.StringList{"integer"}, "int32", utils.StringList{"string"}, "string"}, + Args: []any{"age", "application/json", utils.StringList{"integer"}, "int32", utils.StringList{"string"}, "string"}, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_property_type_changed_revision.yaml"), OperationId: "addPet", }, errs[0]) + require.Equal(t, "type/format of request property 'age' of media-type 'application/json' changed from 'integer'/'int32' to 'string'/'string'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request body and property types from array to object @@ -99,21 +102,24 @@ func TestRequestBodyAndPropertyTypesChangedCheckArrayToObject(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyTypeChangedId, Level: checker.ERR, - Args: []any{"colors", utils.StringList{"array"}, "", utils.StringList{"object"}, ""}, + Args: []any{"colors", "application/json", utils.StringList{"array"}, "", utils.StringList{"object"}, ""}, Operation: "POST", Path: "/dogs", Source: load.NewSource("../data/checker/request_property_type_changed_revision_array_to_object.yaml"), OperationId: "addDog", }, errs[0]) + require.Equal(t, "type/format of request property 'colors' of media-type 'application/json' changed from 'array'/'' to 'object'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, checker.ApiChange{ Id: checker.RequestBodyTypeChangedId, Level: checker.ERR, - Args: []any{utils.StringList{"array"}, "", utils.StringList{"object"}, ""}, + Args: []any{"application/json", utils.StringList{"array"}, "", utils.StringList{"object"}, ""}, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_property_type_changed_revision_array_to_object.yaml"), OperationId: "addPet", }, errs[1]) + require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'array'/'' to 'object'/''", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request body and property types from object to array @@ -131,21 +137,24 @@ func TestRequestBodyAndPropertyTypesChangedCheckObjectToArray(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyTypeChangedId, Level: checker.ERR, - Args: []any{"colors", utils.StringList{"object"}, "", utils.StringList{"array"}, ""}, + Args: []any{"colors", "application/json", utils.StringList{"object"}, "", utils.StringList{"array"}, ""}, Operation: "POST", Path: "/dogs", Source: load.NewSource("../data/checker/request_property_type_changed_base_array_to_object.yaml"), OperationId: "addDog", }, errs[0]) + require.Equal(t, "type/format of request property 'colors' of media-type 'application/json' changed from 'object'/'' to 'array'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, checker.ApiChange{ Id: checker.RequestBodyTypeChangedId, Level: checker.ERR, - Args: []any{utils.StringList{"object"}, "", utils.StringList{"array"}, ""}, + Args: []any{"application/json", utils.StringList{"object"}, "", utils.StringList{"array"}, ""}, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_property_type_changed_base_array_to_object.yaml"), OperationId: "addPet", }, errs[1]) + require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'object'/'' to 'array'/''", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing request property format @@ -165,12 +174,13 @@ func TestRequestPropertyFormatChangedCheck(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyTypeChangedId, Level: checker.ERR, - Args: []any{"age", utils.StringList{"integer"}, "int32", utils.StringList{"integer"}, "uuid"}, + Args: []any{"age", "application/json", utils.StringList{"integer"}, "int32", utils.StringList{"integer"}, "uuid"}, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_property_type_changed_base.yaml"), OperationId: "addPet", }, errs[0]) + require.Equal(t, "type/format of request property 'age' of media-type 'application/json' changed from 'integer'/'int32' to 'integer'/'uuid'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: generalizing request property format @@ -191,10 +201,11 @@ func TestRequestPropertyFormatChangedCheckNonBreaking(t *testing.T) { require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyTypeGeneralizedId, Level: checker.INFO, - Args: []any{"age", utils.StringList{"integer"}, "int32", utils.StringList{"number"}, "int32"}, + Args: []any{"age", "application/json", utils.StringList{"integer"}, "int32", utils.StringList{"number"}, "int32"}, Operation: "POST", Path: "/pets", Source: load.NewSource("../data/checker/request_property_type_changed_base.yaml"), OperationId: "addPet", }, errs[0]) + require.Equal(t, "type/format of request property 'age' of media-type 'application/json' was generalized from 'integer'/'int32' to 'number'/'int32'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_response_pattern_added_or_changed_test.go b/checker/check_response_pattern_added_or_changed_test.go index ee03346d..9e8e79ca 100644 --- a/checker/check_response_pattern_added_or_changed_test.go +++ b/checker/check_response_pattern_added_or_changed_test.go @@ -31,7 +31,7 @@ func TestResponsePropertyPatternChanged(t *testing.T) { Source: load.NewSource("../data/checker/response_pattern_added_or_changed_revision.yaml"), OperationId: "createOneGroup", }, errs[0]) - require.Equal(t, "the 'data/created' response's property pattern was changed from '^[a-z]+$' to '^(?:([a-z]+-)*([a-z]+)?)$' for the status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "'data/created' response property pattern was changed from '^[a-z]+$' to '^(?:([a-z]+-)*([a-z]+)?)$' for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding response property pattern @@ -56,7 +56,7 @@ func TestResponsePropertyPatternAdded(t *testing.T) { Source: load.NewSource("../data/checker/response_pattern_added_or_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) - require.Equal(t, "the 'data/created' response's property pattern '^[a-z]+$' was added for the status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "'data/created' response property pattern '^[a-z]+$' was added for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing response property pattern @@ -81,5 +81,5 @@ func TestResponsePropertyPatternRemoved(t *testing.T) { Source: load.NewSource("../data/checker/response_pattern_added_or_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) - require.Equal(t, "the 'data/created' response's property pattern '^[a-z]+$' was removed for the status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "'data/created' response property pattern '^[a-z]+$' was removed for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_response_required_property_write_only_read_only_test.go b/checker/check_response_required_property_write_only_read_only_test.go index 99a5d6ab..a6880956 100644 --- a/checker/check_response_required_property_write_only_read_only_test.go +++ b/checker/check_response_required_property_write_only_read_only_test.go @@ -58,8 +58,8 @@ func TestResponseRequiredPropertyBecameNotWriteOnly(t *testing.T) { Source: load.NewSource("../data/checker/response_required_property_write_only_read_only_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "response required property 'data/writeOnlyName' became not write-only for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) require.Equal(t, "It is valid only if the property was always returned before the specification has been changed", errs[0].GetComment(checker.NewDefaultLocalizer())) - require.Equal(t, "the response required property 'data/writeOnlyName' became not write-only for the status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing required response property to read-only @@ -85,6 +85,7 @@ func TestResponseRequiredPropertyBecameReadOnly(t *testing.T) { Source: load.NewSource("../data/checker/response_required_property_write_only_read_only_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "response required property 'data/id' became read-only for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing required response property to not read-only @@ -111,4 +112,5 @@ func TestResponseRequiredPropertyBecameNonReadOnly(t *testing.T) { Source: load.NewSource("../data/checker/response_required_property_write_only_read_only_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "response required property 'data/id' became not read-only for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/example_test.go b/checker/example_test.go index cffc8397..c2cb79f6 100644 --- a/checker/example_test.go +++ b/checker/example_test.go @@ -65,7 +65,7 @@ func ExampleCheckBackwardCompatibility() { // Output: // 4 breaking changes: 1 error, 3 warning - // error at ../data/openapi-test3.yaml, in API GET /api/{domain}/{project}/badges/security-score removed the success response with the status '201' [response-success-status-removed]. + // error at ../data/openapi-test3.yaml, in API GET /api/{domain}/{project}/badges/security-score removed success response status '201' [response-success-status-removed]. // // warning at ../data/openapi-test3.yaml, in API GET /api/{domain}/{project}/badges/security-score deleted the 'cookie' request parameter 'test' [request-parameter-removed]. // diff --git a/checker/localizations/localizations.go b/checker/localizations/localizations.go index 9dbb9d5f..9e0601cb 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 -// 2024-07-17 10:54:08.151759 +0300 IDT m=+0.013463284 +// 2024-08-28 16:40:13.516781 +0300 IDT m=+0.004593543 package localizations @@ -16,13 +16,13 @@ var localizations = map[string]string{ "en.messages.api-deprecated-sunset-missing-description": "endpoint deprecated without sunset date", "en.messages.api-deprecated-sunset-parse": "failed to parse sunset date: %v", "en.messages.api-deprecated-sunset-parse-description": "endpoint deprecated with invalid sunset date", - "en.messages.api-global-security-added": "the security scheme %s was added to the API", + "en.messages.api-global-security-added": "security scheme %s was added", "en.messages.api-global-security-added-description": "security scheme added in security", - "en.messages.api-global-security-removed": "the security scheme %s was removed from the API", + "en.messages.api-global-security-removed": "security scheme %s was removed", "en.messages.api-global-security-removed-description": "security scheme deleted in security", - "en.messages.api-global-security-scope-added": "the security scope %s was added to the global security scheme %s", + "en.messages.api-global-security-scope-added": "security scope %s was added to global security scheme %s", "en.messages.api-global-security-scope-added-description": "scope added to a security scheme in security", - "en.messages.api-global-security-scope-removed": "the security scope %s was removed from the global security scheme %s", + "en.messages.api-global-security-scope-removed": "security scope %s was removed from global security scheme %s", "en.messages.api-global-security-scope-removed-description": "scope deleted from a security scheme in security", "en.messages.api-invalid-stability-level": "failed to parse stability level: %v", "en.messages.api-invalid-stability-level-description": "invalid stability level", @@ -40,33 +40,33 @@ var localizations = map[string]string{ "en.messages.api-removed-before-sunset-description": "endpoint deleted before sunset date", "en.messages.api-removed-without-deprecation": "api removed without deprecation", "en.messages.api-removed-without-deprecation-description": "endpoint deleted without deprecation", - "en.messages.api-schema-removed": "removed the schema %s", + "en.messages.api-schema-removed": "removed schema %s", "en.messages.api-schema-removed-description": "schema deleted from components/schemas", - "en.messages.api-security-added": "the endpoint scheme security %s was added to the API", + "en.messages.api-security-added": "endpoint scheme security %s was added", "en.messages.api-security-added-description": "security requirements added to endpoint", - "en.messages.api-security-component-added": "the component security scheme %s was added", + "en.messages.api-security-component-added": "component security scheme %s was added", "en.messages.api-security-component-added-description": "security scheme added in components/securitySchemes", - "en.messages.api-security-component-oauth-scope-added": "the component security scheme %s oauth scope %s was added", + "en.messages.api-security-component-oauth-scope-added": "component security scheme %s oauth scope %s was added", "en.messages.api-security-component-oauth-scope-added-description": "scope added to OAuth flow in components/securitySchemes", - "en.messages.api-security-component-oauth-scope-changed": "the component security scheme %s oauth scope %s was updated from %s to %s", + "en.messages.api-security-component-oauth-scope-changed": "component security scheme %s oauth scope %s was updated from %s to %s", "en.messages.api-security-component-oauth-scope-changed-description": "scope modified in OAuth flow in components/securitySchemes", - "en.messages.api-security-component-oauth-scope-removed": "the component security scheme %s oauth scope %s was removed", + "en.messages.api-security-component-oauth-scope-removed": "component security scheme %s oauth scope %s was removed", "en.messages.api-security-component-oauth-scope-removed-description": "scope deleted from OAuth flow in components/securitySchemes", - "en.messages.api-security-component-oauth-token-url-changed": "the component security scheme %s oauth token url changed from %s to %s", + "en.messages.api-security-component-oauth-token-url-changed": "component security scheme %s oauth token url changed from %s to %s", "en.messages.api-security-component-oauth-token-url-changed-description": "token URL modified in OAuth flow in components/securitySchemes", - "en.messages.api-security-component-oauth-url-changed": "the component security scheme %s oauth url changed from %s to %s", + "en.messages.api-security-component-oauth-url-changed": "component security scheme %s oauth url changed from %s to %s", "en.messages.api-security-component-oauth-url-changed-description": "auth URL modified in OAuth flow in components/securitySchemes", - "en.messages.api-security-component-removed": "the component security scheme %s was removed", + "en.messages.api-security-component-removed": "component security scheme %s was removed", "en.messages.api-security-component-removed-description": "security scheme deleted in components/securitySchemes", - "en.messages.api-security-component-type-changed": "the component security scheme %s type changed from %s to %s", + "en.messages.api-security-component-type-changed": "component security scheme %s type changed from %s to %s", "en.messages.api-security-component-type-changed-description": "security scheme type modified in components/securitySchemes", - "en.messages.api-security-removed": "the endpoint scheme security %s was removed from the API", + "en.messages.api-security-removed": "endpoint scheme security %s was removed", "en.messages.api-security-removed-description": "security requirements deleted from endpoint", - "en.messages.api-security-scope-added": "the security scope %s was added to the endpoint's security scheme %s", + "en.messages.api-security-scope-added": "security scope %s was added to endpoint security scheme %s", "en.messages.api-security-scope-added-description": "scope added to an endpoint's security scheme", - "en.messages.api-security-scope-removed": "the security scope %s was removed from the endpoint's security scheme %s", + "en.messages.api-security-scope-removed": "security scope %s was removed from endpoint security scheme %s", "en.messages.api-security-scope-removed-description": "scope deleted from an endpoint's security scheme", - "en.messages.api-security-updated": "the endpoint scheme security %s was updated from %s to %s", + "en.messages.api-security-updated": "endpoint scheme security %s was updated from %s to %s", "en.messages.api-stability-decreased": "endpoint stability level decreased from %s to %s", "en.messages.api-stability-decreased-description": "endpoint stability level decreased", "en.messages.api-sunset-date-changed-too-small": "api sunset date changed to earlier date from %s to %s, new sunset date must be not earlier than %s at least %s days from now", @@ -85,475 +85,475 @@ var localizations = map[string]string{ "en.messages.endpoint-reactivated": "endpoint reactivated", "en.messages.endpoint-reactivated-description": "endpoint reactivated (deprecation set to false)", "en.messages.in": "in", - "en.messages.new-optional-request-default-parameter-to-existing-path": "added the new optional %s request parameter %s to all path's operations", + "en.messages.new-optional-request-default-parameter-to-existing-path": "added optional %s request parameter %s to all path's operations", "en.messages.new-optional-request-default-parameter-to-existing-path-description": "optional request parameter added at path level", - "en.messages.new-optional-request-parameter": "added the new optional %s request parameter %s", + "en.messages.new-optional-request-parameter": "added optional %s request parameter %s", "en.messages.new-optional-request-parameter-description": "optional request parameter added to endpoint", - "en.messages.new-optional-request-property": "added the new optional request property %s", + "en.messages.new-optional-request-property": "added optional request property %s", "en.messages.new-optional-request-property-description": "optional property added to request", - "en.messages.new-request-path-parameter": "added the new path request parameter %s", + "en.messages.new-request-path-parameter": "added path request parameter %s", "en.messages.new-request-path-parameter-description": "new request path parameter", - "en.messages.new-required-request-default-parameter-to-existing-path": "added the new required %s request parameter %s to all path's operations", + "en.messages.new-required-request-default-parameter-to-existing-path": "added required %s request parameter %s to all path's operations", "en.messages.new-required-request-default-parameter-to-existing-path-description": "required request parameter added at path level", - "en.messages.new-required-request-header-property": "added the new required %s request header's property %s", + "en.messages.new-required-request-header-property": "added required %s request header's property %s", "en.messages.new-required-request-header-property-description": "new required request header", - "en.messages.new-required-request-parameter": "added the new required %s request parameter %s", + "en.messages.new-required-request-parameter": "added required %s request parameter %s", "en.messages.new-required-request-parameter-description": "required request parameter added to endpoint", - "en.messages.new-required-request-property": "added the new required request property %s", + "en.messages.new-required-request-property": "added required request property %s", "en.messages.new-required-request-property-description": "required property added to request", - "en.messages.new-required-request-property-with-default": "added the new required request property %s with a default value", + "en.messages.new-required-request-property-with-default": "added required request property %s with a default value to media-type %s", "en.messages.new-required-request-property-with-default-description": "required property with default value added to request", - "en.messages.optional-response-header-removed": "the optional response header %s removed for the status %s", + "en.messages.optional-response-header-removed": "optional header %s was removed for response status %s", "en.messages.optional-response-header-removed-description": "optional response header deleted", "en.messages.pattern-changed-warn-comment": "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')", "en.messages.request-body-added-optional": "added optional request body", "en.messages.request-body-added-optional-description": "optional request body added", "en.messages.request-body-added-required": "added required request body", "en.messages.request-body-added-required-description": "required request body added", - "en.messages.request-body-all-of-added": "added %s to the request body 'allOf' list", + "en.messages.request-body-all-of-added": "added %s to media-type %s of request body 'allOf' list", "en.messages.request-body-all-of-added-description": "sub-schema added to allOf in request body", - "en.messages.request-body-all-of-removed": "removed %s from the request body 'allOf' list", + "en.messages.request-body-all-of-removed": "removed %s from media-type %s of request body 'allOf' list", "en.messages.request-body-all-of-removed-description": "sub-schema deleted from allOf in request body", - "en.messages.request-body-any-of-added": "added %s to the request body 'anyOf' list", + "en.messages.request-body-any-of-added": "added %s to media-type %s of request body 'anyOf' list", "en.messages.request-body-any-of-added-description": "sub-schema added to anyOf in request body", - "en.messages.request-body-any-of-removed": "removed %s from the request body 'anyOf' list", + "en.messages.request-body-any-of-removed": "removed %s from media-type %s of request body 'anyOf' list", "en.messages.request-body-any-of-removed-description": "sub-schema deleted from anyOf in request body", - "en.messages.request-body-became-enum": "request body was restricted to a list of enum values", + "en.messages.request-body-became-enum": "media-type %s of request body was restricted to a list of enum values", "en.messages.request-body-became-enum-description": "request body restricted to enum", - "en.messages.request-body-became-not-nullable": "the request's body became not nullable", + "en.messages.request-body-became-not-nullable": "media-type %s of request body became not nullable", "en.messages.request-body-became-not-nullable-description": "null excluded as a possible value in request body", - "en.messages.request-body-became-nullable": "the request's body became nullable", + "en.messages.request-body-became-nullable": "media-type %s of request body became nullable", "en.messages.request-body-became-nullable-description": "null added as a possible value in request body", "en.messages.request-body-became-optional": "request body became optional", "en.messages.request-body-became-optional-description": "request body became optional", "en.messages.request-body-became-required": "request body became required", "en.messages.request-body-became-required-description": "request body became required", - "en.messages.request-body-default-value-added": "the request body %s default value %s was added", + "en.messages.request-body-default-value-added": "default value %s was added to media-type %s of request body", "en.messages.request-body-default-value-added-description": "request body default value set", - "en.messages.request-body-default-value-changed": "the request body %s default value changed from %s to %s", + "en.messages.request-body-default-value-changed": "default value of media-type %s of request body changed from %s to %s", "en.messages.request-body-default-value-changed-description": "request body default value modified", - "en.messages.request-body-default-value-removed": "the request body %s default value %s was removed", + "en.messages.request-body-default-value-removed": "default value %s was removed from media-type %s of request body", "en.messages.request-body-default-value-removed-description": "request body default value unset", "en.messages.request-body-discriminator-added": "added request discriminator", "en.messages.request-body-discriminator-added-description": "request body discriminator added", - "en.messages.request-body-discriminator-mapping-added": "added %s mapping keys to the request discriminator", + "en.messages.request-body-discriminator-mapping-added": "added %s mapping keys to request discriminator", "en.messages.request-body-discriminator-mapping-added-description": "request body discriminator mapping added", - "en.messages.request-body-discriminator-mapping-changed": "mapped value for key %s changed from %s to %s from the request discriminator", + "en.messages.request-body-discriminator-mapping-changed": "mapped value for key %s changed from %s to %s from request discriminator", "en.messages.request-body-discriminator-mapping-changed-description": "request body discriminator mapping changed", - "en.messages.request-body-discriminator-mapping-deleted": "removed %s mapping keys from the request discriminator", + "en.messages.request-body-discriminator-mapping-deleted": "removed %s mapping keys from request discriminator", "en.messages.request-body-discriminator-mapping-deleted-description": "request body discriminator mapping deleted", "en.messages.request-body-discriminator-property-name-changed": "request discriminator property name changed from %s to %s", "en.messages.request-body-discriminator-property-name-changed-description": "request body discriminator property name changed", "en.messages.request-body-discriminator-removed": "removed request discriminator", "en.messages.request-body-discriminator-removed-description": "request body discriminator deleted", - "en.messages.request-body-enum-value-removed": "request body enum value removed %s", + "en.messages.request-body-enum-value-removed": "enum value %s removed from media-type %s of request body", "en.messages.request-body-enum-value-removed-description": "request body enum value deleted", - "en.messages.request-body-max-decreased": "the request's body max was decreased to %s", + "en.messages.request-body-max-decreased": "max value of media-type %s of request body was decreased from %s to %s", "en.messages.request-body-max-decreased-description": "request body max decreased", - "en.messages.request-body-max-increased": "the request's body max was increased from %s to %s", + "en.messages.request-body-max-increased": "max value of media-type %s of request body was increased from %s to %s", "en.messages.request-body-max-increased-description": "request body max increased", - "en.messages.request-body-max-length-decreased": "the request's body maxLength was decreased to %s", + "en.messages.request-body-max-length-decreased": "maxLength value of media-type %s of request body was decreased from %s to %s", "en.messages.request-body-max-length-decreased-description": "request body max length decreased", - "en.messages.request-body-max-length-increased": "the request's body maxLength was increased from %s to %s", + "en.messages.request-body-max-length-increased": "maxLength value of media-type %s of request body was increased from %s to %s", "en.messages.request-body-max-length-increased-description": "request body max length increased", - "en.messages.request-body-max-length-set": "the request's body maxLength was set to %s", + "en.messages.request-body-max-length-set": "maxLength value of media-type %s of request body was set to %s", "en.messages.request-body-max-length-set-comment": "This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-body-max-length-set-description": "request body max length set", - "en.messages.request-body-max-set": "the request's body max was set to %s", + "en.messages.request-body-max-set": "max value of media-type %s of request body was set to %s", "en.messages.request-body-max-set-comment": "This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-body-max-set-description": "request body max set", - "en.messages.request-body-media-type-added": "added the media type %s to the request body", + "en.messages.request-body-media-type-added": "added media type %s to the request body", "en.messages.request-body-media-type-added-description": "request body media-type added", - "en.messages.request-body-media-type-removed": "removed the media type %s from the request body", + "en.messages.request-body-media-type-removed": "removed media type %s from the request body", "en.messages.request-body-media-type-removed-description": "request body media-type deleted", - "en.messages.request-body-min-decreased": "the request's body min was decreased to from %s to %s", + "en.messages.request-body-min-decreased": "min value of media-type %s of request body was decreased from %s to %s", "en.messages.request-body-min-decreased-description": "request body min decreased", - "en.messages.request-body-min-increased": "the request's body min was increased to %s", + "en.messages.request-body-min-increased": "min value of media-type %s of request body was increased to %s", "en.messages.request-body-min-increased-description": "request body min increased", "en.messages.request-body-min-items increased-description": "request body min items increased", "en.messages.request-body-min-items set-description": "request body min items set", - "en.messages.request-body-min-items-decreased": "the request's body minItems was decreased from %s to %s", - "en.messages.request-body-min-items-increased": "the request's body minItems was increased to %s", - "en.messages.request-body-min-items-set": "the request's body minItems was set to %s", + "en.messages.request-body-min-items-decreased": "minItems value of media-type %s of request body was decreased from %s to %s", + "en.messages.request-body-min-items-increased": "minItems value of media-type %s of request body was increased to %s", + "en.messages.request-body-min-items-set": "minItems value of media-type %s of request body was set to %s", "en.messages.request-body-min-items-set-comment": "This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification.", - "en.messages.request-body-min-length-decreased": "the request's body minLength was decreased from %s to %s", + "en.messages.request-body-min-length-decreased": "minLength value of media-type %s of request body was decreased from %s to %s", "en.messages.request-body-min-length-decreased-description": "request body min length decreased", - "en.messages.request-body-min-length-increased": "the request's body minLength was increased from %s to %s", + "en.messages.request-body-min-length-increased": "minLength value of media-type %s of request body was increased from %s to %s", "en.messages.request-body-min-length-increased-description": "request body min length increased", - "en.messages.request-body-min-set": "the request's body min was set to %s", + "en.messages.request-body-min-set": "min value of media-type %s of request body was set to %s", "en.messages.request-body-min-set-comment": "This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-body-min-set-description": "request body min set", - "en.messages.request-body-one-of-added": "added %s to the request body 'oneOf' list", + "en.messages.request-body-one-of-added": "added %s to media-type %s of request body 'oneOf' list", "en.messages.request-body-one-of-added-description": "sub-schema added to oneOf in request body", - "en.messages.request-body-one-of-removed": "removed %s from the request body 'oneOf' list", + "en.messages.request-body-one-of-removed": "removed %s from media-type %s of request body 'oneOf' list", "en.messages.request-body-one-of-removed-description": "sub-schema deleted from oneOf in request body", - "en.messages.request-body-type-changed": "the request's body type/format changed from %s/%s to %s/%s", + "en.messages.request-body-type-changed": "type/format of media-type %s of request body changed from %s/%s to %s/%s", "en.messages.request-body-type-changed-description": "request body type changed", - "en.messages.request-body-type-generalized": "the request's body type/format was generalized from %s/%s to %s/%s", + "en.messages.request-body-type-generalized": "type/format of media-type %s of request body was generalized from %s/%s to %s/%s", "en.messages.request-body-type-generalized-description": "request body type generalized", - "en.messages.request-header-property-became-enum": "the %s request header's property %s was restricted to a list of enum values", + "en.messages.request-header-property-became-enum": "%s request header's property %s was restricted to a list of enum values", "en.messages.request-header-property-became-enum-description": "request header property restricted to enum", - "en.messages.request-header-property-became-required": "the %s request header's property %s became required", + "en.messages.request-header-property-became-required": "%s request header's property %s became required", "en.messages.request-header-property-became-required-description": "request header property became required", - "en.messages.request-optional-property-became-not-read-only": "the request optional property %s became not read-only", + "en.messages.request-optional-property-became-not-read-only": "request optional property %s became not read-only", "en.messages.request-optional-property-became-not-read-only-description": "request optional property became not read-only", - "en.messages.request-optional-property-became-not-write-only": "the request optional property %s became not write-only", + "en.messages.request-optional-property-became-not-write-only": "request optional property %s became not write-only", "en.messages.request-optional-property-became-not-write-only-description": "request optional property became not write-only", - "en.messages.request-optional-property-became-read-only": "the request optional property %s became read-only", + "en.messages.request-optional-property-became-read-only": "request optional property %s became read-only", "en.messages.request-optional-property-became-read-only-description": "request optional property became read-only", - "en.messages.request-optional-property-became-write-only": "the request optional property %s became write-only", + "en.messages.request-optional-property-became-write-only": "request optional property %s became write-only", "en.messages.request-optional-property-became-write-only-description": "request optional property became write-only", - "en.messages.request-parameter-became-enum": "the %s request parameter %s was restricted to a list of enum values", + "en.messages.request-parameter-became-enum": "%s request parameter %s was restricted to a list of enum values", "en.messages.request-parameter-became-enum-description": "request parameter restricted to enum", - "en.messages.request-parameter-became-optional": "the %s request parameter %s became optional", + "en.messages.request-parameter-became-optional": "%s request parameter %s became optional", "en.messages.request-parameter-became-optional-description": "request parameter became optional", - "en.messages.request-parameter-became-required": "the %s request parameter %s became required", + "en.messages.request-parameter-became-required": "%s request parameter %s became required", "en.messages.request-parameter-became-required-description": "request parameter became required", - "en.messages.request-parameter-default-value-added": "for the %s request parameter %s, default value %s was added", + "en.messages.request-parameter-default-value-added": "for %s request parameter %s, default value %s was added", "en.messages.request-parameter-default-value-added-description": "request parameter default value set", - "en.messages.request-parameter-default-value-changed": "for the %s request parameter %s, default value was changed from %s to %s", + "en.messages.request-parameter-default-value-changed": "for %s request parameter %s, default value was changed from %s to %s", "en.messages.request-parameter-default-value-changed-description": "request parameter default value changed", - "en.messages.request-parameter-default-value-removed": "for the %s request parameter %s, default value %s was removed", + "en.messages.request-parameter-default-value-removed": "for %s request parameter %s, default value %s was removed", "en.messages.request-parameter-default-value-removed-description": "request parameter default value unset", - "en.messages.request-parameter-enum-value-added": "added the new enum value %s to the %s request parameter %s", + "en.messages.request-parameter-enum-value-added": "added enum value %s to the %s request parameter %s", "en.messages.request-parameter-enum-value-added-description": "request parameter enum value added", - "en.messages.request-parameter-enum-value-removed": "removed the enum value %s from the %s request parameter %s", + "en.messages.request-parameter-enum-value-removed": "removed enum value %s from the %s request parameter %s", "en.messages.request-parameter-enum-value-removed-description": "request parameter enum value deleted", - "en.messages.request-parameter-max-decreased": "for the %s request parameter %s, the max was decreased from %s to %s", + "en.messages.request-parameter-max-decreased": "for %s request parameter %s, max was decreased from %s to %s", "en.messages.request-parameter-max-decreased-description": "request parameter max decreased", - "en.messages.request-parameter-max-increased": "for the %s request parameter %s, the max was increased from %s to %s", + "en.messages.request-parameter-max-increased": "for %s request parameter %s, max was increased from %s to %s", "en.messages.request-parameter-max-increased-description": "request parameter max increased", - "en.messages.request-parameter-max-items-decreased": "for the %s request parameter %s, the maxItems was decreased from %s to %s", + "en.messages.request-parameter-max-items-decreased": "for %s request parameter %s, maxItems was decreased from %s to %s", "en.messages.request-parameter-max-items-decreased-description": "request parameter max items decreased", - "en.messages.request-parameter-max-items-increased": "for the %s request parameter %s, the maxItems was increased from %s to %s", + "en.messages.request-parameter-max-items-increased": "for %s request parameter %s, maxItems was increased from %s to %s", "en.messages.request-parameter-max-items-increased-description": "request parameter max items increased", - "en.messages.request-parameter-max-length-decreased": "for the %s request parameter %s, the maxLength was decreased from %s to %s", + "en.messages.request-parameter-max-length-decreased": "for %s request parameter %s, maxLength was decreased from %s to %s", "en.messages.request-parameter-max-length-decreased-description": "request parameter max length decreased", - "en.messages.request-parameter-max-length-increased": "for the %s request parameter %s, the maxLength was increased from %s to %s", + "en.messages.request-parameter-max-length-increased": "for %s request parameter %s, maxLength was increased from %s to %s", "en.messages.request-parameter-max-length-increased-description": "request parameter max length increased", - "en.messages.request-parameter-max-length-set": "for the %s request parameter %s, the maxLength was set to %s", + "en.messages.request-parameter-max-length-set": "for %s request parameter %s, maxLength was set to %s", "en.messages.request-parameter-max-length-set-comment": "This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-parameter-max-length-set-description": "request parameter max length set", - "en.messages.request-parameter-max-set": "for the %s request parameter %s, the max was set to %s", + "en.messages.request-parameter-max-set": "for %s request parameter %s, max was set to %s", "en.messages.request-parameter-max-set-comment": "This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-parameter-max-set-description": "request parameter max set", - "en.messages.request-parameter-min-decreased": "for the %s request parameter %s, the min was decreased from %s to %s", + "en.messages.request-parameter-min-decreased": "for %s request parameter %s, min was decreased from %s to %s", "en.messages.request-parameter-min-decreased-description": "request parameter min decreased", - "en.messages.request-parameter-min-increased": "for the %s request parameter %s, the min was increased from %s to %s", + "en.messages.request-parameter-min-increased": "for %s request parameter %s, min was increased from %s to %s", "en.messages.request-parameter-min-increased-description": "request parameter min increased", - "en.messages.request-parameter-min-items-decreased": "for the %s request parameter %s, the minItems was decreased from %s to %s", + "en.messages.request-parameter-min-items-decreased": "for %s request parameter %s, minItems was decreased from %s to %s", "en.messages.request-parameter-min-items-decreased-description": "request parameter min items decreased", - "en.messages.request-parameter-min-items-increased": "for the %s request parameter %s, the minItems was increased from %s to %s", + "en.messages.request-parameter-min-items-increased": "for %s request parameter %s, minItems was increased from %s to %s", "en.messages.request-parameter-min-items-increased-description": "request parameter min items increased", - "en.messages.request-parameter-min-items-set": "for the %s request parameter %s, the minItems was set to %s", + "en.messages.request-parameter-min-items-set": "for %s request parameter %s, minItems was set to %s", "en.messages.request-parameter-min-items-set-comment": "This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-parameter-min-items-set-description": "request parameter min items set", - "en.messages.request-parameter-min-length-decreased": "for the %s request parameter %s, the minLength was decreased from %s to %s", + "en.messages.request-parameter-min-length-decreased": "for %s request parameter %s, minLength was decreased from %s to %s", "en.messages.request-parameter-min-length-decreased-description": "request parameter min length decreased", - "en.messages.request-parameter-min-length-increased": "for the %s request parameter %s, the minLength was increased from %s to %s", + "en.messages.request-parameter-min-length-increased": "for %s request parameter %s, minLength was increased from %s to %s", "en.messages.request-parameter-min-length-increased-description": "request parameter min length increased", - "en.messages.request-parameter-min-set": "for the %s request parameter %s, the min was set to %s", + "en.messages.request-parameter-min-set": "for %s request parameter %s, min was set to %s", "en.messages.request-parameter-min-set-comment": "This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-parameter-min-set-description": "request parameter min set", - "en.messages.request-parameter-pattern-added": "added the pattern %s to the %s request parameter %s", + "en.messages.request-parameter-pattern-added": "added pattern %s to the %s request parameter %s", "en.messages.request-parameter-pattern-added-description": "request parameter pattern set", - "en.messages.request-parameter-pattern-changed": "changed the pattern of the %s request parameter %s from %s to %s", + "en.messages.request-parameter-pattern-changed": "changed pattern of the %s request parameter %s from %s to %s", "en.messages.request-parameter-pattern-changed-description": "request parameter pattern changed", - "en.messages.request-parameter-pattern-generalized": "changed the pattern of the %s request parameter %s from %s to a more general pattern %s", + "en.messages.request-parameter-pattern-generalized": "changed pattern of the %s request parameter %s from %s to a more general pattern %s", "en.messages.request-parameter-pattern-generalized-description": "request parameter pattern generalized", - "en.messages.request-parameter-pattern-removed": "removed the pattern %s from the %s request parameter %s", + "en.messages.request-parameter-pattern-removed": "removed pattern %s from the %s request parameter %s", "en.messages.request-parameter-pattern-removed-description": "request parameter pattern unset", - "en.messages.request-parameter-property-type-changed": "for the %s request parameter %s, the type/format of property %s was changed from %s/%s to %s/%s", + "en.messages.request-parameter-property-type-changed": "for %s request parameter %s, type/format of property %s was changed from %s/%s to %s/%s", "en.messages.request-parameter-property-type-changed-description": "request parameter property type changed", "en.messages.request-parameter-property-type-changed-warn-comment": "This is a warning because parameter objects can be passed in differnt ways, some of which allow this type change and others do not.", - "en.messages.request-parameter-property-type-generalized": "for the %s request parameter %s, the type/format of property %s was generalized from %s/%s to %s/%s", + "en.messages.request-parameter-property-type-generalized": "for %s request parameter %s, type/format of property %s was generalized from %s/%s to %s/%s", "en.messages.request-parameter-property-type-generalized-description": "request parameter property type generalized", - "en.messages.request-parameter-property-type-specialized": "for the %s request parameter %s, the type/format of property %s was specialized from %s/%s to %s/%s", + "en.messages.request-parameter-property-type-specialized": "for %s request parameter %s, type/format of property %s was specialized from %s/%s to %s/%s", "en.messages.request-parameter-property-type-specialized-description": "request parameter property type specialized", "en.messages.request-parameter-removed": "deleted the %s request parameter %s", "en.messages.request-parameter-removed-description": "request parameter deleted", - "en.messages.request-parameter-type-changed": "for the %s request parameter %s, the type/format was changed from %s/%s to %s/%s", + "en.messages.request-parameter-type-changed": "for %s request parameter %s, type/format was changed from %s/%s to %s/%s", "en.messages.request-parameter-type-changed-description": "request parameter type changed", - "en.messages.request-parameter-type-generalized": "for the %s request parameter %s, the type/format was generalized from %s/%s to %s/%s", + "en.messages.request-parameter-type-generalized": "for %s request parameter %s, type/format was generalized from %s/%s to %s/%s", "en.messages.request-parameter-type-generalized-description": "request parameter type generalized", - "en.messages.request-parameter-x-extensible-enum-value-removed": "removed the x-extensible-enum value %s from the %s request parameter %s", + "en.messages.request-parameter-x-extensible-enum-value-removed": "removed x-extensible-enum value %s from the %s request parameter %s", "en.messages.request-parameter-x-extensible-enum-value-removed-description": "request parameter-x-extensible-enum value deleted", - "en.messages.request-property-all-of-added": "added %s to the %s request property 'allOf' list", + "en.messages.request-property-all-of-added": "added %s to %s request property of media-type %s 'allOf' list", "en.messages.request-property-all-of-added-description": "sub-schema added to allOf in request property", - "en.messages.request-property-all-of-removed": "removed %s from the %s request property 'allOf' list", + "en.messages.request-property-all-of-removed": "removed %s from %s request property of media-type %s 'allOf' list", "en.messages.request-property-all-of-removed-description": "sub-schema deleted from allOf in request property", - "en.messages.request-property-any-of-added": "added %s to the %s request property 'anyOf' list", + "en.messages.request-property-any-of-added": "added %s to %s request property of media-type %s 'anyOf' list", "en.messages.request-property-any-of-added-description": "sub-schema deleted from anyOf in request property", - "en.messages.request-property-any-of-removed": "removed %s from the %s request property 'anyOf' list", + "en.messages.request-property-any-of-removed": "removed %s from %s request property of media-type %s 'anyOf' list", "en.messages.request-property-any-of-removed-description": "sub-schema deleted from anyOf in request property", - "en.messages.request-property-became-enum": "request property %s was restricted to a list of enum values", + "en.messages.request-property-became-enum": "request property %s of media-type %s was restricted to a list of enum values", "en.messages.request-property-became-enum-description": "request property restricted to enum", - "en.messages.request-property-became-not-nullable": "the request property %s became not nullable", + "en.messages.request-property-became-not-nullable": "request property %s of media-type %s became not nullable", "en.messages.request-property-became-not-nullable-description": "request property became not nullable", - "en.messages.request-property-became-nullable": "the request property %s became nullable", + "en.messages.request-property-became-nullable": "request property %s of media-type %s became nullable", "en.messages.request-property-became-nullable-description": "request property became nullable", - "en.messages.request-property-became-optional": "the request property %s became optional", + "en.messages.request-property-became-optional": "request property %s of media-type %s became optional", "en.messages.request-property-became-optional-description": "request property became optional", - "en.messages.request-property-became-required": "the request property %s became required", + "en.messages.request-property-became-required": "request property %s of media-type %s became required", "en.messages.request-property-became-required-description": "request property became required", - "en.messages.request-property-became-required-with-default": "the request property %s with a default value became required", + "en.messages.request-property-became-required-with-default": "request property %s with a default value became required in media-type %s", "en.messages.request-property-became-required-with-default-description": "request property with a default value became required", - "en.messages.request-property-default-value-added": "the %s request property default value %s was added", + "en.messages.request-property-default-value-added": "%s request property default value %s was added", "en.messages.request-property-default-value-added-description": "request property default value set", - "en.messages.request-property-default-value-changed": "the %s request property default value changed from %s to %s", + "en.messages.request-property-default-value-changed": "%s request property default value changed from %s to %s", "en.messages.request-property-default-value-changed-description": "request property default value changed", - "en.messages.request-property-default-value-removed": "the %s request property default value %s was removed", + "en.messages.request-property-default-value-removed": "%s request property default value %s was removed", "en.messages.request-property-default-value-removed-description": "request property default value unset", "en.messages.request-property-discriminator-added": "added discriminator to %s request property", "en.messages.request-property-discriminator-added-description": "request property discriminator added", - "en.messages.request-property-discriminator-mapping-added": "added %s discriminator mapping keys to the %s request property", + "en.messages.request-property-discriminator-mapping-added": "added %s discriminator mapping keys to %s request property", "en.messages.request-property-discriminator-mapping-added-description": "request property discriminator mapping added", "en.messages.request-property-discriminator-mapping-changed": "mapped value for discriminator key %s changed from %s to %s for %s request property", "en.messages.request-property-discriminator-mapping-changed-description": "request property discriminator mapping changed", - "en.messages.request-property-discriminator-mapping-deleted": "removed %s discriminator mapping keys from the %s request property", + "en.messages.request-property-discriminator-mapping-deleted": "removed %s discriminator mapping keys from %s request property", "en.messages.request-property-discriminator-mapping-deleted-description": "request property discriminator mapping deleted", "en.messages.request-property-discriminator-property-name-changed": "request discriminator property name changed for %s request property from %s to %s", "en.messages.request-property-discriminator-property-name-changed-description": "request property discriminator property name changed", "en.messages.request-property-discriminator-removed": "removed discriminator from %s request property", "en.messages.request-property-discriminator-removed-description": "request property discriminator removed", - "en.messages.request-property-enum-value-added": "added the new %s enum value to the request property %s", + "en.messages.request-property-enum-value-added": "added %s enum value to request property %s of media type %s", "en.messages.request-property-enum-value-added-description": "request property enum value added", - "en.messages.request-property-enum-value-removed": "removed the enum value %s of the request property %s", + "en.messages.request-property-enum-value-removed": "removed enum value %s of request property %s of media-type %s", "en.messages.request-property-enum-value-removed-description": "request property enum value removed", - "en.messages.request-property-max-decreased": "the %s request property's max was decreased to %s", + "en.messages.request-property-max-decreased": "max value of request property %s of media type %s was decreased from %s to %s", "en.messages.request-property-max-decreased-description": "request property max decreased", - "en.messages.request-property-max-increased": "the %s request property's max was increased from %s to %s", + "en.messages.request-property-max-increased": "max value of request property %s of media-type %s was increased from %s to %s", "en.messages.request-property-max-increased-description": "request property max increased", - "en.messages.request-property-max-length-decreased": "the %s request property's maxLength was decreased to %s", + "en.messages.request-property-max-length-decreased": "maxLength value of request property %s of media-type %s was decreased from %s to %s", "en.messages.request-property-max-length-decreased-description": "request property max length decreased", - "en.messages.request-property-max-length-increased": "the %s request property's maxLength was increased from %s to %s", + "en.messages.request-property-max-length-increased": "maxLength value of request property %s of media-type %s was increased from %s to %s", "en.messages.request-property-max-length-increased-description": "request property max length increased", - "en.messages.request-property-max-length-set": "the %s request property's maxLength was set to %s", + "en.messages.request-property-max-length-set": "maxLength value of request property %s of media-type %s was set to %s", "en.messages.request-property-max-length-set-comment": "This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-property-max-length-set-description": "request property max length set", - "en.messages.request-property-max-set": "the %s request property's max was set to %s", + "en.messages.request-property-max-set": "max value of request property %s of media-type %s was set to %s", "en.messages.request-property-max-set-comment": "This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-property-max-set-description": "request property max set", - "en.messages.request-property-min-decreased": "the %s request property's min was decreased from %s to %s", + "en.messages.request-property-min-decreased": "min value of request property %s of media-type %s was decreased from %s to %s", "en.messages.request-property-min-decreased-description": "request property min decreased", - "en.messages.request-property-min-increased": "the %s request property's min was increased to %s", + "en.messages.request-property-min-increased": "min value of request property %s of media-type %s was increased to %s", "en.messages.request-property-min-increased-description": "request property min increased", - "en.messages.request-property-min-items-decreased": "the %s request property's minItems was decreased from %s to %s", - "en.messages.request-property-min-items-increased": "the %s request property's minItems was increased to %s", + "en.messages.request-property-min-items-decreased": "minItems value of request property %s of media-type %s was decreased from %s to %s", + "en.messages.request-property-min-items-increased": "minItems value of request property %s of media-type %s was increased to %s", "en.messages.request-property-min-items-increased-description": "request property min items increased", - "en.messages.request-property-min-items-set": "the %s request property's minItems was set to %s", + "en.messages.request-property-min-items-set": "minItems value of request property %s of media-type %s was set to %s", "en.messages.request-property-min-items-set-comment": "This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-property-min-items-set-description": "request property min items set", - "en.messages.request-property-min-length-decreased": "the %s request property's minLength was decreased from %s to %s", + "en.messages.request-property-min-length-decreased": "minLength value of request property %s of media-type %s was decreased from %s to %s", "en.messages.request-property-min-length-decreased-description": "request property min length decreased", - "en.messages.request-property-min-length-increased": "the %s request property's minLength was increased from %s to %s", + "en.messages.request-property-min-length-increased": "minLength value of request property %s of media-type %s was increased from %s to %s", "en.messages.request-property-min-length-increased-description": "request property min length increased", - "en.messages.request-property-min-set": "the %s request property's min was set to %s", + "en.messages.request-property-min-set": "min value of request property %s of media-type %s was set to %s", "en.messages.request-property-min-set-comment": "This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification.", "en.messages.request-property-min-set-description": "request property min set", - "en.messages.request-property-one-of-added": "added %s to the %s request property 'oneOf' list", + "en.messages.request-property-one-of-added": "added %s to %s request property of media-type %s 'oneOf' list", "en.messages.request-property-one-of-added-description": "sub-schema added to oneOf in request property", - "en.messages.request-property-one-of-removed": "removed %s from the %s request property 'oneOf' list", + "en.messages.request-property-one-of-removed": "removed %s from %s request property of media-type %s 'oneOf' list", "en.messages.request-property-one-of-removed-description": "sub-schema deleted from oneOf in request property", - "en.messages.request-property-pattern-added": "added the pattern %s to the request property %s", + "en.messages.request-property-pattern-added": "added pattern %s to the request property %s of media-type %s", "en.messages.request-property-pattern-added-description": "request property pattern set", - "en.messages.request-property-pattern-changed": "changed the pattern of the request property %s from %s to %s", + "en.messages.request-property-pattern-changed": "changed pattern of the request property %s of media-type %s from %s to %s", "en.messages.request-property-pattern-changed-description": "request property pattern changed", - "en.messages.request-property-pattern-generalized": "changed the pattern of the request property %s from %s to a more general pattern %s", + "en.messages.request-property-pattern-generalized": "changed pattern of the request property %s of media-type %s from %s to a more general pattern %s", "en.messages.request-property-pattern-generalized-description": "request property pattern generalized", - "en.messages.request-property-pattern-removed": "removed the pattern %s from the request property %s", + "en.messages.request-property-pattern-removed": "removed pattern %s from the request property %s of media-type %s", "en.messages.request-property-pattern-removed-description": "request property pattern unset", - "en.messages.request-property-removed": "removed the request property %s", + "en.messages.request-property-removed": "removed request property %s of media-type %s", "en.messages.request-property-removed-description": "request property removed", - "en.messages.request-property-type-changed": "the %s request property type/format changed from %s/%s to %s/%s", + "en.messages.request-property-type-changed": "type/format of request property %s of media-type %s changed from %s/%s to %s/%s", "en.messages.request-property-type-changed-description": "request property type changed", - "en.messages.request-property-type-generalized": "the %s request property type/format was generalized from %s/%s to %s/%s", + "en.messages.request-property-type-generalized": "type/format of request property %s of media-type %s was generalized from %s/%s to %s/%s", "en.messages.request-property-type-generalized-description": "request property type generalized", - "en.messages.request-property-x-extensible-enum-value-removed": "removed the x-extensible-enum value %s of the request property %s", + "en.messages.request-property-x-extensible-enum-value-removed": "removed x-extensible-enum value %s of request property %s of media-type %s", "en.messages.request-property-x-extensible-enum-value-removed-description": "request property x-extensible-enum value removed", - "en.messages.request-read-only-property-enum-value-removed": "removed the enum value %s of the request read-only property %s", + "en.messages.request-read-only-property-enum-value-removed": "removed enum value %s of request read-only property %s of media-type %s", "en.messages.request-read-only-property-enum-value-removed-description": "request read-only property enum value removed", - "en.messages.request-read-only-property-max-decreased": "the %s request read-only property's max was decreased to %s", + "en.messages.request-read-only-property-max-decreased": "max value of request read-only property %s of media-type %swas decreased to %s", "en.messages.request-read-only-property-max-decreased-description": "request read-only property max decreased", - "en.messages.request-read-only-property-max-length-decreased": "the %s request read-only property's maxLength was decreased to %s", + "en.messages.request-read-only-property-max-length-decreased": "maxLength value of request read-only property %s of media-type %s was decreased from %s to %s", "en.messages.request-read-only-property-max-length-decreased-description": "request read-only property max length decreased", - "en.messages.request-read-only-property-min-increased": "the %s request read-only property's min was increased to %s", + "en.messages.request-read-only-property-min-increased": "min value of request read-only property %s of media-type %s was increased to %s", "en.messages.request-read-only-property-min-increased-description": "request read-only property min increased", - "en.messages.request-required-property-became-not-read-only": "the request required property %s became not read-only", + "en.messages.request-required-property-became-not-read-only": "request required property %s became not read-only", "en.messages.request-required-property-became-not-read-only-description": "request required property became not read-only", - "en.messages.request-required-property-became-not-write-only": "the request required property %s became not write-only", + "en.messages.request-required-property-became-not-write-only": "request required property %s became not write-only", "en.messages.request-required-property-became-not-write-only-description": "request required property became not write-only", - "en.messages.request-required-property-became-read-only": "the request required property %s became read-only", + "en.messages.request-required-property-became-read-only": "request required property %s became read-only", "en.messages.request-required-property-became-read-only-description": "request required property became read-only", - "en.messages.request-required-property-became-write-only": "the request required property %s became write-only", + "en.messages.request-required-property-became-write-only": "request required property %s became write-only", "en.messages.request-required-property-became-write-only-description": "request required property became write-only", - "en.messages.required-response-header-removed": "the mandatory response header %s removed for the status %s", + "en.messages.required-response-header-removed": "mandatory header %s was removed for response status %s", "en.messages.required-response-header-removed-description": "required response header removed", - "en.messages.response-body-all-of-added": "added %s to the response body 'allOf' list for the response status %s", + "en.messages.response-body-all-of-added": "added %s to response body 'allOf' list for response status %s", "en.messages.response-body-all-of-added-description": "sub-schema added to allOf in response body", - "en.messages.response-body-all-of-removed": "removed %s from the response body 'allOf' list for the response status %s", + "en.messages.response-body-all-of-removed": "removed %s from response body 'allOf' list for response status %s", "en.messages.response-body-all-of-removed-description": "sub-schema removed from allOf in response body", - "en.messages.response-body-any-of-added": "added %s to the response body 'anyOf' list for the response status %s", + "en.messages.response-body-any-of-added": "added %s to response body 'anyOf' list for response status %s", "en.messages.response-body-any-of-added-description": "sub-schema added to anyOf in response body", - "en.messages.response-body-any-of-removed": "removed %s from the response body 'anyOf' list for the response status %s", + "en.messages.response-body-any-of-removed": "removed %s from the response body 'anyOf' list for response status %s", "en.messages.response-body-any-of-removed-description": "sub-schema removed from anyOf in response body", - "en.messages.response-body-became-nullable": "the response's body became nullable", + "en.messages.response-body-became-nullable": "response body became nullable", "en.messages.response-body-became-nullable-description": "response body became nullable", - "en.messages.response-body-default-value-added": "the response body %s default value %s was added for the status %s", + "en.messages.response-body-default-value-added": "response body %s default value %s was added for status %s", "en.messages.response-body-default-value-added-description": "response body default value set", - "en.messages.response-body-default-value-changed": "the response body %s default value changed from %s to %s for the status %s", + "en.messages.response-body-default-value-changed": "response body %s default value changed from %s to %s for status %s", "en.messages.response-body-default-value-changed-description": "response body default value changed", - "en.messages.response-body-default-value-removed": "the response body %s default value %s was removed for the status %s", + "en.messages.response-body-default-value-removed": "response body %s default value %s was removed for status %s", "en.messages.response-body-default-value-removed-description": "response body default value unset", - "en.messages.response-body-discriminator-added": "added response discriminator for the response status %s", + "en.messages.response-body-discriminator-added": "added response discriminator for response status %s", "en.messages.response-body-discriminator-added-description": "response body discriminator added", - "en.messages.response-body-discriminator-mapping-added": "added %s mapping keys to the response discriminator for the response status %s", + "en.messages.response-body-discriminator-mapping-added": "added %s mapping keys to response discriminator for response status %s", "en.messages.response-body-discriminator-mapping-added-description": "response body discriminator mapping added", - "en.messages.response-body-discriminator-mapping-changed": "mapped value for key %s changed from %s to %s from the response discriminator for the response status %s", + "en.messages.response-body-discriminator-mapping-changed": "mapped value for key %s changed from %s to %s from the response discriminator for response status %s", "en.messages.response-body-discriminator-mapping-changed-description": "response body discriminator mapping changed", - "en.messages.response-body-discriminator-mapping-deleted": "removed %s mapping keys from the response discriminator for the response status %s", + "en.messages.response-body-discriminator-mapping-deleted": "removed %s mapping keys from response discriminator for response status %s", "en.messages.response-body-discriminator-mapping-deleted-description": "response body discriminator mapping deleted", - "en.messages.response-body-discriminator-property-name-changed": "response discriminator property name changed from %s to %s for the response status %s", + "en.messages.response-body-discriminator-property-name-changed": "response discriminator property name changed from %s to %s for response status %s", "en.messages.response-body-discriminator-property-name-changed-description": "response body discriminator property name changed", - "en.messages.response-body-discriminator-removed": "removed response discriminator for the response status %s", + "en.messages.response-body-discriminator-removed": "removed response discriminator for response status %s", "en.messages.response-body-discriminator-removed-description": "response body discriminator removed", - "en.messages.response-body-max-increased": "the response's body max was increased from %s to %s", + "en.messages.response-body-max-increased": "max value of response body was increased from %s to %s", "en.messages.response-body-max-increased-description": "response body max increased", - "en.messages.response-body-max-length-increased": "the response's body maxLength was increased from %s to %s", + "en.messages.response-body-max-length-increased": "maxLength value of response body was increased from %s to %s", "en.messages.response-body-max-length-increased-description": "response body max length increased", - "en.messages.response-body-max-length-unset": "the response's body maxLength was unset from %s", + "en.messages.response-body-max-length-unset": "maxLength value of response body was unset from %s", "en.messages.response-body-max-length-unset-description": "response body max length unset", - "en.messages.response-body-min-decreased": "the response's body min was decreased from %s to %s", + "en.messages.response-body-min-decreased": "min value of response body was decreased from %s to %s", "en.messages.response-body-min-decreased-description": "response body min decreased", - "en.messages.response-body-min-items-decreased": "the response's body minItems was decreased from %s to %s", + "en.messages.response-body-min-items-decreased": "minItems value of response body was decreased from %s to %s", "en.messages.response-body-min-items-decreased-description": "response body min items decreased", - "en.messages.response-body-min-items-unset": "the response's body minItems was unset from %s", + "en.messages.response-body-min-items-unset": "minItems value of response body was unset from %s", "en.messages.response-body-min-items-unset-description": "response body min items unset", - "en.messages.response-body-min-length-decreased": "the response's body minLength was decreased from %s to %s", + "en.messages.response-body-min-length-decreased": "minLength value of response body was decreased from %s to %s", "en.messages.response-body-min-length-decreased-description": "response body min length decreased", - "en.messages.response-body-one-of-added": "added %s to the response body 'oneOf' list for the response status %s", + "en.messages.response-body-one-of-added": "added %s to response body 'oneOf' list for response status %s", "en.messages.response-body-one-of-added-description": "sub-schema added to oneOf in response body", - "en.messages.response-body-one-of-removed": "removed %s from the response body 'oneOf' list for the response status %s", + "en.messages.response-body-one-of-removed": "removed %s from response body 'oneOf' list for response status %s", "en.messages.response-body-one-of-removed-description": "sub-schema removed from oneOf in response body", - "en.messages.response-body-type-changed": "the response's body type/format changed from %s/%s to %s/%s for status %s", + "en.messages.response-body-type-changed": "body type/format changed from %s/%s to %s/%s for response status %s", "en.messages.response-body-type-changed-description": "response body type changed", - "en.messages.response-header-became-optional": "the response header %s became optional for the status %s", + "en.messages.response-header-became-optional": "header %s became optional for response status %s", "en.messages.response-header-became-optional-description": "response header became optional", - "en.messages.response-media-type-added": "added the media type %s for the response with the status %s", + "en.messages.response-media-type-added": "added media type %s for response status %s", "en.messages.response-media-type-added-description": "response media type added", - "en.messages.response-media-type-removed": "removed the media type %s for the response with the status %s", + "en.messages.response-media-type-removed": "removed media type %s for response status %s", "en.messages.response-media-type-removed-description": "response media type removed", "en.messages.response-mediatype-enum-value-removed": "response schema %s enum value removed %s", "en.messages.response-mediatype-enum-value-removed-description": "response mediatype enum value removed", - "en.messages.response-non-success-status-added": "added the non-success response with the status %s", + "en.messages.response-non-success-status-added": "added non-success response status %s", "en.messages.response-non-success-status-added-description": "response non-success status added", - "en.messages.response-non-success-status-removed": "removed the non-success response with the status %s", + "en.messages.response-non-success-status-removed": "removed non-success response status %s", "en.messages.response-non-success-status-removed-description": "response non-success status removed", - "en.messages.response-optional-property-added": "added the optional property %s to the response with the %s status", + "en.messages.response-optional-property-added": "added optional property %s to response status %s", "en.messages.response-optional-property-added-description": "response optional property added", - "en.messages.response-optional-property-became-not-read-only": "the response optional property %s became not read-only for the status %s", + "en.messages.response-optional-property-became-not-read-only": "response optional property %s became not read-only for status %s", "en.messages.response-optional-property-became-not-read-only-description": "response optional property became not read-only", - "en.messages.response-optional-property-became-not-write-only": "the response optional property %s became not write-only for the status %s", + "en.messages.response-optional-property-became-not-write-only": "response optional property %s became not write-only for status %s", "en.messages.response-optional-property-became-not-write-only-description": "response optional property became not write-only", - "en.messages.response-optional-property-became-read-only": "the response optional property %s became read-only for the status %s", + "en.messages.response-optional-property-became-read-only": "response optional property %s became read-only for status %s", "en.messages.response-optional-property-became-read-only-description": "response optional property became read-only", - "en.messages.response-optional-property-became-write-only": "the response optional property %s became write-only for the status %s", + "en.messages.response-optional-property-became-write-only": "response optional property %s became write-only for status %s", "en.messages.response-optional-property-became-write-only-description": "response optional property became write-only", - "en.messages.response-optional-property-removed": "removed the optional property %s from the response with the %s status", + "en.messages.response-optional-property-removed": "removed optional property %s from response status %s", "en.messages.response-optional-property-removed-description": "response optional property removed", - "en.messages.response-optional-write-only-property-added": "added the optional write-only property %s to the response with the %s status", + "en.messages.response-optional-write-only-property-added": "added optional write-only property %s to response status %s", "en.messages.response-optional-write-only-property-added-description": "response optional write-only property added", - "en.messages.response-optional-write-only-property-removed": "removed the optional write-only property %s from the response with the %s status", + "en.messages.response-optional-write-only-property-removed": "removed optional write-only property %s from response status %s", "en.messages.response-optional-write-only-property-removed-description": "response optional write-only property removed", - "en.messages.response-property-all-of-added": "added %s to the %s response property 'allOf' list for the response status %s", + "en.messages.response-property-all-of-added": "added %s to %s response property 'allOf' list for response status %s", "en.messages.response-property-all-of-added-description": "sub-schema added to allOf in response property", - "en.messages.response-property-all-of-removed": "removed %s from the %s response property 'allOf' list for the response status %s", + "en.messages.response-property-all-of-removed": "removed %s from %s response property 'allOf' list for response status %s", "en.messages.response-property-all-of-removed-description": "sub-schema removed from allOf in response property", - "en.messages.response-property-any-of-added": "added %s to the %s response property 'anyOf' list for the response status %s", + "en.messages.response-property-any-of-added": "added %s to %s response property 'anyOf' list for response status %s", "en.messages.response-property-any-of-added-description": "sub-schema added to anyOf in response property", - "en.messages.response-property-any-of-removed": "removed %s from the %s response property 'anyOf' list for the response status %s", + "en.messages.response-property-any-of-removed": "removed %s from %s response property 'anyOf' list for response status %s", "en.messages.response-property-any-of-removed-description": "sub-schema removed from anyOf in response property", - "en.messages.response-property-became-nullable": "the response property %s became nullable for the status %s", + "en.messages.response-property-became-nullable": "property %s became nullable for response status %s", "en.messages.response-property-became-nullable-description": "response property became nullable", - "en.messages.response-property-became-optional": "the response property %s became optional for the status %s", + "en.messages.response-property-became-optional": "property %s became optional for response status %s", "en.messages.response-property-became-optional-description": "response property became optional", - "en.messages.response-property-became-required": "the response property %s became required for the status %s", + "en.messages.response-property-became-required": "property %s became required for response status %s", "en.messages.response-property-became-required-description": "response property became required", - "en.messages.response-property-default-value-added": "the %s response's property default value %s was added for the status %s", + "en.messages.response-property-default-value-added": "%s response property default value %s was added for status %s", "en.messages.response-property-default-value-added-description": "response property default value set", - "en.messages.response-property-default-value-changed": "the %s response's property default value changed from %s to %s for the status %s", + "en.messages.response-property-default-value-changed": "%s response property default value changed from %s to %s for status %s", "en.messages.response-property-default-value-changed-description": "response property default value changed", - "en.messages.response-property-default-value-removed": "the %s response's property default value %s was removed for the status %s", + "en.messages.response-property-default-value-removed": "%s response property default value %s was removed for status %s", "en.messages.response-property-default-value-removed-description": "response property default value unset", - "en.messages.response-property-discriminator-added": "added discriminator to %s response property for the response status %s", + "en.messages.response-property-discriminator-added": "added discriminator to %s response property for response status %s", "en.messages.response-property-discriminator-added-description": "response property discriminator added", - "en.messages.response-property-discriminator-mapping-added": "added %s discriminator mapping keys to the %s response property for the response status %s", + "en.messages.response-property-discriminator-mapping-added": "added %s discriminator mapping keys to %s response property for response status %s", "en.messages.response-property-discriminator-mapping-added-description": "response property discriminator mapping added", - "en.messages.response-property-discriminator-mapping-changed": "mapped value for discriminator key %s changed from %s to %s for %s response property for the response status %s", + "en.messages.response-property-discriminator-mapping-changed": "mapped value for discriminator key %s changed from %s to %s for %s response property for response status %s", "en.messages.response-property-discriminator-mapping-changed-description": "response property discriminator mapping changed", - "en.messages.response-property-discriminator-mapping-deleted": "removed %s discriminator mapping keys from the %s response property for the response status %s", + "en.messages.response-property-discriminator-mapping-deleted": "removed %s discriminator mapping keys from %s response property for response status %s", "en.messages.response-property-discriminator-mapping-deleted-description": "response property discriminator mapping deleted", - "en.messages.response-property-discriminator-property-name-changed": "response discriminator property name changed for %s response property from %s to %s for the response status %s", + "en.messages.response-property-discriminator-property-name-changed": "response discriminator property name changed for %s response property from %s to %s for response status %s", "en.messages.response-property-discriminator-property-name-changed-description": "response property discriminator property name changed", - "en.messages.response-property-discriminator-removed": "removed discriminator from %s response property for the response status %s", + "en.messages.response-property-discriminator-removed": "removed discriminator from %s response property for response status %s", "en.messages.response-property-discriminator-removed-description": "response property discriminator removed", - "en.messages.response-property-enum-value-added": "added the new %s enum value to the %s response property for the response status %s", + "en.messages.response-property-enum-value-added": "added %s enum value to the %s response property for response status %s", "en.messages.response-property-enum-value-added-comment": "Adding new enum values to response could be unexpected for clients, use x-extensible-enum instead.", "en.messages.response-property-enum-value-added-description": "response property enum value added", - "en.messages.response-property-enum-value-removed": "removed the %s enum value from the %s response property for the response status %s", + "en.messages.response-property-enum-value-removed": "removed %s enum value from %s response property for response status %s", "en.messages.response-property-enum-value-removed-description": "response property enum value removed", - "en.messages.response-property-max-increased": "the %s response property's max was increased from %s to %s for the response status %s", + "en.messages.response-property-max-increased": "max value of %s response property was increased from %s to %s for response status %s", "en.messages.response-property-max-increased-description": "response property max increased", - "en.messages.response-property-max-length-increased": "the %s response property's maxLength was increased from %s to %s for the response status %s", + "en.messages.response-property-max-length-increased": "maxLength value of %s response property was increased from %s to %s for response status %s", "en.messages.response-property-max-length-increased-description": "response property max length increased", - "en.messages.response-property-max-length-unset": "the %s response property's maxLength was unset from %s for the response status %s", + "en.messages.response-property-max-length-unset": "maxLength value of %s response property was unset from %s for response status %s", "en.messages.response-property-max-length-unset-description": "response property max length unset", - "en.messages.response-property-min-decreased": "the %s response property's min was decreased from %s to %s for the response status %s", + "en.messages.response-property-min-decreased": "min value of %s response property was decreased from %s to %s for response status %s", "en.messages.response-property-min-decreased-description": "response property min decreased", - "en.messages.response-property-min-items-decreased": "the %s response property's minItems was decreased from %s to %s for the response status %s", + "en.messages.response-property-min-items-decreased": "minItems value of %s response property was decreased from %s to %s for response status %s", "en.messages.response-property-min-items-decreased-description": "response property min items decreased", - "en.messages.response-property-min-items-unset": "the %s response property's minItems was unset from %s for the response status %s", + "en.messages.response-property-min-items-unset": "minItems value of %s response property was unset from %s for response status %s", "en.messages.response-property-min-items-unset-description": "response property min items unset", - "en.messages.response-property-min-length-decreased": "the %s response property's minLength was decreased from %s to %s for the response status %s", + "en.messages.response-property-min-length-decreased": "minLength value of %s response property was decreased from %s to %s for response status %s", "en.messages.response-property-min-length-decreased-description": "response property min length decreased", - "en.messages.response-property-one-of-added": "added %s to the %s response property 'oneOf' list for the response status %s", + "en.messages.response-property-one-of-added": "added %s to %s response property 'oneOf' list for response status %s", "en.messages.response-property-one-of-added-description": "sub-schema added to oneOf in response property", - "en.messages.response-property-one-of-removed": "removed %s from the %s response property 'oneOf' list for the response status %s", + "en.messages.response-property-one-of-removed": "removed %s from %s response property 'oneOf' list for response status %s", "en.messages.response-property-one-of-removed-description": "sub-schema removed from oneOf in response property", - "en.messages.response-property-pattern-added": "the %s response's property pattern %s was added for the status %s", + "en.messages.response-property-pattern-added": "%s response property pattern %s was added for status %s", "en.messages.response-property-pattern-added-description": "response property pattern set", - "en.messages.response-property-pattern-changed": "the %s response's property pattern was changed from %s to %s for the status %s", + "en.messages.response-property-pattern-changed": "%s response property pattern was changed from %s to %s for status %s", "en.messages.response-property-pattern-changed-description": "response property pattern changed", - "en.messages.response-property-pattern-removed": "the %s response's property pattern %s was removed for the status %s", + "en.messages.response-property-pattern-removed": "%s response property pattern %s was removed for status %s", "en.messages.response-property-pattern-removed-description": "response property pattern unset", - "en.messages.response-property-type-changed": "the %s response's property type/format changed from %s/%s to %s/%s for status %s", + "en.messages.response-property-type-changed": "%s response property type/format changed from %s/%s to %s/%s for status %s", "en.messages.response-property-type-changed-description": "response property type changed", - "en.messages.response-required-property-added": "added the required property %s to the response with the %s status", + "en.messages.response-required-property-added": "added required property %s to response status %s", "en.messages.response-required-property-added-description": "response required property added", - "en.messages.response-required-property-became-not-read-only": "the response required property %s became not read-only for the status %s", + "en.messages.response-required-property-became-not-read-only": "response required property %s became not read-only for status %s", "en.messages.response-required-property-became-not-read-only-description": "response required property became not read-only", - "en.messages.response-required-property-became-not-write-only": "the response required property %s became not write-only for the status %s", + "en.messages.response-required-property-became-not-write-only": "response required property %s became not write-only for status %s", "en.messages.response-required-property-became-not-write-only-comment": "It is valid only if the property was always returned before the specification has been changed", "en.messages.response-required-property-became-not-write-only-description": "response required property became not write-only", - "en.messages.response-required-property-became-read-only": "the response required property %s became read-only for the status %s", + "en.messages.response-required-property-became-read-only": "response required property %s became read-only for status %s", "en.messages.response-required-property-became-read-only-description": "response required property became read-only", - "en.messages.response-required-property-became-write-only": "the response required property %s became write-only for the status %s", + "en.messages.response-required-property-became-write-only": "response required property %s became write-only for status %s", "en.messages.response-required-property-became-write-only-description": "response required property became write-only", - "en.messages.response-required-property-removed": "removed the required property %s from the response with the %s status", + "en.messages.response-required-property-removed": "removed required property %s from response status %s", "en.messages.response-required-property-removed-description": "response required property removed", - "en.messages.response-required-write-only-property-added": "added the required write-only property %s to the response with the %s status", + "en.messages.response-required-write-only-property-added": "added required write-only property %s tohe response status %s", "en.messages.response-required-write-only-property-added-description": "response required write-only property added", - "en.messages.response-required-write-only-property-removed": "removed the required write-only property %s from the response with the %s status", + "en.messages.response-required-write-only-property-removed": "removed required write-only property %s from response status %s", "en.messages.response-required-write-only-property-removed-description": "response required write-only property removed", - "en.messages.response-success-status-added": "added the success response with the status %s", + "en.messages.response-success-status-added": "added success response status %s", "en.messages.response-success-status-added-description": "response success status added", - "en.messages.response-success-status-removed": "removed the success response with the status %s", + "en.messages.response-success-status-removed": "removed success response status %s", "en.messages.response-success-status-removed-description": "response success status removed", - "en.messages.response-write-only-property-became-optional": "the response write-only property %s became optional for the status %s", + "en.messages.response-write-only-property-became-optional": "write-only property %s became optional for response status %s", "en.messages.response-write-only-property-became-optional-description": "response write-only property became optional", - "en.messages.response-write-only-property-became-required": "the response write-only property %s became required for the status %s", + "en.messages.response-write-only-property-became-required": "write-only property %s became required for response status %s", "en.messages.response-write-only-property-became-required-description": "response write-only property became required", - "en.messages.response-write-only-property-enum-value-added": "added the new %s enum value to the %s response write-only property for the response status %s", + "en.messages.response-write-only-property-enum-value-added": "added %s enum value to %s response write-only property for response status %s", "en.messages.response-write-only-property-enum-value-added-description": "response write-only property enum value added", "en.messages.sunset-deleted": "api sunset date deleted, but deprecated=true kept", "en.messages.sunset-deleted-description": "sunset deleted", diff --git a/checker/localizations_src/en/messages.yaml b/checker/localizations_src/en/messages.yaml index 804b7ec1..f220fbc4 100644 --- a/checker/localizations_src/en/messages.yaml +++ b/checker/localizations_src/en/messages.yaml @@ -5,20 +5,20 @@ request-body-added-optional: added optional request body request-parameter-removed: deleted the %s request parameter %s total-errors: "%d breaking changes: %d %s, %d %s\\n" total-changes: "%d changes: %d %s, %d %s, %d %s\\n" -request-parameter-pattern-added: "added the pattern %s to the %s request parameter %s" -request-parameter-pattern-removed: "removed the pattern %s from the %s request parameter %s" -request-parameter-pattern-changed: "changed the pattern of the %s request parameter %s from %s to %s" -request-parameter-pattern-generalized: "changed the pattern of the %s request parameter %s from %s to a more general pattern %s" -request-property-pattern-added: "added the pattern %s to the request property %s" -request-property-pattern-removed: "removed the pattern %s from the request property %s" -request-property-pattern-changed: "changed the pattern of the request property %s from %s to %s" -request-property-pattern-generalized: "changed the pattern of the request property %s from %s to a more general pattern %s" +request-parameter-pattern-added: added pattern %s to the %s request parameter %s +request-parameter-pattern-removed: removed pattern %s from the %s request parameter %s +request-parameter-pattern-changed: changed pattern of the %s request parameter %s from %s to %s +request-parameter-pattern-generalized: changed pattern of the %s request parameter %s from %s to a more general pattern %s +request-property-pattern-added: added pattern %s to the request property %s of media-type %s +request-property-pattern-removed: removed pattern %s from the request property %s of media-type %s +request-property-pattern-changed: changed pattern of the request property %s of media-type %s from %s to %s +request-property-pattern-generalized: changed pattern of the request property %s of media-type %s from %s to a more general pattern %s api-deprecated-sunset-parse: "failed to parse sunset date: %v" api-path-sunset-parse: "failed to parse sunset date: %v" -api-stability-decreased: "endpoint stability level decreased from %s to %s" +api-stability-decreased: endpoint stability level decreased from %s to %s api-invalid-stability-level: "failed to parse stability level: %v" -api-deprecated-sunset-missing: "sunset date is missing for deprecated API" -api-sunset-date-too-small: "sunset date %s is too small, must be at least %s days from now" +api-deprecated-sunset-missing: sunset date is missing for deprecated API +api-sunset-date-too-small: sunset date %s is too small, must be at least %s days from now endpoint-added: endpoint added endpoint-deprecated: endpoint deprecated endpoint-reactivated: endpoint reactivated @@ -30,260 +30,260 @@ api-operation-id-removed: api operation id %s removed and replaced with %s api-operation-id-added: api operation id %s was added api-tag-removed: api tag %s removed api-tag-added: api tag %s added -api-schema-removed: removed the schema %s +api-schema-removed: removed schema %s sunset-deleted: api sunset date deleted, but deprecated=true kept api-sunset-date-changed-too-small: api sunset date changed to earlier date from %s to %s, new sunset date must be not earlier than %s at least %s days from now -new-required-request-parameter: added the new required %s request parameter %s -new-optional-request-parameter: added the new optional %s request parameter %s -new-required-request-property: added the new required request property %s -new-required-request-property-with-default: added the new required request property %s with a default value -new-optional-request-property: added the new optional request property %s -new-required-request-header-property: added the new required %s request header's property %s +new-required-request-parameter: added required %s request parameter %s +new-optional-request-parameter: added optional %s request parameter %s +new-required-request-property: added required request property %s +new-required-request-property-with-default: added required request property %s with a default value to media-type %s +new-optional-request-property: added optional request property %s +new-required-request-header-property: added required %s request header's property %s request-body-became-required: request body became required request-body-became-optional: request body became optional -request-body-became-enum: request body was restricted to a list of enum values -request-body-enum-value-removed: request body enum value removed %s +request-body-became-enum: media-type %s of request body was restricted to a list of enum values +request-body-enum-value-removed: enum value %s removed from media-type %s of request body response-mediatype-enum-value-removed: response schema %s enum value removed %s -request-header-property-became-required: the %s request header's property %s became required -request-header-property-became-enum: the %s request header's property %s was restricted to a list of enum values -request-parameter-became-required: the %s request parameter %s became required -request-parameter-became-optional: the %s request parameter %s became optional -request-parameter-became-enum: the %s request parameter %s was restricted to a list of enum values -request-parameter-enum-value-removed: removed the enum value %s from the %s request parameter %s -request-parameter-enum-value-added: added the new enum value %s to the %s request parameter %s -pattern-changed-warn-comment: "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')" -request-parameter-x-extensible-enum-value-removed: removed the x-extensible-enum value %s from the %s request parameter %s -request-parameter-max-decreased: for the %s request parameter %s, the max was decreased from %s to %s -request-parameter-max-increased: for the %s request parameter %s, the max was increased from %s to %s -request-parameter-default-value-added: for the %s request parameter %s, default value %s was added -request-parameter-default-value-changed: for the %s request parameter %s, default value was changed from %s to %s -request-parameter-default-value-removed: for the %s request parameter %s, default value %s was removed -request-parameter-max-length-decreased: for the %s request parameter %s, the maxLength was decreased from %s to %s -request-parameter-max-length-increased: for the %s request parameter %s, the maxLength was increased from %s to %s -request-parameter-min-length-increased: for the %s request parameter %s, the minLength was increased from %s to %s -request-parameter-min-length-decreased: for the %s request parameter %s, the minLength was decreased from %s to %s -request-parameter-max-length-set: for the %s request parameter %s, the maxLength was set to %s -request-parameter-max-length-set-comment: "This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification." -request-parameter-max-set: for the %s request parameter %s, the max was set to %s -request-parameter-max-set-comment: "This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification." -request-parameter-min-increased: for the %s request parameter %s, the min was increased from %s to %s -request-parameter-min-decreased: for the %s request parameter %s, the min was decreased from %s to %s -request-parameter-max-items-decreased: for the %s request parameter %s, the maxItems was decreased from %s to %s -request-parameter-max-items-increased: for the %s request parameter %s, the maxItems was increased from %s to %s -request-parameter-min-items-increased: for the %s request parameter %s, the minItems was increased from %s to %s -request-parameter-min-items-decreased: for the %s request parameter %s, the minItems was decreased from %s to %s -request-parameter-min-items-set: for the %s request parameter %s, the minItems was set to %s +request-header-property-became-required: "%s request header's property %s became required" +request-header-property-became-enum: "%s request header's property %s was restricted to a list of enum values" +request-parameter-became-required: "%s request parameter %s became required" +request-parameter-became-optional: "%s request parameter %s became optional" +request-parameter-became-enum: "%s request parameter %s was restricted to a list of enum values" +request-parameter-enum-value-removed: removed enum value %s from the %s request parameter %s +request-parameter-enum-value-added: added enum value %s to the %s request parameter %s +pattern-changed-warn-comment: This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*') +request-parameter-x-extensible-enum-value-removed: removed x-extensible-enum value %s from the %s request parameter %s +request-parameter-max-decreased: for %s request parameter %s, max was decreased from %s to %s +request-parameter-max-increased: for %s request parameter %s, max was increased from %s to %s +request-parameter-default-value-added: for %s request parameter %s, default value %s was added +request-parameter-default-value-changed: for %s request parameter %s, default value was changed from %s to %s +request-parameter-default-value-removed: for %s request parameter %s, default value %s was removed +request-parameter-max-length-decreased: for %s request parameter %s, maxLength was decreased from %s to %s +request-parameter-max-length-increased: for %s request parameter %s, maxLength was increased from %s to %s +request-parameter-min-length-increased: for %s request parameter %s, minLength was increased from %s to %s +request-parameter-min-length-decreased: for %s request parameter %s, minLength was decreased from %s to %s +request-parameter-max-length-set: for %s request parameter %s, maxLength was set to %s +request-parameter-max-length-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. +request-parameter-max-set: for %s request parameter %s, max was set to %s +request-parameter-max-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. +request-parameter-min-increased: for %s request parameter %s, min was increased from %s to %s +request-parameter-min-decreased: for %s request parameter %s, min was decreased from %s to %s +request-parameter-max-items-decreased: for %s request parameter %s, maxItems was decreased from %s to %s +request-parameter-max-items-increased: for %s request parameter %s, maxItems was increased from %s to %s +request-parameter-min-items-increased: for %s request parameter %s, minItems was increased from %s to %s +request-parameter-min-items-decreased: for %s request parameter %s, minItems was decreased from %s to %s +request-parameter-min-items-set: for %s request parameter %s, minItems was set to %s request-parameter-min-items-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. -request-parameter-min-set: for the %s request parameter %s, the min was set to %s +request-parameter-min-set: for %s request parameter %s, min was set to %s request-parameter-min-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. -request-parameter-type-changed: for the %s request parameter %s, the type/format was changed from %s/%s to %s/%s -request-parameter-type-generalized: for the %s request parameter %s, the type/format was generalized from %s/%s to %s/%s -request-parameter-property-type-changed: for the %s request parameter %s, the type/format of property %s was changed from %s/%s to %s/%s +request-parameter-type-changed: for %s request parameter %s, type/format was changed from %s/%s to %s/%s +request-parameter-type-generalized: for %s request parameter %s, type/format was generalized from %s/%s to %s/%s +request-parameter-property-type-changed: for %s request parameter %s, type/format of property %s was changed from %s/%s to %s/%s request-parameter-property-type-changed-warn-comment: This is a warning because parameter objects can be passed in differnt ways, some of which allow this type change and others do not. -request-parameter-property-type-generalized: for the %s request parameter %s, the type/format of property %s was generalized from %s/%s to %s/%s -request-parameter-property-type-specialized: for the %s request parameter %s, the type/format of property %s was specialized from %s/%s to %s/%s -new-request-path-parameter: added the new path request parameter %s -request-property-became-required: the request property %s became required -request-property-became-required-with-default: the request property %s with a default value became required -request-property-became-optional: the request property %s became optional -request-property-became-not-nullable: the request property %s became not nullable -request-body-became-not-nullable: the request's body became not nullable -request-property-became-nullable: the request property %s became nullable -request-body-became-nullable: the request's body became nullable -request-property-became-enum: request property %s was restricted to a list of enum values -request-property-enum-value-removed: removed the enum value %s of the request property %s -request-read-only-property-enum-value-removed: removed the enum value %s of the request read-only property %s -request-property-enum-value-added: added the new %s enum value to the request property %s -request-body-max-decreased: the request's body max was decreased to %s -request-property-max-decreased: the %s request property's max was decreased to %s -request-read-only-property-max-decreased: the %s request read-only property's max was decreased to %s -request-body-max-length-decreased: the request's body maxLength was decreased to %s -request-property-max-length-decreased: the %s request property's maxLength was decreased to %s -request-read-only-property-max-length-decreased: the %s request read-only property's maxLength was decreased to %s -request-body-min-length-increased: the request's body minLength was increased from %s to %s -request-property-min-length-increased: the %s request property's minLength was increased from %s to %s -request-body-min-length-decreased: the request's body minLength was decreased from %s to %s -request-property-min-length-decreased: the %s request property's minLength was decreased from %s to %s -request-body-max-increased: the request's body max was increased from %s to %s -request-property-max-increased: the %s request property's max was increased from %s to %s -request-body-max-length-increased: the request's body maxLength was increased from %s to %s -request-property-max-length-increased: the %s request property's maxLength was increased from %s to %s -request-body-max-length-set: the request's body maxLength was set to %s +request-parameter-property-type-generalized: for %s request parameter %s, type/format of property %s was generalized from %s/%s to %s/%s +request-parameter-property-type-specialized: for %s request parameter %s, type/format of property %s was specialized from %s/%s to %s/%s +new-request-path-parameter: added path request parameter %s +request-property-became-required: request property %s of media-type %s became required +request-property-became-required-with-default: request property %s with a default value became required in media-type %s +request-property-became-optional: request property %s of media-type %s became optional +request-property-became-not-nullable: request property %s of media-type %s became not nullable +request-body-became-not-nullable: media-type %s of request body became not nullable +request-property-became-nullable: request property %s of media-type %s became nullable +request-body-became-nullable: media-type %s of request body became nullable +request-property-became-enum: request property %s of media-type %s was restricted to a list of enum values +request-property-enum-value-removed: removed enum value %s of request property %s of media-type %s +request-read-only-property-enum-value-removed: removed enum value %s of request read-only property %s of media-type %s +request-property-enum-value-added: added %s enum value to request property %s of media type %s +request-body-max-decreased: max value of media-type %s of request body was decreased from %s to %s +request-property-max-decreased: max value of request property %s of media type %s was decreased from %s to %s +request-read-only-property-max-decreased: max value of request read-only property %s of media-type %swas decreased to %s +request-body-max-length-decreased: maxLength value of media-type %s of request body was decreased from %s to %s +request-property-max-length-decreased: maxLength value of request property %s of media-type %s was decreased from %s to %s +request-read-only-property-max-length-decreased: maxLength value of request read-only property %s of media-type %s was decreased from %s to %s +request-body-min-length-increased: minLength value of media-type %s of request body was increased from %s to %s +request-property-min-length-increased: minLength value of request property %s of media-type %s was increased from %s to %s +request-body-min-length-decreased: minLength value of media-type %s of request body was decreased from %s to %s +request-property-min-length-decreased: minLength value of request property %s of media-type %s was decreased from %s to %s +request-body-max-increased: max value of media-type %s of request body was increased from %s to %s +request-property-max-increased: max value of request property %s of media-type %s was increased from %s to %s +request-body-max-length-increased: maxLength value of media-type %s of request body was increased from %s to %s +request-property-max-length-increased: maxLength value of request property %s of media-type %s was increased from %s to %s +request-body-max-length-set: maxLength value of media-type %s of request body was set to %s request-body-max-length-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. -request-property-max-length-set: the %s request property's maxLength was set to %s +request-property-max-length-set: maxLength value of request property %s of media-type %s was set to %s request-property-max-length-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. -request-body-max-set: the request's body max was set to %s +request-body-max-set: max value of media-type %s of request body was set to %s request-body-max-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. -request-property-max-set: the %s request property's max was set to %s +request-property-max-set: max value of request property %s of media-type %s was set to %s request-property-max-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. -request-body-min-increased: the request's body min was increased to %s -request-property-min-increased: the %s request property's min was increased to %s -request-read-only-property-min-increased: the %s request read-only property's min was increased to %s -request-body-min-items-increased: the request's body minItems was increased to %s -request-property-min-items-increased: the %s request property's minItems was increased to %s -request-body-min-decreased: the request's body min was decreased to from %s to %s -request-property-min-decreased: the %s request property's min was decreased from %s to %s -request-body-min-items-decreased: the request's body minItems was decreased from %s to %s -request-property-min-items-decreased: the %s request property's minItems was decreased from %s to %s -request-body-min-items-set: the request's body minItems was set to %s +request-body-min-increased: min value of media-type %s of request body was increased to %s +request-property-min-increased: min value of request property %s of media-type %s was increased to %s +request-read-only-property-min-increased: min value of request read-only property %s of media-type %s was increased to %s +request-body-min-items-increased: minItems value of media-type %s of request body was increased to %s +request-property-min-items-increased: minItems value of request property %s of media-type %s was increased to %s +request-body-min-decreased: min value of media-type %s of request body was decreased from %s to %s +request-property-min-decreased: min value of request property %s of media-type %s was decreased from %s to %s +request-body-min-items-decreased: minItems value of media-type %s of request body was decreased from %s to %s +request-property-min-items-decreased: minItems value of request property %s of media-type %s was decreased from %s to %s +request-body-min-items-set: minItems value of media-type %s of request body was set to %s request-body-min-items-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. -request-property-min-items-set: the %s request property's minItems was set to %s +request-property-min-items-set: minItems value of request property %s of media-type %s was set to %s request-property-min-items-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. -request-body-min-set: the request's body min was set to %s +request-body-min-set: min value of media-type %s of request body was set to %s request-body-min-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. -request-property-min-set: the %s request property's min was set to %s +request-property-min-set: min value of request property %s of media-type %s was set to %s request-property-min-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. -request-property-removed: removed the request property %s -request-body-type-changed: the request's body type/format changed from %s/%s to %s/%s -request-body-type-generalized: the request's body type/format was generalized from %s/%s to %s/%s -request-property-type-changed: the %s request property type/format changed from %s/%s to %s/%s -request-property-type-generalized: the %s request property type/format was generalized from %s/%s to %s/%s -request-property-x-extensible-enum-value-removed: removed the x-extensible-enum value %s of the request property %s -response-header-became-optional: the response header %s became optional for the status %s -required-response-header-removed: the mandatory response header %s removed for the status %s -optional-response-header-removed: the optional response header %s removed for the status %s -response-media-type-removed: removed the media type %s for the response with the status %s -response-media-type-added: added the media type %s for the response with the status %s -response-optional-property-removed: removed the optional property %s from the response with the %s status -response-property-became-optional: the response property %s became optional for the status %s -response-property-became-nullable: the response property %s became nullable for the status %s -response-body-became-nullable: the response's body became nullable -response-property-enum-value-added: added the new %s enum value to the %s response property for the response status %s +request-property-removed: removed request property %s of media-type %s +request-body-type-changed: type/format of media-type %s of request body changed from %s/%s to %s/%s +request-body-type-generalized: type/format of media-type %s of request body was generalized from %s/%s to %s/%s +request-property-type-changed: type/format of request property %s of media-type %s changed from %s/%s to %s/%s +request-property-type-generalized: type/format of request property %s of media-type %s was generalized from %s/%s to %s/%s +request-property-x-extensible-enum-value-removed: removed x-extensible-enum value %s of request property %s of media-type %s +response-header-became-optional: header %s became optional for response status %s +required-response-header-removed: mandatory header %s was removed for response status %s +optional-response-header-removed: optional header %s was removed for response status %s +response-media-type-removed: removed media type %s for response status %s +response-media-type-added: added media type %s for response status %s +response-optional-property-removed: removed optional property %s from response status %s +response-property-became-optional: property %s became optional for response status %s +response-property-became-nullable: property %s became nullable for response status %s +response-body-became-nullable: response body became nullable +response-property-enum-value-added: added %s enum value to the %s response property for response status %s response-property-enum-value-added-comment: Adding new enum values to response could be unexpected for clients, use x-extensible-enum instead. -response-property-enum-value-removed: removed the %s enum value from the %s response property for the response status %s -response-body-max-length-increased: the response's body maxLength was increased from %s to %s -response-property-max-length-increased: the %s response property's maxLength was increased from %s to %s for the response status %s -response-body-max-length-unset: the response's body maxLength was unset from %s -response-property-max-length-unset: the %s response property's maxLength was unset from %s for the response status %s -response-body-min-items-decreased: the response's body minItems was decreased from %s to %s -response-property-min-items-decreased: the %s response property's minItems was decreased from %s to %s for the response status %s -response-body-min-items-unset: the response's body minItems was unset from %s -response-property-min-items-unset: the %s response property's minItems was unset from %s for the response status %s -response-body-min-length-decreased: the response's body minLength was decreased from %s to %s -response-property-min-length-decreased: the %s response property's minLength was decreased from %s to %s for the response status %s -response-body-type-changed: the response's body type/format changed from %s/%s to %s/%s for status %s -response-property-type-changed: the %s response's property type/format changed from %s/%s to %s/%s for status %s -response-required-property-became-not-write-only: the response required property %s became not write-only for the status %s +response-property-enum-value-removed: removed %s enum value from %s response property for response status %s +response-body-max-length-increased: maxLength value of response body was increased from %s to %s +response-property-max-length-increased: maxLength value of %s response property was increased from %s to %s for response status %s +response-body-max-length-unset: maxLength value of response body was unset from %s +response-property-max-length-unset: maxLength value of %s response property was unset from %s for response status %s +response-body-min-items-decreased: minItems value of response body was decreased from %s to %s +response-property-min-items-decreased: minItems value of %s response property was decreased from %s to %s for response status %s +response-body-min-items-unset: minItems value of response body was unset from %s +response-property-min-items-unset: minItems value of %s response property was unset from %s for response status %s +response-body-min-length-decreased: minLength value of response body was decreased from %s to %s +response-property-min-length-decreased: minLength value of %s response property was decreased from %s to %s for response status %s +response-body-type-changed: body type/format changed from %s/%s to %s/%s for response status %s +response-property-type-changed: "%s response property type/format changed from %s/%s to %s/%s for status %s" +response-required-property-became-not-write-only: response required property %s became not write-only for status %s response-required-property-became-not-write-only-comment: It is valid only if the property was always returned before the specification has been changed -response-required-property-removed: removed the required property %s from the response with the %s status -response-required-property-added: added the required property %s to the response with the %s status -response-success-status-removed: removed the success response with the status %s -response-non-success-status-removed: removed the non-success response with the status %s -response-success-status-added: added the success response with the status %s -response-non-success-status-added: added the non-success response with the status %s -response-body-max-increased: the response's body max was increased from %s to %s -response-property-max-increased: the %s response property's max was increased from %s to %s for the response status %s -response-body-min-decreased: the response's body min was decreased from %s to %s -response-property-min-decreased: the %s response property's min was decreased from %s to %s for the response status %s -api-security-added: the endpoint scheme security %s was added to the API -api-security-removed: the endpoint scheme security %s was removed from the API -api-security-updated: the endpoint scheme security %s was updated from %s to %s -api-global-security-added: the security scheme %s was added to the API -api-global-security-removed: the security scheme %s was removed from the API -api-global-security-scope-removed: the security scope %s was removed from the global security scheme %s -api-global-security-scope-added: the security scope %s was added to the global security scheme %s -api-security-scope-removed: the security scope %s was removed from the endpoint's security scheme %s +response-required-property-removed: removed required property %s from response status %s +response-required-property-added: added required property %s to response status %s +response-success-status-removed: removed success response status %s +response-non-success-status-removed: removed non-success response status %s +response-success-status-added: added success response status %s +response-non-success-status-added: added non-success response status %s +response-body-max-increased: max value of response body was increased from %s to %s +response-property-max-increased: max value of %s response property was increased from %s to %s for response status %s +response-body-min-decreased: min value of response body was decreased from %s to %s +response-property-min-decreased: min value of %s response property was decreased from %s to %s for response status %s +api-security-added: endpoint scheme security %s was added +api-security-removed: endpoint scheme security %s was removed +api-security-updated: endpoint scheme security %s was updated from %s to %s +api-global-security-added: security scheme %s was added +api-global-security-removed: security scheme %s was removed +api-global-security-scope-removed: security scope %s was removed from global security scheme %s +api-global-security-scope-added: security scope %s was added to global security scheme %s +api-security-scope-removed: security scope %s was removed from endpoint security scheme %s api-stability-decreased-description: endpoint stability level decreased -api-security-scope-added: the security scope %s was added to the endpoint's security scheme %s -api-security-component-type-changed: the component security scheme %s type changed from %s to %s -api-security-component-oauth-url-changed: the component security scheme %s oauth url changed from %s to %s -api-security-component-oauth-token-url-changed: the component security scheme %s oauth token url changed from %s to %s -api-security-component-added: the component security scheme %s was added -api-security-component-removed: the component security scheme %s was removed -api-security-component-oauth-scope-added: the component security scheme %s oauth scope %s was added -api-security-component-oauth-scope-removed: the component security scheme %s oauth scope %s was removed -api-security-component-oauth-scope-changed: the component security scheme %s oauth scope %s was updated from %s to %s -response-optional-property-added: added the optional property %s to the response with the %s status -response-optional-write-only-property-added: added the optional write-only property %s to the response with the %s status -response-optional-write-only-property-removed: removed the optional write-only property %s from the response with the %s status -response-required-write-only-property-added: added the required write-only property %s to the response with the %s status -response-required-write-only-property-removed: removed the required write-only property %s from the response with the %s status -response-write-only-property-became-optional: the response write-only property %s became optional for the status %s -response-property-became-required: the response property %s became required for the status %s -response-write-only-property-became-required: the response write-only property %s became required for the status %s -request-body-media-type-removed: removed the media type %s from the request body -request-body-media-type-added: added the media type %s to the request body -response-write-only-property-enum-value-added: added the new %s enum value to the %s response write-only property for the response status %s -response-required-property-became-write-only: the response required property %s became write-only for the status %s -response-required-property-became-read-only: the response required property %s became read-only for the status %s -response-required-property-became-not-read-only: the response required property %s became not read-only for the status %s -response-optional-property-became-write-only: the response optional property %s became write-only for the status %s -response-optional-property-became-read-only: the response optional property %s became read-only for the status %s -response-optional-property-became-not-write-only: the response optional property %s became not write-only for the status %s -response-optional-property-became-not-read-only: the response optional property %s became not read-only for the status %s -response-property-pattern-changed: the %s response's property pattern was changed from %s to %s for the status %s -response-property-pattern-added: the %s response's property pattern %s was added for the status %s -response-property-pattern-removed: the %s response's property pattern %s was removed for the status %s -response-property-default-value-added: the %s response's property default value %s was added for the status %s -response-property-default-value-changed: the %s response's property default value changed from %s to %s for the status %s -response-property-default-value-removed: the %s response's property default value %s was removed for the status %s -response-body-default-value-added: the response body %s default value %s was added for the status %s -response-body-default-value-changed: the response body %s default value changed from %s to %s for the status %s -response-body-default-value-removed: the response body %s default value %s was removed for the status %s -request-property-default-value-added: the %s request property default value %s was added -request-property-default-value-changed: the %s request property default value changed from %s to %s -request-property-default-value-removed: the %s request property default value %s was removed -request-body-default-value-added: the request body %s default value %s was added -request-body-default-value-changed: the request body %s default value changed from %s to %s -request-body-default-value-removed: the request body %s default value %s was removed -request-body-any-of-added: added %s to the request body 'anyOf' list -request-body-any-of-removed: removed %s from the request body 'anyOf' list -request-property-any-of-added: added %s to the %s request property 'anyOf' list -request-property-any-of-removed: removed %s from the %s request property 'anyOf' list -response-body-any-of-added: added %s to the response body 'anyOf' list for the response status %s -response-body-any-of-removed: removed %s from the response body 'anyOf' list for the response status %s -response-property-any-of-added: added %s to the %s response property 'anyOf' list for the response status %s -response-property-any-of-removed: removed %s from the %s response property 'anyOf' list for the response status %s -request-body-one-of-added: added %s to the request body 'oneOf' list -request-body-one-of-removed: removed %s from the request body 'oneOf' list -request-property-one-of-added: added %s to the %s request property 'oneOf' list -request-property-one-of-removed: removed %s from the %s request property 'oneOf' list -response-body-one-of-added: added %s to the response body 'oneOf' list for the response status %s -response-body-one-of-removed: removed %s from the response body 'oneOf' list for the response status %s -response-property-one-of-added: added %s to the %s response property 'oneOf' list for the response status %s -response-property-one-of-removed: removed %s from the %s response property 'oneOf' list for the response status %s -request-body-all-of-added: added %s to the request body 'allOf' list -request-body-all-of-removed: removed %s from the request body 'allOf' list -request-property-all-of-added: added %s to the %s request property 'allOf' list -request-property-all-of-removed: removed %s from the %s request property 'allOf' list -response-body-all-of-added: added %s to the response body 'allOf' list for the response status %s -response-body-all-of-removed: removed %s from the response body 'allOf' list for the response status %s -response-property-all-of-added: added %s to the %s response property 'allOf' list for the response status %s -response-property-all-of-removed: removed %s from the %s response property 'allOf' list for the response status %s -response-body-discriminator-added: added response discriminator for the response status %s -response-property-discriminator-added: added discriminator to %s response property for the response status %s -response-body-discriminator-removed: removed response discriminator for the response status %s -response-property-discriminator-removed: removed discriminator from %s response property for the response status %s -response-body-discriminator-property-name-changed: response discriminator property name changed from %s to %s for the response status %s -response-property-discriminator-property-name-changed: response discriminator property name changed for %s response property from %s to %s for the response status %s -response-body-discriminator-mapping-added: added %s mapping keys to the response discriminator for the response status %s -response-property-discriminator-mapping-added: added %s discriminator mapping keys to the %s response property for the response status %s -response-body-discriminator-mapping-deleted: removed %s mapping keys from the response discriminator for the response status %s -response-property-discriminator-mapping-deleted: removed %s discriminator mapping keys from the %s response property for the response status %s -response-body-discriminator-mapping-changed: mapped value for key %s changed from %s to %s from the response discriminator for the response status %s -response-property-discriminator-mapping-changed: mapped value for discriminator key %s changed from %s to %s for %s response property for the response status %s +api-security-scope-added: security scope %s was added to endpoint security scheme %s +api-security-component-type-changed: component security scheme %s type changed from %s to %s +api-security-component-oauth-url-changed: component security scheme %s oauth url changed from %s to %s +api-security-component-oauth-token-url-changed: component security scheme %s oauth token url changed from %s to %s +api-security-component-added: component security scheme %s was added +api-security-component-removed: component security scheme %s was removed +api-security-component-oauth-scope-added: component security scheme %s oauth scope %s was added +api-security-component-oauth-scope-removed: component security scheme %s oauth scope %s was removed +api-security-component-oauth-scope-changed: component security scheme %s oauth scope %s was updated from %s to %s +response-optional-property-added: added optional property %s to response status %s +response-optional-write-only-property-added: added optional write-only property %s to response status %s +response-optional-write-only-property-removed: removed optional write-only property %s from response status %s +response-required-write-only-property-added: added required write-only property %s tohe response status %s +response-required-write-only-property-removed: removed required write-only property %s from response status %s +response-write-only-property-became-optional: write-only property %s became optional for response status %s +response-property-became-required: property %s became required for response status %s +response-write-only-property-became-required: write-only property %s became required for response status %s +request-body-media-type-removed: removed media type %s from the request body +request-body-media-type-added: added media type %s to the request body +response-write-only-property-enum-value-added: added %s enum value to %s response write-only property for response status %s +response-required-property-became-write-only: response required property %s became write-only for status %s +response-required-property-became-read-only: response required property %s became read-only for status %s +response-required-property-became-not-read-only: response required property %s became not read-only for status %s +response-optional-property-became-write-only: response optional property %s became write-only for status %s +response-optional-property-became-read-only: response optional property %s became read-only for status %s +response-optional-property-became-not-write-only: response optional property %s became not write-only for status %s +response-optional-property-became-not-read-only: response optional property %s became not read-only for status %s +response-property-pattern-changed: "%s response property pattern was changed from %s to %s for status %s" +response-property-pattern-added: "%s response property pattern %s was added for status %s" +response-property-pattern-removed: "%s response property pattern %s was removed for status %s" +response-property-default-value-added: "%s response property default value %s was added for status %s" +response-property-default-value-changed: "%s response property default value changed from %s to %s for status %s" +response-property-default-value-removed: "%s response property default value %s was removed for status %s" +response-body-default-value-added: response body %s default value %s was added for status %s +response-body-default-value-changed: response body %s default value changed from %s to %s for status %s +response-body-default-value-removed: response body %s default value %s was removed for status %s +request-property-default-value-added: "%s request property default value %s was added" +request-property-default-value-changed: "%s request property default value changed from %s to %s" +request-property-default-value-removed: "%s request property default value %s was removed" +request-body-default-value-added: default value %s was added to media-type %s of request body +request-body-default-value-changed: default value of media-type %s of request body changed from %s to %s +request-body-default-value-removed: default value %s was removed from media-type %s of request body +request-body-any-of-added: added %s to media-type %s of request body 'anyOf' list +request-body-any-of-removed: removed %s from media-type %s of request body 'anyOf' list +request-property-any-of-added: added %s to %s request property of media-type %s 'anyOf' list +request-property-any-of-removed: removed %s from %s request property of media-type %s 'anyOf' list +response-body-any-of-added: added %s to response body 'anyOf' list for response status %s +response-body-any-of-removed: removed %s from the response body 'anyOf' list for response status %s +response-property-any-of-added: added %s to %s response property 'anyOf' list for response status %s +response-property-any-of-removed: removed %s from %s response property 'anyOf' list for response status %s +request-body-one-of-added: added %s to media-type %s of request body 'oneOf' list +request-body-one-of-removed: removed %s from media-type %s of request body 'oneOf' list +request-property-one-of-added: added %s to %s request property of media-type %s 'oneOf' list +request-property-one-of-removed: removed %s from %s request property of media-type %s 'oneOf' list +response-body-one-of-added: added %s to response body 'oneOf' list for response status %s +response-body-one-of-removed: removed %s from response body 'oneOf' list for response status %s +response-property-one-of-added: added %s to %s response property 'oneOf' list for response status %s +response-property-one-of-removed: removed %s from %s response property 'oneOf' list for response status %s +request-body-all-of-added: added %s to media-type %s of request body 'allOf' list +request-body-all-of-removed: removed %s from media-type %s of request body 'allOf' list +request-property-all-of-added: added %s to %s request property of media-type %s 'allOf' list +request-property-all-of-removed: removed %s from %s request property of media-type %s 'allOf' list +response-body-all-of-added: added %s to response body 'allOf' list for response status %s +response-body-all-of-removed: removed %s from response body 'allOf' list for response status %s +response-property-all-of-added: added %s to %s response property 'allOf' list for response status %s +response-property-all-of-removed: removed %s from %s response property 'allOf' list for response status %s +response-body-discriminator-added: added response discriminator for response status %s +response-property-discriminator-added: added discriminator to %s response property for response status %s +response-body-discriminator-removed: removed response discriminator for response status %s +response-property-discriminator-removed: removed discriminator from %s response property for response status %s +response-body-discriminator-property-name-changed: response discriminator property name changed from %s to %s for response status %s +response-property-discriminator-property-name-changed: response discriminator property name changed for %s response property from %s to %s for response status %s +response-body-discriminator-mapping-added: added %s mapping keys to response discriminator for response status %s +response-property-discriminator-mapping-added: added %s discriminator mapping keys to %s response property for response status %s +response-body-discriminator-mapping-deleted: removed %s mapping keys from response discriminator for response status %s +response-property-discriminator-mapping-deleted: removed %s discriminator mapping keys from %s response property for response status %s +response-body-discriminator-mapping-changed: mapped value for key %s changed from %s to %s from the response discriminator for response status %s +response-property-discriminator-mapping-changed: mapped value for discriminator key %s changed from %s to %s for %s response property for response status %s request-body-discriminator-added: added request discriminator request-property-discriminator-added: added discriminator to %s request property request-body-discriminator-removed: removed request discriminator request-property-discriminator-removed: removed discriminator from %s request property request-body-discriminator-property-name-changed: request discriminator property name changed from %s to %s request-property-discriminator-property-name-changed: request discriminator property name changed for %s request property from %s to %s -request-body-discriminator-mapping-added: added %s mapping keys to the request discriminator -request-property-discriminator-mapping-added: added %s discriminator mapping keys to the %s request property -request-body-discriminator-mapping-deleted: removed %s mapping keys from the request discriminator -request-property-discriminator-mapping-deleted: removed %s discriminator mapping keys from the %s request property -request-body-discriminator-mapping-changed: mapped value for key %s changed from %s to %s from the request discriminator +request-body-discriminator-mapping-added: added %s mapping keys to request discriminator +request-property-discriminator-mapping-added: added %s discriminator mapping keys to %s request property +request-body-discriminator-mapping-deleted: removed %s mapping keys from request discriminator +request-property-discriminator-mapping-deleted: removed %s discriminator mapping keys from %s request property +request-body-discriminator-mapping-changed: mapped value for key %s changed from %s to %s from request discriminator request-property-discriminator-mapping-changed: mapped value for discriminator key %s changed from %s to %s for %s request property -request-required-property-became-read-only: the request required property %s became read-only -request-required-property-became-not-read-only: the request required property %s became not read-only -request-optional-property-became-write-only: the request optional property %s became write-only -request-optional-property-became-read-only: the request optional property %s became read-only -request-optional-property-became-not-write-only: the request optional property %s became not write-only -request-optional-property-became-not-read-only: the request optional property %s became not read-only -request-required-property-became-write-only: the request required property %s became write-only -request-required-property-became-not-write-only: the request required property %s became not write-only -new-required-request-default-parameter-to-existing-path: added the new required %s request parameter %s to all path's operations -new-optional-request-default-parameter-to-existing-path: added the new optional %s request parameter %s to all path's operations +request-required-property-became-read-only: request required property %s became read-only +request-required-property-became-not-read-only: request required property %s became not read-only +request-optional-property-became-write-only: request optional property %s became write-only +request-optional-property-became-read-only: request optional property %s became read-only +request-optional-property-became-not-write-only: request optional property %s became not write-only +request-optional-property-became-not-read-only: request optional property %s became not read-only +request-required-property-became-write-only: request required property %s became write-only +request-required-property-became-not-write-only: request required property %s became not write-only +new-required-request-default-parameter-to-existing-path: added required %s request parameter %s to all path's operations +new-optional-request-default-parameter-to-existing-path: added optional %s request parameter %s to all path's operations # descriptions request-body-added-required-description: required request body added request-body-added-optional-description: optional request body added diff --git a/data/ignore-err-example.txt b/data/ignore-err-example.txt index 1f47e84d..a982ea3e 100644 --- a/data/ignore-err-example.txt +++ b/data/ignore-err-example.txt @@ -1,4 +1,4 @@ -GET /api/{domain}/{project}/badges/security-score removed the success response with the status '200' -in components removed the schema 'rules' -removed the schema 'network-policies' from components +GET /api/{domain}/{project}/badges/security-score removed success response status '200' +in components removed schema 'rules' +removed schema 'network-policies' from components From 19b6b577d4b72f81e6bb7d6f8816861d56cec3b7 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Wed, 28 Aug 2024 17:09:04 +0300 Subject: [PATCH 02/26] update examples --- docs/BREAKING-CHANGES-EXAMPLES.md | 74 +++++++++++++++---------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/docs/BREAKING-CHANGES-EXAMPLES.md b/docs/BREAKING-CHANGES-EXAMPLES.md index 8862f666..eb701686 100644 --- a/docs/BREAKING-CHANGES-EXAMPLES.md +++ b/docs/BREAKING-CHANGES-EXAMPLES.md @@ -14,18 +14,18 @@ These examples are automatically generated from unit tests. [changing a required property in response body to optional and also deleting it is breaking](../checker/check_breaking_property_test.go?plain=1#L281) [changing a response body to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L217) [changing a response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L249) -[changing a response property to optional under AllOf, AnyOf or OneOf is breaking](../checker/check_breaking_property_test.go?plain=1#L660) +[changing a response property to optional under AllOf, AnyOf or OneOf is breaking](../checker/check_breaking_property_test.go?plain=1#L664) [changing an embedded response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L265) [changing an existing header param from optional to required is breaking](../checker/check_breaking_test.go?plain=1#L190) [changing an existing path param to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L185) -[changing an existing property in request body anyOf to required is breaking](../checker/check_breaking_property_test.go?plain=1#L628) -[changing an existing property in request body items to required is breaking](../checker/check_breaking_property_test.go?plain=1#L597) +[changing an existing property in request body anyOf to required is breaking](../checker/check_breaking_property_test.go?plain=1#L630) +[changing an existing property in request body items to required is breaking](../checker/check_breaking_property_test.go?plain=1#L598) [changing an existing property in request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L169) [changing an existing property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L337) [changing an existing property in request header to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L201) [changing an existing property in request header to required is breaking](../checker/check_breaking_property_test.go?plain=1#L57) [changing an existing property in response body to optional is breaking](../checker/check_breaking_property_test.go?plain=1#L107) -[changing an existing property under another property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L644) +[changing an existing property under another property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L647) [changing an existing request body from optional to required is breaking](../checker/check_breaking_test.go?plain=1#L79) [changing an existing required property in response body to not-write-only is breaking](../checker/check_breaking_property_test.go?plain=1#L561) [changing an existing response header from required to optional is breaking](../checker/check_breaking_test.go?plain=1#L214) @@ -35,7 +35,7 @@ These examples are automatically generated from unit tests. [changing request's body schema type from number to string is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L32) [changing request's body schema type from number/none to integer/int32 is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L92) [changing request's body schema type from string to number is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L12) -[changing request's query param property type from number to string is breaking](../checker/check_request_parameters_type_changed_test.go?plain=1#L208) +[changing request's query param property type from number to string is breaking](../checker/check_request_parameters_type_changed_test.go?plain=1#L216) [changing response's body schema type from integer to number is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L70) [changing response's body schema type from number to string is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L32) [changing response's body schema type from string to number is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L12) @@ -93,7 +93,7 @@ These examples are automatically generated from unit tests. [removing/updating an enum in request body is breaking (optional)](../checker/check_breaking_test.go?plain=1#L310) [removing/updating an operation id is breaking (optional)](../checker/check_breaking_test.go?plain=1#L289) [setting the default value of an optional request parameter is breaking](../checker/check_breaking_test.go?plain=1#L588) -[specializing request's query param property type from string to number is breaking](../checker/check_request_parameters_type_changed_test.go?plain=1#L225) +[specializing request's query param property type from string to number is breaking](../checker/check_request_parameters_type_changed_test.go?plain=1#L233) [specifying a non-text, not-json stability level in base is breaking](../checker/checker_test.go?plain=1#L82) [specifying an invalid stability level in base is breaking](../checker/checker_test.go?plain=1#L65) [specifying an invalid stability level in revision is breaking](../checker/checker_test.go?plain=1#L48) @@ -113,7 +113,7 @@ These examples are automatically generated from unit tests. [both max lengths in request are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L178) [both max lengths in response are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L192) [changing a link to operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L175) -[changing an existing property in request body items to required with a default value is not breaking](../checker/check_breaking_property_test.go?plain=1#L614) +[changing an existing property in request body items to required with a default value is not breaking](../checker/check_breaking_property_test.go?plain=1#L616) [changing an existing property in request body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L323) [changing an existing property in request header to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L83) [changing an existing property in response body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L309) @@ -200,7 +200,7 @@ These examples are automatically generated from unit tests. [adding request body default value or request property default value](../checker/check_request_property_default_value_changed_test.go?plain=1#L58) [adding request parameter default value](../checker/check_request_parameters_default_value_changed_test.go?plain=1#L34) [adding request property enum values](../checker/check_request_property_enum_value_updated_test.go?plain=1#L67) -[adding request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L60) +[adding request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L62) [adding response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L64) [adding response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L37) [adding two new request properties, one required, one optional](../checker/check_request_property_updated_test.go?plain=1#L34) @@ -227,37 +227,37 @@ These examples are automatically generated from unit tests. [changing optional response write-only property to required](../checker/check_response_property_became_required_test.go?plain=1#L33) [changing pattern of request parameters](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L12) [changing properties of subschemas under allOf](../checker/check_response_property_type_changed_test.go?plain=1#L84) -[changing request body and property types from array to object](../checker/check_request_property_type_changed_test.go?plain=1#L87) -[changing request body and property types from object to array](../checker/check_request_property_type_changed_test.go?plain=1#L119) +[changing request body and property types from array to object](../checker/check_request_property_type_changed_test.go?plain=1#L90) +[changing request body and property types from object to array](../checker/check_request_property_type_changed_test.go?plain=1#L125) [changing request body default value](../checker/check_request_property_default_value_changed_test.go?plain=1#L12) [changing request body to not nullable](../checker/check_request_property_became_not_nuallable_test.go?plain=1#L81) [changing request body to nullable](../checker/check_request_property_became_not_nuallable_test.go?plain=1#L57) [changing request body type](../checker/check_request_property_type_changed_test.go?plain=1#L14) -[changing request header parameter format](../checker/check_request_parameters_type_changed_test.go?plain=1#L134) -[changing request header parameter type](../checker/check_request_parameters_type_changed_test.go?plain=1#L62) +[changing request header parameter format](../checker/check_request_parameters_type_changed_test.go?plain=1#L139) +[changing request header parameter type](../checker/check_request_parameters_type_changed_test.go?plain=1#L64) [changing request parameter default value](../checker/check_request_parameters_default_value_changed_test.go?plain=1#L12) [changing request parameter type to enum](../checker/check_request_parameter_became_enum_test.go?plain=1#L12) -[changing request path parameter format](../checker/check_request_parameters_type_changed_test.go?plain=1#L86) -[changing request path parameter type by adding "string"](../checker/check_request_parameters_type_changed_test.go?plain=1#L158) -[changing request path parameter type by replacing "integer" with "number"](../checker/check_request_parameters_type_changed_test.go?plain=1#L183) +[changing request path parameter format](../checker/check_request_parameters_type_changed_test.go?plain=1#L89) +[changing request path parameter type by adding "string"](../checker/check_request_parameters_type_changed_test.go?plain=1#L164) +[changing request path parameter type by replacing "integer" with "number"](../checker/check_request_parameters_type_changed_test.go?plain=1#L190) [changing request path parameter type](../checker/check_request_parameters_type_changed_test.go?plain=1#L14) [changing request property default value](../checker/check_request_property_default_value_changed_test.go?plain=1#L34) -[changing request property format](../checker/check_request_property_type_changed_test.go?plain=1#L151) +[changing request property format](../checker/check_request_property_type_changed_test.go?plain=1#L160) [changing request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L12) -[changing request property required value to false](../checker/check_request_property_required_updated_test.go?plain=1#L35) +[changing request property required value to false](../checker/check_request_property_required_updated_test.go?plain=1#L36) [changing request property required value to true](../checker/check_request_property_required_updated_test.go?plain=1#L12) [changing request property to not nullable](../checker/check_request_property_became_not_nuallable_test.go?plain=1#L12) [changing request property to nullable](../checker/check_request_property_became_not_nuallable_test.go?plain=1#L34) -[changing request property type](../checker/check_request_property_type_changed_test.go?plain=1#L64) -[changing request query parameter format](../checker/check_request_parameters_type_changed_test.go?plain=1#L110) -[changing request query parameter type](../checker/check_request_parameters_type_changed_test.go?plain=1#L38) +[changing request property type](../checker/check_request_property_type_changed_test.go?plain=1#L66) +[changing request query parameter format](../checker/check_request_parameters_type_changed_test.go?plain=1#L114) +[changing request query parameter type](../checker/check_request_parameters_type_changed_test.go?plain=1#L39) [changing request's body to optional](../checker/check_request_body_required_value_updated_test.go?plain=1#L35) [changing request's body to required is breaking](../checker/check_request_body_required_value_updated_test.go?plain=1#L12) [changing required request property to not read-only](../checker/check_request_property_write_only_read_only_test.go?plain=1#L187) [changing required request property to not write-only](../checker/check_request_property_write_only_read_only_test.go?plain=1#L137) [changing required request property to read-only](../checker/check_request_property_write_only_read_only_test.go?plain=1#L162) [changing required request property to write-only](../checker/check_request_property_write_only_read_only_test.go?plain=1#L112) -[changing required response property to not read-only](../checker/check_response_required_property_write_only_read_only_test.go?plain=1#L90) +[changing required response property to not read-only](../checker/check_response_required_property_write_only_read_only_test.go?plain=1#L91) [changing required response property to not write-only](../checker/check_response_required_property_write_only_read_only_test.go?plain=1#L37) [changing required response property to optional](../checker/check_response_property_became_optional_test.go?plain=1#L12) [changing required response property to read-only](../checker/check_response_required_property_write_only_read_only_test.go?plain=1#L65) @@ -269,14 +269,14 @@ These examples are automatically generated from unit tests. [changing security component token url](../checker/check_components_security_updated_test.go?plain=1#L33) [changing security component type](../checker/check_components_security_updated_test.go?plain=1#L55) [changing write-only required response property to optional](../checker/check_response_property_became_optional_test.go?plain=1#L33) -[decreasing max length of request body](../checker/check_request_property_max_length_updated_test.go?plain=1#L40) -[decreasing max length of request property](../checker/check_request_property_max_length_updated_test.go?plain=1#L68) -[decreasing max length of request read-only property](../checker/check_request_property_max_length_updated_test.go?plain=1#L96) +[decreasing max length of request body](../checker/check_request_property_max_length_updated_test.go?plain=1#L41) +[decreasing max length of request property](../checker/check_request_property_max_length_updated_test.go?plain=1#L70) +[decreasing max length of request read-only property](../checker/check_request_property_max_length_updated_test.go?plain=1#L98) [decreasing maxItems of request parameters](../checker/check_request_parameters_max_items_updated_test.go?plain=1#L34) [decreasing maxLength of request parameters](../checker/check_request_parameters_max_length_updated_test.go?plain=1#L33) [decreasing maximum value of request parameter](../checker/check_request_parameters_max_updated_test.go?plain=1#L34) [decreasing minItems value of request parameter](../checker/check_request_parameters_min_items_updated_test.go?plain=1#L34) -[decreasing minLength of request body](../checker/check_request_property_min_length_updated_test.go?plain=1#L84) +[decreasing minLength of request body](../checker/check_request_property_min_length_updated_test.go?plain=1#L87) [decreasing minLength of request property](../checker/check_request_property_min_length_updated_test.go?plain=1#L12) [decreasing minLength value of request parameter](../checker/check_request_parameters_min_length_updated_test.go?plain=1#L35) [decreasing minimum value of request parameter](../checker/check_request_parameters_min_updated_test.go?plain=1#L34) @@ -286,33 +286,33 @@ These examples are automatically generated from unit tests. [decreasing request read-only property maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L38) [deprecating an operation with sunset greater than min](../checker/check_not_breaking_test.go?plain=1#L198) [generalizing pattern of request parameters](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L37) -[generalizing request property format](../checker/check_request_property_type_changed_test.go?plain=1#L176) -[generalizing request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L37) -[generalizing request's query param property type from integer to number](../checker/check_request_parameters_type_changed_test.go?plain=1#L242) +[generalizing request property format](../checker/check_request_property_type_changed_test.go?plain=1#L186) +[generalizing request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L38) +[generalizing request's query param property type from integer to number](../checker/check_request_parameters_type_changed_test.go?plain=1#L250) [increasing max length of request body](../checker/check_request_property_max_length_updated_test.go?plain=1#L12) -[increasing max length of request property](../checker/check_request_property_max_length_updated_test.go?plain=1#L126) +[increasing max length of request property](../checker/check_request_property_max_length_updated_test.go?plain=1#L128) [increasing maxItems of request parameters](../checker/check_request_parameters_max_items_updated_test.go?plain=1#L12) [increasing maxLength of request parameters](../checker/check_request_parameters_max_length_updated_test.go?plain=1#L12) [increasing maximum value of request parameter](../checker/check_request_parameters_max_updated_test.go?plain=1#L12) [increasing minItems value of request parameter](../checker/check_request_parameters_min_items_updated_test.go?plain=1#L12) -[increasing minLength of request body](../checker/check_request_property_min_length_updated_test.go?plain=1#L60) -[increasing minLength of request property](../checker/check_request_property_min_length_updated_test.go?plain=1#L36) +[increasing minLength of request body](../checker/check_request_property_min_length_updated_test.go?plain=1#L62) +[increasing minLength of request property](../checker/check_request_property_min_length_updated_test.go?plain=1#L37) [increasing minLength value of request parameter](../checker/check_request_parameters_min_length_updated_test.go?plain=1#L12) [increasing minimum value of request parameter](../checker/check_request_parameters_min_updated_test.go?plain=1#L12) [increasing minimum value of request property](../checker/check_request_property_min_updated_test.go?plain=1#L12) [increasing minimum value of request read-only property](../checker/check_request_property_min_updated_test.go?plain=1#L35) [increasing request body maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L91) [increasing request property maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L65) -[making request property required, while also giving it a default value](../checker/check_request_property_required_updated_test.go?plain=1#L58) +[making request property required, while also giving it a default value](../checker/check_request_property_required_updated_test.go?plain=1#L60) [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/check_api_deprecation_test.go?plain=1#L270) [path operations that were re-activated](../checker/check_api_deprecation_test.go?plain=1#L293) -[removing 'allOf' subschema from the request body or request body property](../checker/check_request_property_all_of_updated_test.go?plain=1#L46) +[removing 'allOf' subschema from the request body or request body property](../checker/check_request_property_all_of_updated_test.go?plain=1#L48) [removing 'allOf' subschema from the response body or response body property](../checker/check_response_property_all_of_updated_test.go?plain=1#L46) -[removing 'anyOf' schema from the request body or request body property](../checker/check_request_property_any_of_updated_test.go?plain=1#L46) +[removing 'anyOf' schema from the request body or request body property](../checker/check_request_property_any_of_updated_test.go?plain=1#L48) [removing 'anyOf' schema from the response body or response body property](../checker/check_response_property_any_of_updated_test.go?plain=1#L46) -[removing 'oneOf' schema from the request body or request body property](../checker/check_request_property_one_of_updated_test.go?plain=1#L46) +[removing 'oneOf' schema from the request body or request body property](../checker/check_request_property_one_of_updated_test.go?plain=1#L48) [removing 'oneOf' schema from the response body or response body property](../checker/check_response_property_one_of_updated_test.go?plain=1#L55) [removing a global security from the API](../checker/check_api_security_updated_test.go?plain=1#L31) [removing a new media type to response](../checker/check_response_mediatype_updated_test.go?plain=1#L34) @@ -334,11 +334,11 @@ These examples are automatically generated from unit tests. [removing discriminator from the request body or request body property](../checker/check_request_discriminator_updated_test.go?plain=1#L46) [removing discriminator from the response body or response property](../checker/check_response_discriminator_updated_test.go?plain=1#L47) [removing media type from request body](../checker/check_request_body_mediatype_updated_test.go?plain=1#L34) -[removing pattern from request parameters](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L83) +[removing pattern from request parameters](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L84) [removing request body default value or request property default value](../checker/check_request_property_default_value_changed_test.go?plain=1#L91) [removing request parameter default value](../checker/check_request_parameters_default_value_changed_test.go?plain=1#L58) [removing request property enum values](../checker/check_request_property_enum_value_updated_test.go?plain=1#L12) -[removing request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L83) +[removing request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L86) [removing request read-only property enum values](../checker/check_request_property_enum_value_updated_test.go?plain=1#L39) [removing response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L97) [removing response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L62) From 33d8c79aae4aea200562c5f06609c8a757d9db0b Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 11:08:09 +0300 Subject: [PATCH 03/26] improve tests --- checker/check_breaking_property_test.go | 40 +++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/checker/check_breaking_property_test.go b/checker/check_breaking_property_test.go index ac501413..36fd1022 100644 --- a/checker/check_breaking_property_test.go +++ b/checker/check_breaking_property_test.go @@ -2,6 +2,7 @@ package checker_test import ( "fmt" + "sort" "testing" "github.com/getkin/kin-openapi/openapi3" @@ -34,6 +35,7 @@ func TestBreaking_NewRequiredProperty(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.NewRequiredRequestHeaderPropertyId, errs[0].GetId()) + require.Equal(t, "added required 'network-policies' request header's property 'courseId'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: new optional property in request header is not breaking @@ -78,6 +80,7 @@ func TestBreaking_PropertyRequiredEnabled(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestHeaderPropertyBecameRequiredId, errs[0].GetId()) + require.Equal(t, "'network-policies' request header's property 'courseId' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing property in request header to optional is not breaking @@ -118,6 +121,7 @@ func TestBreaking_RespBodyRequiredPropertyDisabled(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponsePropertyBecameOptionalId, errs[0].GetId()) + require.Equal(t, "property 'helpAndSupport/title' became optional for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing a request body to enum is breaking @@ -134,6 +138,7 @@ func TestBreaking_ReqBodyBecameEnum(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestBodyBecameEnumId, errs[0].GetId()) + require.Equal(t, "media-type 'application/json' of request body was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: adding an enum value to request body is not breaking @@ -162,8 +167,12 @@ func TestBreaking_ReqBodyBecameEnumAndTypeChanged(t *testing.T) { require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 2) + require.Equal(t, checker.RequestBodyBecameEnumId, errs[0].GetId()) + require.Equal(t, "media-type 'application/json' of request body was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, checker.RequestBodyTypeChangedId, errs[1].GetId()) + require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'string'/'' to 'int'/''", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing property in request body to enum is breaking @@ -180,6 +189,7 @@ func TestBreaking_ReqPropertyBecameEnum(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyBecameEnumId, errs[0].GetId()) + require.Equal(t, "request property 'name' of media-type 'application/json' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing path param to enum is breaking @@ -196,6 +206,7 @@ func TestBreaking_ReqParameterBecameEnum(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterBecameEnumId, errs[0].GetId()) + require.Equal(t, "'path' request parameter 'bookId' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing property in request header to enum is breaking @@ -212,6 +223,7 @@ func TestBreaking_ReqParameterHeaderPropertyBecameEnum(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestHeaderPropertyBecameEnumId, errs[0].GetId()) + require.Equal(t, "'bookId' request header's property 'name' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing a response body to nullable is breaking @@ -228,6 +240,7 @@ func TestBreaking_RespBodyNullable(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponseBodyBecameNullableId, errs[0].GetId()) + require.Equal(t, "response body became nullable", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing a request property to not nullable is breaking @@ -396,12 +409,13 @@ func TestBreaking_ReqBodyDeleteRequiredProperty2(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Contains(t, errs, checker.ApiChange{ Id: checker.RequestPropertyRemovedId, - Args: []any{"roleAssignments/items/role"}, + Args: []any{"roleAssignments/items/role", "application/json"}, Level: checker.WARN, Operation: "POST", Path: "/api/roleMappings", Source: load.NewSource("../data/required-properties/request-property-items-2.yaml"), }) + require.Equal(t, "removed request property 'roleAssignments/items/role' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: adding a new required property in response body is not breaking @@ -432,6 +446,7 @@ func TestBreaking_RespBodyDeleteRequiredProperty(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponseRequiredPropertyRemovedId, errs[0].GetId()) + require.Equal(t, "removed required property 'helpAndSupport/title' from response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: adding a new required property under AllOf in response body is not breaking @@ -462,6 +477,7 @@ func TestBreaking_RespBodyDeleteAllOfRequiredProperty(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponseRequiredPropertyRemovedId, errs[0].GetId()) + require.Equal(t, "removed required property '/allOf[subschema #1]/bazqux' from response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: adding a new required read-only property in request body is not breaking @@ -507,6 +523,7 @@ func TestBreaking_WriteOnlyDeleteRequiredProperty(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyRemovedId, errs[0].GetId()) require.Equal(t, checker.WARN, errs[0].GetLevel()) + require.Equal(t, "removed request property 'test' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: deleting a non-required non-write-only property in response body is breaking with warning @@ -522,12 +539,23 @@ func TestBreaking_WriteOnlyDeleteNonRequiredProperty(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.NotEmpty(t, errs) require.Len(t, errs, 3) + + sort.Sort(errs) // sort to make sure the order is consistent + require.Equal(t, checker.RequestPropertyRemovedId, errs[0].GetId()) require.Equal(t, checker.WARN, errs[0].GetLevel()) - require.Equal(t, checker.ResponseOptionalPropertyRemovedId, errs[1].GetId()) + require.Equal(t, "/api/atlas/v1.0/groups", errs[0].GetPath()) + require.Equal(t, "removed request property 'test' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, checker.WARN, errs[1].GetLevel()) - require.Equal(t, checker.ResponseOptionalPropertyRemovedId, errs[2].GetId()) + require.Equal(t, checker.ResponseOptionalPropertyRemovedId, errs[1].GetId()) + require.Equal(t, "/api/atlas/v1.0/groups", errs[1].GetPath()) + require.Equal(t, "removed optional property 'test' from response status '200'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, checker.WARN, errs[2].GetLevel()) + require.Equal(t, checker.ResponseOptionalPropertyRemovedId, errs[2].GetId()) + require.Equal(t, "/api/atlas/v1.0/groups/{groupId}", errs[2].GetPath()) + require.Equal(t, "removed optional property 'test' from response status '200'", errs[2].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing write-only property in response body to optional is not breaking @@ -571,10 +599,16 @@ func TestBreaking_RequiredPropertyWriteOnlyDisabled(t *testing.T) { errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.NotEmpty(t, errs) require.Len(t, errs, 2) + require.Equal(t, checker.ResponseRequiredPropertyBecameNonWriteOnlyId, errs[0].GetId()) require.Equal(t, checker.WARN, errs[0].GetLevel()) + require.Equal(t, "/api/atlas/v1.0/groups", errs[0].GetPath()) + require.Equal(t, "response required property 'test' became not write-only for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, checker.ResponseRequiredPropertyBecameNonWriteOnlyId, errs[1].GetId()) require.Equal(t, checker.WARN, errs[1].GetLevel()) + require.Equal(t, "/api/atlas/v1.0/groups/{groupId}", errs[1].GetPath()) + require.Equal(t, "response required property 'test' became not write-only for status '200'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing property in request body to required is breaking From 27508f298d1f8b39fdae035e9488eeadaa2043c3 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 11:09:19 +0300 Subject: [PATCH 04/26] more media-types --- checker/check_request_property_became_enum.go | 4 ++-- checker/check_request_property_updated.go | 10 +++++----- checker/localizations/localizations.go | 6 +++--- checker/localizations_src/en/messages.yaml | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/checker/check_request_property_became_enum.go b/checker/check_request_property_became_enum.go index d866d1d9..66422a12 100644 --- a/checker/check_request_property_became_enum.go +++ b/checker/check_request_property_became_enum.go @@ -25,7 +25,7 @@ func RequestPropertyBecameEnumCheck(diffReport *diff.Diff, operationsSources *di continue } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { if mediaTypeDiff.SchemaDiff == nil { continue } @@ -41,7 +41,7 @@ func RequestPropertyBecameEnumCheck(diffReport *diff.Diff, operationsSources *di result = append(result, NewApiChange( RequestPropertyBecameEnumId, config, - []any{propertyFullName(propertyPath, propertyName)}, + []any{propertyFullName(propertyPath, propertyName), mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_property_updated.go b/checker/check_request_property_updated.go index 73f6f27e..351adc6e 100644 --- a/checker/check_request_property_updated.go +++ b/checker/check_request_property_updated.go @@ -29,7 +29,7 @@ func RequestPropertyUpdatedCheck(diffReport *diff.Diff, operationsSources *diff. continue } modifiedMediaTypes := operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified - for _, mediaTypeDiff := range modifiedMediaTypes { + for mediaType, mediaTypeDiff := range modifiedMediaTypes { CheckDeletedPropertiesDiff( mediaTypeDiff.SchemaDiff, func(propertyPath string, propertyName string, propertyItem *openapi3.Schema, parent *diff.SchemaDiff) { @@ -38,7 +38,7 @@ func RequestPropertyUpdatedCheck(diffReport *diff.Diff, operationsSources *diff. result = append(result, NewApiChange( RequestPropertyRemovedId, config, - []any{propertyFullName(propertyPath, propertyName)}, + []any{propertyFullName(propertyPath, propertyName), mediaType}, "", operationsSources, operationItem.Revision, @@ -61,7 +61,7 @@ func RequestPropertyUpdatedCheck(diffReport *diff.Diff, operationsSources *diff. result = append(result, NewApiChange( NewRequiredRequestPropertyId, config, - []any{propName}, + []any{propName, mediaType}, "", operationsSources, operationItem.Revision, @@ -72,7 +72,7 @@ func RequestPropertyUpdatedCheck(diffReport *diff.Diff, operationsSources *diff. result = append(result, NewApiChange( NewRequiredRequestPropertyWithDefaultId, config, - []any{propName}, + []any{propName, mediaType}, "", operationsSources, operationItem.Revision, @@ -84,7 +84,7 @@ func RequestPropertyUpdatedCheck(diffReport *diff.Diff, operationsSources *diff. result = append(result, NewApiChange( NewOptionalRequestPropertyId, config, - []any{propName}, + []any{propName, mediaType}, "", operationsSources, operationItem.Revision, diff --git a/checker/localizations/localizations.go b/checker/localizations/localizations.go index 9e0601cb..6e401575 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 -// 2024-08-28 16:40:13.516781 +0300 IDT m=+0.004593543 +// 2024-08-28 17:55:50.383577 +0300 IDT m=+0.005206293 package localizations @@ -89,7 +89,7 @@ var localizations = map[string]string{ "en.messages.new-optional-request-default-parameter-to-existing-path-description": "optional request parameter added at path level", "en.messages.new-optional-request-parameter": "added optional %s request parameter %s", "en.messages.new-optional-request-parameter-description": "optional request parameter added to endpoint", - "en.messages.new-optional-request-property": "added optional request property %s", + "en.messages.new-optional-request-property": "added optional request property %s to media-type %s", "en.messages.new-optional-request-property-description": "optional property added to request", "en.messages.new-request-path-parameter": "added path request parameter %s", "en.messages.new-request-path-parameter-description": "new request path parameter", @@ -99,7 +99,7 @@ var localizations = map[string]string{ "en.messages.new-required-request-header-property-description": "new required request header", "en.messages.new-required-request-parameter": "added required %s request parameter %s", "en.messages.new-required-request-parameter-description": "required request parameter added to endpoint", - "en.messages.new-required-request-property": "added required request property %s", + "en.messages.new-required-request-property": "added required request property %s to media-type %s", "en.messages.new-required-request-property-description": "required property added to request", "en.messages.new-required-request-property-with-default": "added required request property %s with a default value to media-type %s", "en.messages.new-required-request-property-with-default-description": "required property with default value added to request", diff --git a/checker/localizations_src/en/messages.yaml b/checker/localizations_src/en/messages.yaml index f220fbc4..7a004085 100644 --- a/checker/localizations_src/en/messages.yaml +++ b/checker/localizations_src/en/messages.yaml @@ -35,9 +35,9 @@ sunset-deleted: api sunset date deleted, but deprecated=true kept api-sunset-date-changed-too-small: api sunset date changed to earlier date from %s to %s, new sunset date must be not earlier than %s at least %s days from now new-required-request-parameter: added required %s request parameter %s new-optional-request-parameter: added optional %s request parameter %s -new-required-request-property: added required request property %s +new-required-request-property: added required request property %s to media-type %s new-required-request-property-with-default: added required request property %s with a default value to media-type %s -new-optional-request-property: added optional request property %s +new-optional-request-property: added optional request property %s to media-type %s new-required-request-header-property: added required %s request header's property %s request-body-became-required: request body became required request-body-became-optional: request body became optional From e220924de5b32f1400897ddcdd608b671286191d Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 11:10:03 +0300 Subject: [PATCH 05/26] fix documentation --- docs/BREAKING-CHANGES-EXAMPLES.md | 78 +++++++++++++++---------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/docs/BREAKING-CHANGES-EXAMPLES.md b/docs/BREAKING-CHANGES-EXAMPLES.md index eb701686..971afd25 100644 --- a/docs/BREAKING-CHANGES-EXAMPLES.md +++ b/docs/BREAKING-CHANGES-EXAMPLES.md @@ -4,30 +4,30 @@ 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 a new required property in request body is breaking](../checker/check_breaking_property_test.go?plain=1#L353) +[adding a new required property in request body is breaking](../checker/check_breaking_property_test.go?plain=1#L366) [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) [adding a required request body is breaking](../checker/check_breaking_test.go?plain=1#L61) -[changing a request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L123) -[changing a request body type and changing it to enum simultaneously is breaking](../checker/check_breaking_property_test.go?plain=1#L153) -[changing a request property to not nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L233) -[changing a required property in response body to optional and also deleting it is breaking](../checker/check_breaking_property_test.go?plain=1#L281) -[changing a response body to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L217) -[changing a response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L249) -[changing a response property to optional under AllOf, AnyOf or OneOf is breaking](../checker/check_breaking_property_test.go?plain=1#L664) -[changing an embedded response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L265) +[changing a request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L127) +[changing a request body type and changing it to enum simultaneously is breaking](../checker/check_breaking_property_test.go?plain=1#L158) +[changing a request property to not nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L246) +[changing a required property in response body to optional and also deleting it is breaking](../checker/check_breaking_property_test.go?plain=1#L294) +[changing a response body to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L229) +[changing a response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L262) +[changing a response property to optional under AllOf, AnyOf or OneOf is breaking](../checker/check_breaking_property_test.go?plain=1#L698) +[changing an embedded response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L278) [changing an existing header param from optional to required is breaking](../checker/check_breaking_test.go?plain=1#L190) -[changing an existing path param to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L185) -[changing an existing property in request body anyOf to required is breaking](../checker/check_breaking_property_test.go?plain=1#L630) -[changing an existing property in request body items to required is breaking](../checker/check_breaking_property_test.go?plain=1#L598) -[changing an existing property in request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L169) -[changing an existing property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L337) -[changing an existing property in request header to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L201) -[changing an existing property in request header to required is breaking](../checker/check_breaking_property_test.go?plain=1#L57) -[changing an existing property in response body to optional is breaking](../checker/check_breaking_property_test.go?plain=1#L107) -[changing an existing property under another property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L647) +[changing an existing path param to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L195) +[changing an existing property in request body anyOf to required is breaking](../checker/check_breaking_property_test.go?plain=1#L664) +[changing an existing property in request body items to required is breaking](../checker/check_breaking_property_test.go?plain=1#L632) +[changing an existing property in request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L178) +[changing an existing property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L350) +[changing an existing property in request header to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L212) +[changing an existing property in request header to required is breaking](../checker/check_breaking_property_test.go?plain=1#L59) +[changing an existing property in response body to optional is breaking](../checker/check_breaking_property_test.go?plain=1#L110) +[changing an existing property under another property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L681) [changing an existing request body from optional to required is breaking](../checker/check_breaking_test.go?plain=1#L79) -[changing an existing required property in response body to not-write-only is breaking](../checker/check_breaking_property_test.go?plain=1#L561) +[changing an existing required property in response body to not-write-only is breaking](../checker/check_breaking_property_test.go?plain=1#L589) [changing an existing response header from required to optional is breaking](../checker/check_breaking_test.go?plain=1#L214) [changing max length in request from nil to any value is breaking](../checker/check_breaking_min_max_test.go?plain=1#L110) [changing max length in response from any value to nil is breaking](../checker/check_breaking_min_max_test.go?plain=1#L160) @@ -45,13 +45,13 @@ These examples are automatically generated from unit tests. [changing sunset to an invalid date for a deprecated endpoint is breaking](../checker/check_api_sunset_changed_test.go?plain=1#L47) [decreasing stability level is breaking](../checker/checker_test.go?plain=1#L11) [deleting a media-type from response is breaking](../checker/check_breaking_test.go?plain=1#L442) -[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 non-required non-write-only property in response body is breaking with warning](../checker/check_breaking_property_test.go?plain=1#L529) [deleting a path is breaking](../checker/check_breaking_test.go?plain=1#L37) [deleting a path with some operations having sunset date in the future is breaking](../checker/check_api_removed_test.go?plain=1#L86) -[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) -[deleting an embedded optional property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L386) +[deleting a required property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L382) +[deleting a required property in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L435) +[deleting a required property under AllOf in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L466) +[deleting an embedded optional property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L399) [deleting an enum value is breaking](../checker/check_breaking_test.go?plain=1#L101) [deleting an operation before sunset date is breaking](../checker/check_api_removed_test.go?plain=1#L11) [deleting an operation is breaking](../checker/check_breaking_test.go?plain=1#L45) @@ -69,7 +69,7 @@ These examples are automatically generated from unit tests. [new header, query and cookie required request default param is breaking](../checker/check_new_request_non_path_default_parameter_test.go?plain=1#L12) [new required header param is breaking](../checker/check_breaking_test.go?plain=1#L173) [new required path param is breaking](../checker/check_breaking_test.go?plain=1#L156) -[new required property in request header is breaking](../checker/check_breaking_property_test.go?plain=1#L18) +[new required property in request header is breaking](../checker/check_breaking_property_test.go?plain=1#L19) [reducing max in request is breaking](../checker/check_breaking_min_max_test.go?plain=1#L264) [reducing max length in request is breaking](../checker/check_breaking_min_max_test.go?plain=1#L12) [reducing min items in response is breaking](../checker/check_breaking_min_max_test.go?plain=1#L220) @@ -100,26 +100,26 @@ These examples are automatically generated from unit tests. ## Examples of non-breaking changes [adding a media-type to response is not breaking](../checker/check_not_breaking_test.go?plain=1#L184) -[adding a new required property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L407) -[adding a new required property under AllOf in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L437) -[adding a new required read-only property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L467) -[adding a non-existent required property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L295) +[adding a new required property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L421) +[adding a new required property under AllOf in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L452) +[adding a new required read-only property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L483) +[adding a non-existent required property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L308) [adding a required property to response is not breaking](../checker/check_not_breaking_test.go?plain=1#L289) [adding a tag is not breaking](../checker/check_not_breaking_test.go?plain=1#L266) [adding an enum value is not breaking](../checker/check_not_breaking_test.go?plain=1#L82) -[adding an enum value to request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L139) +[adding an enum value to request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L144) [adding an operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L277) [adding an optional request body is not breaking](../checker/check_not_breaking_test.go?plain=1#L38) [both max lengths in request are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L178) [both max lengths in response are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L192) [changing a link to operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L175) -[changing an existing property in request body items to required with a default value is not breaking](../checker/check_breaking_property_test.go?plain=1#L616) -[changing an existing property in request body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L323) -[changing an existing property in request header to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L83) -[changing an existing property in response body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L309) -[changing an existing read-only property in request body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L481) -[changing an existing required property in response body to write-only is not breaking](../checker/check_breaking_property_test.go?plain=1#L547) -[changing an existing write-only property in response body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L533) +[changing an existing property in request body items to required with a default value is not breaking](../checker/check_breaking_property_test.go?plain=1#L650) +[changing an existing property in request body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L336) +[changing an existing property in request header to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L86) +[changing an existing property in response body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L322) +[changing an existing read-only property in request body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L497) +[changing an existing required property in response body to write-only is not breaking](../checker/check_breaking_property_test.go?plain=1#L575) +[changing an existing write-only property in response body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L561) [changing comments is not breaking](../checker/check_not_breaking_test.go?plain=1#L106) [changing extensions is not breaking](../checker/check_not_breaking_test.go?plain=1#L94) [changing max length in request from any value to nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L144) @@ -131,7 +131,7 @@ These examples are automatically generated from unit tests. [changing servers is not breaking](../checker/check_not_breaking_test.go?plain=1#L252) [deleting a path after sunset date of all contained operations is not breaking](../checker/check_api_deprecation_test.go?plain=1#L255) [deleting a pattern from a schema is not breaking](../checker/check_breaking_test.go?plain=1#L459) -[deleting a required write-only property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L495) +[deleting a required write-only property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L511) [deleting a tag is not breaking](../checker/check_not_breaking_test.go?plain=1#L71) [deleting an operation after sunset date is not breaking](../checker/check_api_deprecation_test.go?plain=1#L33) [deleting an operation without sunset date is not breaking](../checker/check_api_removed_test.go?plain=1#L29) @@ -152,7 +152,7 @@ These examples are automatically generated from unit tests. [modifying a pattern to .* in a schema is not breaking](../checker/check_breaking_test.go?plain=1#L525) [modifying the default value of a required request parameter is not breaking](../checker/check_breaking_test.go?plain=1#L624) [new optional header param is not breaking](../checker/check_not_breaking_test.go?plain=1#L118) -[new optional property in request header is not breaking](../checker/check_breaking_property_test.go?plain=1#L39) +[new optional property in request header is not breaking](../checker/check_breaking_property_test.go?plain=1#L41) [new required response header param is not breaking](../checker/check_not_breaking_test.go?plain=1#L152) [no change is not breaking](../checker/check_not_breaking_test.go?plain=1#L27) [no change to headers for a deprecated endpoint is not breaking](../checker/check_api_sunset_changed_test.go?plain=1#L99) From a5a3bbaf3b075ea1a6dfb501b865e85b2432ea26 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 11:23:05 +0300 Subject: [PATCH 06/26] fix tests --- checker/check_breaking_property_test.go | 3 - .../check_request_property_updated_test.go | 54 +++++++----- docs/BREAKING-CHANGES-EXAMPLES.md | 86 +++++++++---------- 3 files changed, 74 insertions(+), 69 deletions(-) diff --git a/checker/check_breaking_property_test.go b/checker/check_breaking_property_test.go index 36fd1022..39531f77 100644 --- a/checker/check_breaking_property_test.go +++ b/checker/check_breaking_property_test.go @@ -2,7 +2,6 @@ package checker_test import ( "fmt" - "sort" "testing" "github.com/getkin/kin-openapi/openapi3" @@ -540,8 +539,6 @@ func TestBreaking_WriteOnlyDeleteNonRequiredProperty(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 3) - sort.Sort(errs) // sort to make sure the order is consistent - require.Equal(t, checker.RequestPropertyRemovedId, errs[0].GetId()) require.Equal(t, checker.WARN, errs[0].GetLevel()) require.Equal(t, "/api/atlas/v1.0/groups", errs[0].GetPath()) diff --git a/checker/check_request_property_updated_test.go b/checker/check_request_property_updated_test.go index d5f42b3e..21609bb5 100644 --- a/checker/check_request_property_updated_test.go +++ b/checker/check_request_property_updated_test.go @@ -22,13 +22,14 @@ func TestRequiredRequestPropertyAdded(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.NewRequiredRequestPropertyId, - Args: []any{"description"}, + Args: []any{"description", "application/json"}, Level: checker.ERR, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_added_revision.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "added required request property 'description' to media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding two new request properties, one required, one optional @@ -41,25 +42,29 @@ func TestRequiredRequestPropertiesAdded(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.RequestPropertyUpdatedCheck), d, osm, checker.INFO) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.NewRequiredRequestPropertyId, - Args: []any{"description"}, - Level: checker.ERR, - Operation: "POST", - Path: "/products", - Source: load.NewSource("../data/checker/request_property_added_revision2.yaml"), - OperationId: "addProduct", - }, - { - Id: checker.NewOptionalRequestPropertyId, - Args: []any{"info"}, - Level: checker.INFO, - Operation: "POST", - Path: "/products", - Source: load.NewSource("../data/checker/request_property_added_revision2.yaml"), - OperationId: "addProduct", - }}, errs) + require.Len(t, errs, 2) + + require.Equal(t, errs[0], checker.ApiChange{ + Id: checker.NewRequiredRequestPropertyId, + Args: []any{"description", "application/json"}, + Level: checker.ERR, + Operation: "POST", + Path: "/products", + Source: load.NewSource("../data/checker/request_property_added_revision2.yaml"), + OperationId: "addProduct", + }) + require.Equal(t, "added required request property 'description' to media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, errs[1], checker.ApiChange{ + Id: checker.NewOptionalRequestPropertyId, + Args: []any{"info", "application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/products", + Source: load.NewSource("../data/checker/request_property_added_revision2.yaml"), + OperationId: "addProduct", + }) + require.Equal(t, "added optional request property 'info' to media-type 'application/json'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a new optional request property @@ -76,13 +81,14 @@ func TestRequiredOptionalPropertyAdded(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.NewOptionalRequestPropertyId, - Args: []any{"description"}, + Args: []any{"description", "application/json"}, Level: checker.INFO, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_added_revision.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "added optional request property 'description' to media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a required request property @@ -98,13 +104,14 @@ func TestRequiredRequestPropertyRemoved(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.RequestPropertyRemovedId, - Args: []any{"description"}, + Args: []any{"description", "application/json"}, Level: checker.WARN, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_added_base.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "removed request property 'description' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a new required request property with a default value @@ -120,11 +127,12 @@ func TestRequiredRequestPropertyAddedWithDefault(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.NewRequiredRequestPropertyWithDefaultId, - Args: []any{"description"}, + Args: []any{"description", "application/json"}, Level: checker.INFO, Operation: "POST", Path: "/products", Source: load.NewSource("../data/checker/request_property_added_with_default.yaml"), OperationId: "addProduct", }, errs[0]) + require.Equal(t, "added required request property 'description' with a default value to media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/docs/BREAKING-CHANGES-EXAMPLES.md b/docs/BREAKING-CHANGES-EXAMPLES.md index 971afd25..4ab0138a 100644 --- a/docs/BREAKING-CHANGES-EXAMPLES.md +++ b/docs/BREAKING-CHANGES-EXAMPLES.md @@ -4,30 +4,30 @@ 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 a new required property in request body is breaking](../checker/check_breaking_property_test.go?plain=1#L366) +[adding a new required property in request body is breaking](../checker/check_breaking_property_test.go?plain=1#L365) [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) [adding a required request body is breaking](../checker/check_breaking_test.go?plain=1#L61) -[changing a request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L127) -[changing a request body type and changing it to enum simultaneously is breaking](../checker/check_breaking_property_test.go?plain=1#L158) -[changing a request property to not nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L246) -[changing a required property in response body to optional and also deleting it is breaking](../checker/check_breaking_property_test.go?plain=1#L294) -[changing a response body to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L229) -[changing a response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L262) -[changing a response property to optional under AllOf, AnyOf or OneOf is breaking](../checker/check_breaking_property_test.go?plain=1#L698) -[changing an embedded response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L278) +[changing a request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L126) +[changing a request body type and changing it to enum simultaneously is breaking](../checker/check_breaking_property_test.go?plain=1#L157) +[changing a request property to not nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L245) +[changing a required property in response body to optional and also deleting it is breaking](../checker/check_breaking_property_test.go?plain=1#L293) +[changing a response body to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L228) +[changing a response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L261) +[changing a response property to optional under AllOf, AnyOf or OneOf is breaking](../checker/check_breaking_property_test.go?plain=1#L695) +[changing an embedded response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L277) [changing an existing header param from optional to required is breaking](../checker/check_breaking_test.go?plain=1#L190) -[changing an existing path param to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L195) -[changing an existing property in request body anyOf to required is breaking](../checker/check_breaking_property_test.go?plain=1#L664) -[changing an existing property in request body items to required is breaking](../checker/check_breaking_property_test.go?plain=1#L632) -[changing an existing property in request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L178) -[changing an existing property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L350) -[changing an existing property in request header to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L212) -[changing an existing property in request header to required is breaking](../checker/check_breaking_property_test.go?plain=1#L59) -[changing an existing property in response body to optional is breaking](../checker/check_breaking_property_test.go?plain=1#L110) -[changing an existing property under another property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L681) +[changing an existing path param to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L194) +[changing an existing property in request body anyOf to required is breaking](../checker/check_breaking_property_test.go?plain=1#L661) +[changing an existing property in request body items to required is breaking](../checker/check_breaking_property_test.go?plain=1#L629) +[changing an existing property in request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L177) +[changing an existing property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L349) +[changing an existing property in request header to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L211) +[changing an existing property in request header to required is breaking](../checker/check_breaking_property_test.go?plain=1#L58) +[changing an existing property in response body to optional is breaking](../checker/check_breaking_property_test.go?plain=1#L109) +[changing an existing property under another property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L678) [changing an existing request body from optional to required is breaking](../checker/check_breaking_test.go?plain=1#L79) -[changing an existing required property in response body to not-write-only is breaking](../checker/check_breaking_property_test.go?plain=1#L589) +[changing an existing required property in response body to not-write-only is breaking](../checker/check_breaking_property_test.go?plain=1#L586) [changing an existing response header from required to optional is breaking](../checker/check_breaking_test.go?plain=1#L214) [changing max length in request from nil to any value is breaking](../checker/check_breaking_min_max_test.go?plain=1#L110) [changing max length in response from any value to nil is breaking](../checker/check_breaking_min_max_test.go?plain=1#L160) @@ -45,13 +45,13 @@ These examples are automatically generated from unit tests. [changing sunset to an invalid date for a deprecated endpoint is breaking](../checker/check_api_sunset_changed_test.go?plain=1#L47) [decreasing stability level is breaking](../checker/checker_test.go?plain=1#L11) [deleting a media-type from response is breaking](../checker/check_breaking_test.go?plain=1#L442) -[deleting a non-required non-write-only property in response body is breaking with warning](../checker/check_breaking_property_test.go?plain=1#L529) +[deleting a non-required non-write-only property in response body is breaking with warning](../checker/check_breaking_property_test.go?plain=1#L528) [deleting a path is breaking](../checker/check_breaking_test.go?plain=1#L37) [deleting a path with some operations having sunset date in the future is breaking](../checker/check_api_removed_test.go?plain=1#L86) -[deleting a required property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L382) -[deleting a required property in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L435) -[deleting a required property under AllOf in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L466) -[deleting an embedded optional property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L399) +[deleting a required property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L381) +[deleting a required property in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L434) +[deleting a required property under AllOf in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L465) +[deleting an embedded optional property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L398) [deleting an enum value is breaking](../checker/check_breaking_test.go?plain=1#L101) [deleting an operation before sunset date is breaking](../checker/check_api_removed_test.go?plain=1#L11) [deleting an operation is breaking](../checker/check_breaking_test.go?plain=1#L45) @@ -69,7 +69,7 @@ These examples are automatically generated from unit tests. [new header, query and cookie required request default param is breaking](../checker/check_new_request_non_path_default_parameter_test.go?plain=1#L12) [new required header param is breaking](../checker/check_breaking_test.go?plain=1#L173) [new required path param is breaking](../checker/check_breaking_test.go?plain=1#L156) -[new required property in request header is breaking](../checker/check_breaking_property_test.go?plain=1#L19) +[new required property in request header is breaking](../checker/check_breaking_property_test.go?plain=1#L18) [reducing max in request is breaking](../checker/check_breaking_min_max_test.go?plain=1#L264) [reducing max length in request is breaking](../checker/check_breaking_min_max_test.go?plain=1#L12) [reducing min items in response is breaking](../checker/check_breaking_min_max_test.go?plain=1#L220) @@ -100,26 +100,26 @@ These examples are automatically generated from unit tests. ## Examples of non-breaking changes [adding a media-type to response is not breaking](../checker/check_not_breaking_test.go?plain=1#L184) -[adding a new required property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L421) -[adding a new required property under AllOf in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L452) -[adding a new required read-only property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L483) -[adding a non-existent required property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L308) +[adding a new required property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L420) +[adding a new required property under AllOf in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L451) +[adding a new required read-only property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L482) +[adding a non-existent required property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L307) [adding a required property to response is not breaking](../checker/check_not_breaking_test.go?plain=1#L289) [adding a tag is not breaking](../checker/check_not_breaking_test.go?plain=1#L266) [adding an enum value is not breaking](../checker/check_not_breaking_test.go?plain=1#L82) -[adding an enum value to request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L144) +[adding an enum value to request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L143) [adding an operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L277) [adding an optional request body is not breaking](../checker/check_not_breaking_test.go?plain=1#L38) [both max lengths in request are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L178) [both max lengths in response are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L192) [changing a link to operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L175) -[changing an existing property in request body items to required with a default value is not breaking](../checker/check_breaking_property_test.go?plain=1#L650) -[changing an existing property in request body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L336) -[changing an existing property in request header to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L86) -[changing an existing property in response body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L322) -[changing an existing read-only property in request body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L497) -[changing an existing required property in response body to write-only is not breaking](../checker/check_breaking_property_test.go?plain=1#L575) -[changing an existing write-only property in response body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L561) +[changing an existing property in request body items to required with a default value is not breaking](../checker/check_breaking_property_test.go?plain=1#L647) +[changing an existing property in request body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L335) +[changing an existing property in request header to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L85) +[changing an existing property in response body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L321) +[changing an existing read-only property in request body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L496) +[changing an existing required property in response body to write-only is not breaking](../checker/check_breaking_property_test.go?plain=1#L572) +[changing an existing write-only property in response body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L558) [changing comments is not breaking](../checker/check_not_breaking_test.go?plain=1#L106) [changing extensions is not breaking](../checker/check_not_breaking_test.go?plain=1#L94) [changing max length in request from any value to nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L144) @@ -131,7 +131,7 @@ These examples are automatically generated from unit tests. [changing servers is not breaking](../checker/check_not_breaking_test.go?plain=1#L252) [deleting a path after sunset date of all contained operations is not breaking](../checker/check_api_deprecation_test.go?plain=1#L255) [deleting a pattern from a schema is not breaking](../checker/check_breaking_test.go?plain=1#L459) -[deleting a required write-only property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L511) +[deleting a required write-only property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L510) [deleting a tag is not breaking](../checker/check_not_breaking_test.go?plain=1#L71) [deleting an operation after sunset date is not breaking](../checker/check_api_deprecation_test.go?plain=1#L33) [deleting an operation without sunset date is not breaking](../checker/check_api_removed_test.go?plain=1#L29) @@ -152,7 +152,7 @@ These examples are automatically generated from unit tests. [modifying a pattern to .* in a schema is not breaking](../checker/check_breaking_test.go?plain=1#L525) [modifying the default value of a required request parameter is not breaking](../checker/check_breaking_test.go?plain=1#L624) [new optional header param is not breaking](../checker/check_not_breaking_test.go?plain=1#L118) -[new optional property in request header is not breaking](../checker/check_breaking_property_test.go?plain=1#L41) +[new optional property in request header is not breaking](../checker/check_breaking_property_test.go?plain=1#L40) [new required response header param is not breaking](../checker/check_not_breaking_test.go?plain=1#L152) [no change is not breaking](../checker/check_not_breaking_test.go?plain=1#L27) [no change to headers for a deprecated endpoint is not breaking](../checker/check_api_sunset_changed_test.go?plain=1#L99) @@ -178,8 +178,8 @@ These examples are automatically generated from unit tests. [adding a new media type to response](../checker/check_response_mediatype_updated_test.go?plain=1#L12) [adding a new oauth security scope](../checker/check_components_security_updated_test.go?plain=1#L117) [adding a new operation id](../checker/check_api_operation_id_updated_test.go?plain=1#L62) -[adding a new optional request property](../checker/check_request_property_updated_test.go?plain=1#L65) -[adding a new required request property with a default value](../checker/check_request_property_updated_test.go?plain=1#L110) +[adding a new optional request property](../checker/check_request_property_updated_test.go?plain=1#L70) +[adding a new required request property with a default value](../checker/check_request_property_updated_test.go?plain=1#L117) [adding a new required request property](../checker/check_request_property_updated_test.go?plain=1#L12) [adding a new security component](../checker/check_components_security_updated_test.go?plain=1#L77) [adding a new security to the API endpoint](../checker/check_api_security_updated_test.go?plain=1#L90) @@ -203,7 +203,7 @@ These examples are automatically generated from unit tests. [adding request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L62) [adding response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L64) [adding response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L37) -[adding two new request properties, one required, one optional](../checker/check_request_property_updated_test.go?plain=1#L34) +[adding two new request properties, one required, one optional](../checker/check_request_property_updated_test.go?plain=1#L35) [changing a response property schema format](../checker/check_response_property_type_changed_test.go?plain=1#L60) [changing a response property schema type from a single value to to multiple types](../checker/check_response_property_type_changed_test.go?plain=1#L126) [changing a response property schema type from string to integer](../checker/check_response_property_type_changed_test.go?plain=1#L36) @@ -320,7 +320,7 @@ These examples are automatically generated from unit tests. [removing a new security component](../checker/check_components_security_updated_test.go?plain=1#L97) [removing a new security to the API endpoint](../checker/check_api_security_updated_test.go?plain=1#L112) [removing a non-success response status](../checker/check_response_status_updated_test.go?plain=1#L62) -[removing a required request property](../checker/check_request_property_updated_test.go?plain=1#L88) +[removing a required request property](../checker/check_request_property_updated_test.go?plain=1#L94) [removing a required write-only property that was required in response body is detected](../checker/check_response_required_property_updated_test.go?plain=1#L83) [removing a security scope from an API endpoint security](../checker/check_api_security_updated_test.go?plain=1#L134) [removing a security scope from an API global security](../checker/check_api_security_updated_test.go?plain=1#L50) From 967a3ccb5d07ee32f37dee281869cc339577d387 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 12:13:38 +0300 Subject: [PATCH 07/26] was removed -> removed --- checker/check_api_security_updated_test.go | 8 +-- checker/check_api_tag_updated_test.go | 4 +- checker/check_breaking_test.go | 6 +- .../check_components_security_updated_test.go | 8 +-- ...check_response_pattern_added_or_changed.go | 6 +- ..._response_pattern_added_or_changed_test.go | 12 ++-- ...response_property_default_value_changed.go | 6 +- ...nse_property_default_value_changed_test.go | 42 +++++++++----- checker/localizations/localizations.go | 34 +++++------ checker/localizations_src/en/messages.yaml | 56 +++++++++---------- docs/BREAKING-CHANGES-EXAMPLES.md | 6 +- 11 files changed, 102 insertions(+), 86 deletions(-) diff --git a/checker/check_api_security_updated_test.go b/checker/check_api_security_updated_test.go index 16a281fc..55aff872 100644 --- a/checker/check_api_security_updated_test.go +++ b/checker/check_api_security_updated_test.go @@ -44,7 +44,7 @@ func TestAPIGlobalSecurityyDeleted(t *testing.T) { Args: []any{"petstore_auth"}, Level: checker.INFO, }, errs[0]) - require.Equal(t, "security scheme 'petstore_auth' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a security scope from an API global security @@ -64,7 +64,7 @@ func TestAPIGlobalSecurityScopeRemoved(t *testing.T) { Args: []any{"read:pets", "petstore_auth"}, Level: checker.INFO, }, errs[0]) - require.Equal(t, "security scope 'read:pets' was removed from global security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed security scope 'read:pets' from global security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a security scope from an API global security @@ -128,7 +128,7 @@ func TestAPISecurityDeleted(t *testing.T) { Path: "/subscribe", Source: load.NewSource("../data/checker/api_security_added_base.yaml"), }, errs[0]) - require.Equal(t, "endpoint scheme security 'petstore_auth' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed endpoint scheme security 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a security scope from an API endpoint security @@ -150,7 +150,7 @@ func TestAPISecurityScopeRemoved(t *testing.T) { Path: "/subscribe", Source: load.NewSource("../data/checker/api_security_updated_revision.yaml"), }, errs[0]) - require.Equal(t, "security scope 'read:pets' was removed from endpoint security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed security scope 'read:pets' from endpoint security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a security scope to an API endpoint security diff --git a/checker/check_api_tag_updated_test.go b/checker/check_api_tag_updated_test.go index 620b3b95..96fda205 100644 --- a/checker/check_api_tag_updated_test.go +++ b/checker/check_api_tag_updated_test.go @@ -31,7 +31,7 @@ func TestTagAdded(t *testing.T) { Source: load.NewSource("../data/checker/tag_added_base.yaml"), OperationId: "createOneGroup", }, errs[0]) - require.Equal(t, "api tag 'newTag' added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added api tag 'newTag'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing an existing tag @@ -57,7 +57,7 @@ func TestTagRemoved(t *testing.T) { Source: load.NewSource("../data/checker/tag_removed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) - require.Equal(t, "api tag 'Test' removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed api tag 'Test'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_breaking_test.go b/checker/check_breaking_test.go index 8f36c863..c453ab17 100644 --- a/checker/check_breaking_test.go +++ b/checker/check_breaking_test.go @@ -245,7 +245,7 @@ func TestBreaking_ResponseHeaderRemoved(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequiredResponseHeaderRemovedId, errs[0].GetId()) - require.Equal(t, "mandatory header 'X-RateLimit-Limit' was removed for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed mandatory header 'X-RateLimit-Limit' for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing an existing response with successful status is breaking @@ -364,7 +364,7 @@ func TestBreaking_TagRemoved(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.APITagRemovedId, errs[0].GetId()) - require.Equal(t, "api tag 'security' removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed api tag 'security'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: removing/updating a media type enum in response (optional) @@ -436,7 +436,7 @@ func TestBreaking_OptionalResponseHeaderRemoved(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.OptionalResponseHeaderRemovedId, errs[0].GetId()) - require.Equal(t, "optional header 'X-RateLimit-Limit' was removed for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed optional header 'X-RateLimit-Limit' for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: deleting a media-type from response is breaking diff --git a/checker/check_components_security_updated_test.go b/checker/check_components_security_updated_test.go index 8b100470..4d5e85ee 100644 --- a/checker/check_components_security_updated_test.go +++ b/checker/check_components_security_updated_test.go @@ -111,7 +111,7 @@ func TestComponentSecurityRemoved(t *testing.T) { Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "component security scheme 'BasicAuth' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed component security scheme 'BasicAuth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding a new oauth security scope @@ -151,12 +151,12 @@ func TestComponentSecurityOauthScopeRemoved(t *testing.T) { errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.APIComponentsSecurityUpdatedCheck), d, osm, checker.INFO) require.Len(t, errs, 1) require.Equal(t, checker.ComponentChange{ - Id: "api-security-component-oauth-scope-removed", + Id: checker.APIComponentSecurityOauthScopeRemovedId, Args: []any{"petstore_auth", "admin:pets"}, Level: checker.INFO, Component: checker.ComponentSecuritySchemes, }, errs[0]) - require.Equal(t, "component security scheme 'petstore_auth' oauth scope 'admin:pets' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed component security scheme 'petstore_auth' oauth scope 'admin:pets'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing a new oauth security scope @@ -173,7 +173,7 @@ func TestComponentSecurityOauthScopeUpdated(t *testing.T) { errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.APIComponentsSecurityUpdatedCheck), d, osm, checker.INFO) require.Len(t, errs, 1) require.Equal(t, checker.ComponentChange{ - Id: "api-security-component-oauth-scope-changed", + Id: checker.APIComponentSecurityOauthScopeUpdatedId, Args: []any{"petstore_auth", "read:pets", "read your pets", "grants access to pets (deprecated)"}, Level: checker.INFO, Component: checker.ComponentSecuritySchemes, diff --git a/checker/check_response_pattern_added_or_changed.go b/checker/check_response_pattern_added_or_changed.go index 00850aae..6741376e 100644 --- a/checker/check_response_pattern_added_or_changed.go +++ b/checker/check_response_pattern_added_or_changed.go @@ -48,13 +48,13 @@ func ResponsePatternAddedOrChangedCheck(diffReport *diff.Diff, operationsSources propName := propertyFullName(propertyPath, propertyName) id := ResponsePropertyPatternChangedId - args := []any{propName, patternDiff.From, patternDiff.To, responseStatus} + args := []any{patternDiff.From, patternDiff.To, propName, responseStatus} if patternDiff.To == "" || patternDiff.To == nil { id = ResponsePropertyPatternRemovedId - args = []any{propName, patternDiff.From, responseStatus} + args = []any{patternDiff.From, propName, responseStatus} } else if patternDiff.From == "" || patternDiff.From == nil { id = ResponsePropertyPatternAddedId - args = []any{propName, patternDiff.To, responseStatus} + args = []any{patternDiff.To, propName, responseStatus} } result = append(result, NewApiChange( diff --git a/checker/check_response_pattern_added_or_changed_test.go b/checker/check_response_pattern_added_or_changed_test.go index 9e8e79ca..1e09949d 100644 --- a/checker/check_response_pattern_added_or_changed_test.go +++ b/checker/check_response_pattern_added_or_changed_test.go @@ -24,14 +24,14 @@ func TestResponsePropertyPatternChanged(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.ResponsePropertyPatternChangedId, - Args: []any{"data/created", "^[a-z]+$", "^(?:([a-z]+-)*([a-z]+)?)$", "200"}, + Args: []any{"^[a-z]+$", "^(?:([a-z]+-)*([a-z]+)?)$", "data/created", "200"}, Level: checker.INFO, Operation: "POST", Path: "/api/v1.0/groups", Source: load.NewSource("../data/checker/response_pattern_added_or_changed_revision.yaml"), OperationId: "createOneGroup", }, errs[0]) - require.Equal(t, "'data/created' response property pattern was changed from '^[a-z]+$' to '^(?:([a-z]+-)*([a-z]+)?)$' for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "changed pattern from '^[a-z]+$' to '^(?:([a-z]+-)*([a-z]+)?)$' in property 'data/created' for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding response property pattern @@ -49,14 +49,14 @@ func TestResponsePropertyPatternAdded(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.ResponsePropertyPatternAddedId, - Args: []any{"data/created", "^[a-z]+$", "200"}, + Args: []any{"^[a-z]+$", "data/created", "200"}, Level: checker.INFO, Operation: "POST", Path: "/api/v1.0/groups", Source: load.NewSource("../data/checker/response_pattern_added_or_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) - require.Equal(t, "'data/created' response property pattern '^[a-z]+$' was added for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added pattern '^[a-z]+$' to property 'data/created' for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing response property pattern @@ -74,12 +74,12 @@ func TestResponsePropertyPatternRemoved(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.ApiChange{ Id: checker.ResponsePropertyPatternRemovedId, - Args: []any{"data/created", "^[a-z]+$", "200"}, + Args: []any{"^[a-z]+$", "data/created", "200"}, Level: checker.INFO, Operation: "POST", Path: "/api/v1.0/groups", Source: load.NewSource("../data/checker/response_pattern_added_or_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) - require.Equal(t, "'data/created' response property pattern '^[a-z]+$' was removed for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "removed pattern '^[a-z]+$' from property 'data/created' for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_response_property_default_value_changed.go b/checker/check_response_property_default_value_changed.go index 8fe3fba4..fdfbf005 100644 --- a/checker/check_response_property_default_value_changed.go +++ b/checker/check_response_property_default_value_changed.go @@ -68,11 +68,11 @@ func ResponsePropertyDefaultValueChangedCheck(diffReport *diff.Diff, operationsS defaultValueDiff := propertyDiff.DefaultDiff if defaultValueDiff.From == nil { - appendResultItem(ResponsePropertyDefaultValueAddedId, propertyName, defaultValueDiff.To, responseStatus) + appendResultItem(ResponsePropertyDefaultValueAddedId, defaultValueDiff.To, propertyName, responseStatus) } else if defaultValueDiff.To == nil { - appendResultItem(ResponsePropertyDefaultValueRemovedId, propertyName, defaultValueDiff.From, responseStatus) + appendResultItem(ResponsePropertyDefaultValueRemovedId, defaultValueDiff.From, propertyName, responseStatus) } else { - appendResultItem(ResponsePropertyDefaultValueChangedId, propertyName, defaultValueDiff.From, defaultValueDiff.To, responseStatus) + appendResultItem(ResponsePropertyDefaultValueChangedId, defaultValueDiff.From, defaultValueDiff.To, propertyName, responseStatus) } }) } diff --git a/checker/check_response_property_default_value_changed_test.go b/checker/check_response_property_default_value_changed_test.go index c65b859e..cac70185 100644 --- a/checker/check_response_property_default_value_changed_test.go +++ b/checker/check_response_property_default_value_changed_test.go @@ -19,23 +19,28 @@ func TestResponsePropertyDefaultValueUpdatedCheck(t *testing.T) { require.NoError(t, err) errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.ResponsePropertyDefaultValueChangedCheck), d, osm, checker.INFO) require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{{ + + require.Equal(t, checker.ApiChange{ Id: checker.ResponsePropertyDefaultValueChangedId, - Args: []any{"created", "2020-01-01T00:00:00Z", "2020-02-01T00:00:00Z", "200"}, + Args: []any{"2020-01-01T00:00:00Z", "2020-02-01T00:00:00Z", "created", "200"}, Level: checker.INFO, Operation: "POST", Path: "/api/v1.0/groups", Source: load.NewSource("../data/checker/response_property_default_value_changed_revision.yaml"), OperationId: "createOneGroup", - }, { + }, errs[0]) + require.Equal(t, "changed default value from '2020-01-01T00:00:00Z' to '2020-02-01T00:00:00Z' for property 'created' for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ Id: checker.ResponsePropertyDefaultValueChangedId, - Args: []any{"enabled", false, true, "200"}, + Args: []any{false, true, "enabled", "200"}, Level: checker.INFO, Operation: "POST", Path: "/api/v1.0/groups", Source: load.NewSource("../data/checker/response_property_default_value_changed_revision.yaml"), OperationId: "createOneGroup", - }}, errs) + }, errs[1]) + require.Equal(t, "changed default value from 'false' to 'true' for property 'enabled' for response status '200'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing response body default value @@ -59,6 +64,7 @@ func TestResponseSchemaDefaultValueUpdatedCheck(t *testing.T) { Source: load.NewSource("../data/checker/response_property_default_value_changed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "response body 'text/plain' default value changed from 'Error' to 'new default value' for status '404'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: adding response body default value or response body property default value @@ -75,7 +81,8 @@ func TestResponsePropertyDefaultValueAddedCheck(t *testing.T) { require.NoError(t, err) errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.ResponsePropertyDefaultValueChangedCheck), d, osm, checker.INFO) require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{{ + + require.Equal(t, checker.ApiChange{ Id: checker.ResponseBodyDefaultValueAddedId, Args: []any{"text/plain", "Error", "404"}, Level: checker.INFO, @@ -83,15 +90,19 @@ func TestResponsePropertyDefaultValueAddedCheck(t *testing.T) { Path: "/api/v1.0/groups", Source: load.NewSource("../data/checker/response_property_default_value_changed_base.yaml"), OperationId: "createOneGroup", - }, { + }, errs[0]) + require.Equal(t, "response body 'text/plain' default value 'Error' was added for status '404'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ Id: checker.ResponsePropertyDefaultValueAddedId, - Args: []any{"created", "2020-01-01T00:00:00Z", "200"}, + Args: []any{"2020-01-01T00:00:00Z", "created", "200"}, Level: checker.INFO, Operation: "POST", Path: "/api/v1.0/groups", Source: load.NewSource("../data/checker/response_property_default_value_changed_base.yaml"), OperationId: "createOneGroup", - }}, errs) + }, errs[1]) + require.Equal(t, "added default value '2020-01-01T00:00:00Z' to response property 'created' for response status '200'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: removing response body default value or response body property default value @@ -108,7 +119,8 @@ func TestResponsePropertyDefaultValueRemovedCheck(t *testing.T) { require.NoError(t, err) errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.ResponsePropertyDefaultValueChangedCheck), d, osm, checker.INFO) require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{{ + + require.Equal(t, checker.ApiChange{ Id: checker.ResponseBodyDefaultValueRemovedId, Args: []any{"text/plain", "Error", "404"}, Level: checker.INFO, @@ -116,13 +128,17 @@ func TestResponsePropertyDefaultValueRemovedCheck(t *testing.T) { Path: "/api/v1.0/groups", Source: load.NewSource("../data/checker/response_property_default_value_changed_base.yaml"), OperationId: "createOneGroup", - }, { + }, errs[0]) + require.Equal(t, "response body 'text/plain' default value 'Error' was removed for status '404'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ Id: checker.ResponsePropertyDefaultValueRemovedId, - Args: []any{"created", "2020-01-01T00:00:00Z", "200"}, + Args: []any{"2020-01-01T00:00:00Z", "created", "200"}, Level: checker.INFO, Operation: "POST", Path: "/api/v1.0/groups", Source: load.NewSource("../data/checker/response_property_default_value_changed_base.yaml"), OperationId: "createOneGroup", - }}, errs) + }, errs[1]) + require.Equal(t, "removed default value '2020-01-01T00:00:00Z' of property 'created' for response status '200'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/localizations/localizations.go b/checker/localizations/localizations.go index 6e401575..aea04227 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 -// 2024-08-28 17:55:50.383577 +0300 IDT m=+0.005206293 +// 2024-08-29 12:10:22.97943 +0300 IDT m=+0.005018251 package localizations @@ -18,11 +18,11 @@ var localizations = map[string]string{ "en.messages.api-deprecated-sunset-parse-description": "endpoint deprecated with invalid sunset date", "en.messages.api-global-security-added": "security scheme %s was added", "en.messages.api-global-security-added-description": "security scheme added in security", - "en.messages.api-global-security-removed": "security scheme %s was removed", + "en.messages.api-global-security-removed": "removed security scheme %s", "en.messages.api-global-security-removed-description": "security scheme deleted in security", "en.messages.api-global-security-scope-added": "security scope %s was added to global security scheme %s", "en.messages.api-global-security-scope-added-description": "scope added to a security scheme in security", - "en.messages.api-global-security-scope-removed": "security scope %s was removed from global security scheme %s", + "en.messages.api-global-security-scope-removed": "removed security scope %s from global security scheme %s", "en.messages.api-global-security-scope-removed-description": "scope deleted from a security scheme in security", "en.messages.api-invalid-stability-level": "failed to parse stability level: %v", "en.messages.api-invalid-stability-level-description": "invalid stability level", @@ -50,21 +50,21 @@ var localizations = map[string]string{ "en.messages.api-security-component-oauth-scope-added-description": "scope added to OAuth flow in components/securitySchemes", "en.messages.api-security-component-oauth-scope-changed": "component security scheme %s oauth scope %s was updated from %s to %s", "en.messages.api-security-component-oauth-scope-changed-description": "scope modified in OAuth flow in components/securitySchemes", - "en.messages.api-security-component-oauth-scope-removed": "component security scheme %s oauth scope %s was removed", + "en.messages.api-security-component-oauth-scope-removed": "removed component security scheme %s oauth scope %s", "en.messages.api-security-component-oauth-scope-removed-description": "scope deleted from OAuth flow in components/securitySchemes", "en.messages.api-security-component-oauth-token-url-changed": "component security scheme %s oauth token url changed from %s to %s", "en.messages.api-security-component-oauth-token-url-changed-description": "token URL modified in OAuth flow in components/securitySchemes", "en.messages.api-security-component-oauth-url-changed": "component security scheme %s oauth url changed from %s to %s", "en.messages.api-security-component-oauth-url-changed-description": "auth URL modified in OAuth flow in components/securitySchemes", - "en.messages.api-security-component-removed": "component security scheme %s was removed", + "en.messages.api-security-component-removed": "removed component security scheme %s", "en.messages.api-security-component-removed-description": "security scheme deleted in components/securitySchemes", "en.messages.api-security-component-type-changed": "component security scheme %s type changed from %s to %s", "en.messages.api-security-component-type-changed-description": "security scheme type modified in components/securitySchemes", - "en.messages.api-security-removed": "endpoint scheme security %s was removed", + "en.messages.api-security-removed": "removed endpoint scheme security %s", "en.messages.api-security-removed-description": "security requirements deleted from endpoint", "en.messages.api-security-scope-added": "security scope %s was added to endpoint security scheme %s", "en.messages.api-security-scope-added-description": "scope added to an endpoint's security scheme", - "en.messages.api-security-scope-removed": "security scope %s was removed from endpoint security scheme %s", + "en.messages.api-security-scope-removed": "removed security scope %s from endpoint security scheme %s", "en.messages.api-security-scope-removed-description": "scope deleted from an endpoint's security scheme", "en.messages.api-security-updated": "endpoint scheme security %s was updated from %s to %s", "en.messages.api-stability-decreased": "endpoint stability level decreased from %s to %s", @@ -73,9 +73,9 @@ var localizations = map[string]string{ "en.messages.api-sunset-date-changed-too-small-description": "modified sunset date doesn't meet min required deprecation days", "en.messages.api-sunset-date-too-small": "sunset date %s is too small, must be at least %s days from now", "en.messages.api-sunset-date-too-small-description": "deprecated endpoint sunset before min required deprecation days", - "en.messages.api-tag-added": "api tag %s added", + "en.messages.api-tag-added": "added api tag %s", "en.messages.api-tag-added-description": "endpoint tag added", - "en.messages.api-tag-removed": "api tag %s removed", + "en.messages.api-tag-removed": "removed api tag %s", "en.messages.api-tag-removed-description": "endpoint tag deleted", "en.messages.at": "at", "en.messages.endpoint-added": "endpoint added", @@ -103,7 +103,7 @@ var localizations = map[string]string{ "en.messages.new-required-request-property-description": "required property added to request", "en.messages.new-required-request-property-with-default": "added required request property %s with a default value to media-type %s", "en.messages.new-required-request-property-with-default-description": "required property with default value added to request", - "en.messages.optional-response-header-removed": "optional header %s was removed for response status %s", + "en.messages.optional-response-header-removed": "removed optional header %s for response status %s", "en.messages.optional-response-header-removed-description": "optional response header deleted", "en.messages.pattern-changed-warn-comment": "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')", "en.messages.request-body-added-optional": "added optional request body", @@ -387,7 +387,7 @@ var localizations = map[string]string{ "en.messages.request-required-property-became-read-only-description": "request required property became read-only", "en.messages.request-required-property-became-write-only": "request required property %s became write-only", "en.messages.request-required-property-became-write-only-description": "request required property became write-only", - "en.messages.required-response-header-removed": "mandatory header %s was removed for response status %s", + "en.messages.required-response-header-removed": "removed mandatory header %s for response status %s", "en.messages.required-response-header-removed-description": "required response header removed", "en.messages.response-body-all-of-added": "added %s to response body 'allOf' list for response status %s", "en.messages.response-body-all-of-added-description": "sub-schema added to allOf in response body", @@ -479,11 +479,11 @@ var localizations = map[string]string{ "en.messages.response-property-became-optional-description": "response property became optional", "en.messages.response-property-became-required": "property %s became required for response status %s", "en.messages.response-property-became-required-description": "response property became required", - "en.messages.response-property-default-value-added": "%s response property default value %s was added for status %s", + "en.messages.response-property-default-value-added": "added default value %s to response property %s for response status %s", "en.messages.response-property-default-value-added-description": "response property default value set", - "en.messages.response-property-default-value-changed": "%s response property default value changed from %s to %s for status %s", + "en.messages.response-property-default-value-changed": "changed default value from %s to %s for property %s for response status %s", "en.messages.response-property-default-value-changed-description": "response property default value changed", - "en.messages.response-property-default-value-removed": "%s response property default value %s was removed for status %s", + "en.messages.response-property-default-value-removed": "removed default value %s of property %s for response status %s", "en.messages.response-property-default-value-removed-description": "response property default value unset", "en.messages.response-property-discriminator-added": "added discriminator to %s response property for response status %s", "en.messages.response-property-discriminator-added-description": "response property discriminator added", @@ -520,11 +520,11 @@ var localizations = map[string]string{ "en.messages.response-property-one-of-added-description": "sub-schema added to oneOf in response property", "en.messages.response-property-one-of-removed": "removed %s from %s response property 'oneOf' list for response status %s", "en.messages.response-property-one-of-removed-description": "sub-schema removed from oneOf in response property", - "en.messages.response-property-pattern-added": "%s response property pattern %s was added for status %s", + "en.messages.response-property-pattern-added": "added pattern %s to property %s for response status %s", "en.messages.response-property-pattern-added-description": "response property pattern set", - "en.messages.response-property-pattern-changed": "%s response property pattern was changed from %s to %s for status %s", + "en.messages.response-property-pattern-changed": "changed pattern from %s to %s in property %s for response status %s", "en.messages.response-property-pattern-changed-description": "response property pattern changed", - "en.messages.response-property-pattern-removed": "%s response property pattern %s was removed for status %s", + "en.messages.response-property-pattern-removed": "removed pattern %s from property %s for response status %s", "en.messages.response-property-pattern-removed-description": "response property pattern unset", "en.messages.response-property-type-changed": "%s response property type/format changed from %s/%s to %s/%s for status %s", "en.messages.response-property-type-changed-description": "response property type changed", diff --git a/checker/localizations_src/en/messages.yaml b/checker/localizations_src/en/messages.yaml index 7a004085..0ccd4e51 100644 --- a/checker/localizations_src/en/messages.yaml +++ b/checker/localizations_src/en/messages.yaml @@ -9,10 +9,10 @@ request-parameter-pattern-added: added pattern %s to the %s request parameter %s request-parameter-pattern-removed: removed pattern %s from the %s request parameter %s request-parameter-pattern-changed: changed pattern of the %s request parameter %s from %s to %s request-parameter-pattern-generalized: changed pattern of the %s request parameter %s from %s to a more general pattern %s -request-property-pattern-added: added pattern %s to the request property %s of media-type %s -request-property-pattern-removed: removed pattern %s from the request property %s of media-type %s -request-property-pattern-changed: changed pattern of the request property %s of media-type %s from %s to %s -request-property-pattern-generalized: changed pattern of the request property %s of media-type %s from %s to a more general pattern %s +request-property-pattern-added: added pattern %s to the request property %s of media-type %s # done +request-property-pattern-removed: removed pattern %s from the request property %s of media-type %s # done +request-property-pattern-changed: changed pattern of the request property %s of media-type %s from %s to %s # done +request-property-pattern-generalized: changed pattern of the request property %s of media-type %s from %s to a more general pattern %s # done api-deprecated-sunset-parse: "failed to parse sunset date: %v" api-path-sunset-parse: "failed to parse sunset date: %v" api-stability-decreased: endpoint stability level decreased from %s to %s @@ -28,21 +28,21 @@ api-removed-without-deprecation: api removed without deprecation api-removed-before-sunset: api removed before the sunset date %s api-operation-id-removed: api operation id %s removed and replaced with %s api-operation-id-added: api operation id %s was added -api-tag-removed: api tag %s removed -api-tag-added: api tag %s added +api-tag-removed: removed api tag %s +api-tag-added: added api tag %s api-schema-removed: removed schema %s sunset-deleted: api sunset date deleted, but deprecated=true kept api-sunset-date-changed-too-small: api sunset date changed to earlier date from %s to %s, new sunset date must be not earlier than %s at least %s days from now new-required-request-parameter: added required %s request parameter %s new-optional-request-parameter: added optional %s request parameter %s -new-required-request-property: added required request property %s to media-type %s -new-required-request-property-with-default: added required request property %s with a default value to media-type %s -new-optional-request-property: added optional request property %s to media-type %s +new-required-request-property: added required request property %s to media-type %s # done +new-required-request-property-with-default: added required request property %s with a default value to media-type %s # done +new-optional-request-property: added optional request property %s to media-type %s # done new-required-request-header-property: added required %s request header's property %s request-body-became-required: request body became required request-body-became-optional: request body became optional -request-body-became-enum: media-type %s of request body was restricted to a list of enum values -request-body-enum-value-removed: enum value %s removed from media-type %s of request body +request-body-became-enum: media-type %s of request body was restricted to a list of enum values # done +request-body-enum-value-removed: enum value %s removed from media-type %s of request body # done response-mediatype-enum-value-removed: response schema %s enum value removed %s request-header-property-became-required: "%s request header's property %s became required" request-header-property-became-enum: "%s request header's property %s was restricted to a list of enum values" @@ -83,9 +83,9 @@ request-parameter-property-type-changed-warn-comment: This is a warning because request-parameter-property-type-generalized: for %s request parameter %s, type/format of property %s was generalized from %s/%s to %s/%s request-parameter-property-type-specialized: for %s request parameter %s, type/format of property %s was specialized from %s/%s to %s/%s new-request-path-parameter: added path request parameter %s -request-property-became-required: request property %s of media-type %s became required -request-property-became-required-with-default: request property %s with a default value became required in media-type %s -request-property-became-optional: request property %s of media-type %s became optional +request-property-became-required: request property %s of media-type %s became required # done +request-property-became-required-with-default: request property %s with a default value became required in media-type %s # done +request-property-became-optional: request property %s of media-type %s became optional # done request-property-became-not-nullable: request property %s of media-type %s became not nullable request-body-became-not-nullable: media-type %s of request body became not nullable request-property-became-nullable: request property %s of media-type %s became nullable @@ -140,8 +140,8 @@ request-property-type-changed: type/format of request property %s of media-type request-property-type-generalized: type/format of request property %s of media-type %s was generalized from %s/%s to %s/%s request-property-x-extensible-enum-value-removed: removed x-extensible-enum value %s of request property %s of media-type %s response-header-became-optional: header %s became optional for response status %s -required-response-header-removed: mandatory header %s was removed for response status %s -optional-response-header-removed: optional header %s was removed for response status %s +required-response-header-removed: removed mandatory header %s for response status %s +optional-response-header-removed: removed optional header %s for response status %s response-media-type-removed: removed media type %s for response status %s response-media-type-added: added media type %s for response status %s response-optional-property-removed: removed optional property %s from response status %s @@ -176,22 +176,22 @@ response-property-max-increased: max value of %s response property was increased response-body-min-decreased: min value of response body was decreased from %s to %s response-property-min-decreased: min value of %s response property was decreased from %s to %s for response status %s api-security-added: endpoint scheme security %s was added -api-security-removed: endpoint scheme security %s was removed +api-security-removed: removed endpoint scheme security %s # done api-security-updated: endpoint scheme security %s was updated from %s to %s api-global-security-added: security scheme %s was added -api-global-security-removed: security scheme %s was removed -api-global-security-scope-removed: security scope %s was removed from global security scheme %s +api-global-security-removed: removed security scheme %s # done +api-global-security-scope-removed: removed security scope %s from global security scheme %s api-global-security-scope-added: security scope %s was added to global security scheme %s -api-security-scope-removed: security scope %s was removed from endpoint security scheme %s +api-security-scope-removed: removed security scope %s from endpoint security scheme %s # done api-stability-decreased-description: endpoint stability level decreased api-security-scope-added: security scope %s was added to endpoint security scheme %s api-security-component-type-changed: component security scheme %s type changed from %s to %s api-security-component-oauth-url-changed: component security scheme %s oauth url changed from %s to %s api-security-component-oauth-token-url-changed: component security scheme %s oauth token url changed from %s to %s api-security-component-added: component security scheme %s was added -api-security-component-removed: component security scheme %s was removed +api-security-component-removed: removed component security scheme %s # done api-security-component-oauth-scope-added: component security scheme %s oauth scope %s was added -api-security-component-oauth-scope-removed: component security scheme %s oauth scope %s was removed +api-security-component-oauth-scope-removed: removed component security scheme %s oauth scope %s # done api-security-component-oauth-scope-changed: component security scheme %s oauth scope %s was updated from %s to %s response-optional-property-added: added optional property %s to response status %s response-optional-write-only-property-added: added optional write-only property %s to response status %s @@ -211,12 +211,12 @@ response-optional-property-became-write-only: response optional property %s beca response-optional-property-became-read-only: response optional property %s became read-only for status %s response-optional-property-became-not-write-only: response optional property %s became not write-only for status %s response-optional-property-became-not-read-only: response optional property %s became not read-only for status %s -response-property-pattern-changed: "%s response property pattern was changed from %s to %s for status %s" -response-property-pattern-added: "%s response property pattern %s was added for status %s" -response-property-pattern-removed: "%s response property pattern %s was removed for status %s" -response-property-default-value-added: "%s response property default value %s was added for status %s" -response-property-default-value-changed: "%s response property default value changed from %s to %s for status %s" -response-property-default-value-removed: "%s response property default value %s was removed for status %s" +response-property-pattern-changed: changed pattern from %s to %s in property %s for response status %s # done +response-property-pattern-added: added pattern %s to property %s for response status %s # done +response-property-pattern-removed: removed pattern %s from property %s for response status %s # done +response-property-default-value-added: added default value %s to response property %s for response status %s +response-property-default-value-changed: changed default value from %s to %s for property %s for response status %s +response-property-default-value-removed: removed default value %s of property %s for response status %s response-body-default-value-added: response body %s default value %s was added for status %s response-body-default-value-changed: response body %s default value changed from %s to %s for status %s response-body-default-value-removed: response body %s default value %s was removed for status %s diff --git a/docs/BREAKING-CHANGES-EXAMPLES.md b/docs/BREAKING-CHANGES-EXAMPLES.md index 4ab0138a..1c8b48a2 100644 --- a/docs/BREAKING-CHANGES-EXAMPLES.md +++ b/docs/BREAKING-CHANGES-EXAMPLES.md @@ -201,7 +201,7 @@ These examples are automatically generated from unit tests. [adding request parameter default value](../checker/check_request_parameters_default_value_changed_test.go?plain=1#L34) [adding request property enum values](../checker/check_request_property_enum_value_updated_test.go?plain=1#L67) [adding request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L62) -[adding response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L64) +[adding response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L70) [adding response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L37) [adding two new request properties, one required, one optional](../checker/check_request_property_updated_test.go?plain=1#L35) [changing a response property schema format](../checker/check_response_property_type_changed_test.go?plain=1#L60) @@ -262,7 +262,7 @@ These examples are automatically generated from unit tests. [changing required response property to optional](../checker/check_response_property_became_optional_test.go?plain=1#L12) [changing required response property to read-only](../checker/check_response_required_property_write_only_read_only_test.go?plain=1#L65) [changing required response property to write-only](../checker/check_response_required_property_write_only_read_only_test.go?plain=1#L12) -[changing response body default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L41) +[changing response body default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L46) [changing response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L12) [changing response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L12) [changing security component oauth's url](../checker/check_components_security_updated_test.go?plain=1#L11) @@ -340,7 +340,7 @@ These examples are automatically generated from unit tests. [removing request property enum values](../checker/check_request_property_enum_value_updated_test.go?plain=1#L12) [removing request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L86) [removing request read-only property enum values](../checker/check_request_property_enum_value_updated_test.go?plain=1#L39) -[removing response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L97) +[removing response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L108) [removing response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L62) [setting max of request body](../checker/check_request_property_max_set_test.go?plain=1#L12) [setting max of request propreties](../checker/check_request_property_max_set_test.go?plain=1#L35) From 37fe6d487977110b939d8f2d641af6b7d3deff36 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 12:22:26 +0300 Subject: [PATCH 08/26] eliminate request header's --- checker/check_breaking_property_test.go | 6 +++--- checker/check_request_header_property_became_enum.go | 2 +- checker/check_request_header_property_became_required.go | 2 +- checker/localizations/localizations.go | 8 ++++---- checker/localizations_src/en/messages.yaml | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/checker/check_breaking_property_test.go b/checker/check_breaking_property_test.go index 39531f77..445156ea 100644 --- a/checker/check_breaking_property_test.go +++ b/checker/check_breaking_property_test.go @@ -34,7 +34,7 @@ func TestBreaking_NewRequiredProperty(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.NewRequiredRequestHeaderPropertyId, errs[0].GetId()) - require.Equal(t, "added required 'network-policies' request header's property 'courseId'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "added required 'network-policies' request header property 'courseId'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: new optional property in request header is not breaking @@ -79,7 +79,7 @@ func TestBreaking_PropertyRequiredEnabled(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestHeaderPropertyBecameRequiredId, errs[0].GetId()) - require.Equal(t, "'network-policies' request header's property 'courseId' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "property 'courseId' of request header 'network-policies' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing an existing property in request header to optional is not breaking @@ -222,7 +222,7 @@ func TestBreaking_ReqParameterHeaderPropertyBecameEnum(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestHeaderPropertyBecameEnumId, errs[0].GetId()) - require.Equal(t, "'bookId' request header's property 'name' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + require.Equal(t, "property 'name' of request header 'bookId' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing a response body to nullable is breaking diff --git a/checker/check_request_header_property_became_enum.go b/checker/check_request_header_property_became_enum.go index 5551e2c3..18e0796e 100644 --- a/checker/check_request_header_property_became_enum.go +++ b/checker/check_request_header_property_became_enum.go @@ -58,7 +58,7 @@ func RequestHeaderPropertyBecameEnumCheck(diffReport *diff.Diff, operationsSourc result = append(result, NewApiChange( RequestHeaderPropertyBecameEnumId, config, - []any{paramName, propertyFullName(propertyPath, propertyName)}, + []any{propertyFullName(propertyPath, propertyName), paramName}, "", operationsSources, operationItem.Revision, diff --git a/checker/check_request_header_property_became_required.go b/checker/check_request_header_property_became_required.go index d00edbdb..432a71b4 100644 --- a/checker/check_request_header_property_became_required.go +++ b/checker/check_request_header_property_became_required.go @@ -51,7 +51,7 @@ func RequestHeaderPropertyBecameRequiredCheck(diffReport *diff.Diff, operationsS result = append(result, NewApiChange( RequestHeaderPropertyBecameRequiredId, config, - []any{paramName, changedRequiredPropertyName}, + []any{changedRequiredPropertyName, paramName}, "", operationsSources, operationItem.Revision, diff --git a/checker/localizations/localizations.go b/checker/localizations/localizations.go index aea04227..dd0f69df 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 -// 2024-08-29 12:10:22.97943 +0300 IDT m=+0.005018251 +// 2024-08-29 12:19:41.291936 +0300 IDT m=+0.005275876 package localizations @@ -95,7 +95,7 @@ var localizations = map[string]string{ "en.messages.new-request-path-parameter-description": "new request path parameter", "en.messages.new-required-request-default-parameter-to-existing-path": "added required %s request parameter %s to all path's operations", "en.messages.new-required-request-default-parameter-to-existing-path-description": "required request parameter added at path level", - "en.messages.new-required-request-header-property": "added required %s request header's property %s", + "en.messages.new-required-request-header-property": "added required %s request header property %s", "en.messages.new-required-request-header-property-description": "new required request header", "en.messages.new-required-request-parameter": "added required %s request parameter %s", "en.messages.new-required-request-parameter-description": "required request parameter added to endpoint", @@ -191,9 +191,9 @@ var localizations = map[string]string{ "en.messages.request-body-type-changed-description": "request body type changed", "en.messages.request-body-type-generalized": "type/format of media-type %s of request body was generalized from %s/%s to %s/%s", "en.messages.request-body-type-generalized-description": "request body type generalized", - "en.messages.request-header-property-became-enum": "%s request header's property %s was restricted to a list of enum values", + "en.messages.request-header-property-became-enum": "property %s of request header %s was restricted to a list of enum values", "en.messages.request-header-property-became-enum-description": "request header property restricted to enum", - "en.messages.request-header-property-became-required": "%s request header's property %s became required", + "en.messages.request-header-property-became-required": "property %s of request header %s became required", "en.messages.request-header-property-became-required-description": "request header property became required", "en.messages.request-optional-property-became-not-read-only": "request optional property %s became not read-only", "en.messages.request-optional-property-became-not-read-only-description": "request optional property became not read-only", diff --git a/checker/localizations_src/en/messages.yaml b/checker/localizations_src/en/messages.yaml index 0ccd4e51..808ffb3b 100644 --- a/checker/localizations_src/en/messages.yaml +++ b/checker/localizations_src/en/messages.yaml @@ -38,14 +38,14 @@ new-optional-request-parameter: added optional %s request parameter %s new-required-request-property: added required request property %s to media-type %s # done new-required-request-property-with-default: added required request property %s with a default value to media-type %s # done new-optional-request-property: added optional request property %s to media-type %s # done -new-required-request-header-property: added required %s request header's property %s +new-required-request-header-property: added required %s request header property %s # done request-body-became-required: request body became required request-body-became-optional: request body became optional request-body-became-enum: media-type %s of request body was restricted to a list of enum values # done request-body-enum-value-removed: enum value %s removed from media-type %s of request body # done response-mediatype-enum-value-removed: response schema %s enum value removed %s -request-header-property-became-required: "%s request header's property %s became required" -request-header-property-became-enum: "%s request header's property %s was restricted to a list of enum values" +request-header-property-became-required: property %s of request header %s became required # done +request-header-property-became-enum: property %s of request header %s was restricted to a list of enum values # done request-parameter-became-required: "%s request parameter %s became required" request-parameter-became-optional: "%s request parameter %s became optional" request-parameter-became-enum: "%s request parameter %s was restricted to a list of enum values" From 84b6fbf2ef552f12f4ecfd1432b31a3489a92b9d Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 12:32:59 +0300 Subject: [PATCH 09/26] collect warnings --- ...t_parameter_required_value_updated_test.go | 2 ++ checker/localizations/localizations.go | 2 +- checker/localizations_src/en/messages.yaml | 33 ++++++++++--------- docs/BREAKING-CHANGES-EXAMPLES.md | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/checker/check_request_parameter_required_value_updated_test.go b/checker/check_request_parameter_required_value_updated_test.go index 824cca02..3ad92308 100644 --- a/checker/check_request_parameter_required_value_updated_test.go +++ b/checker/check_request_parameter_required_value_updated_test.go @@ -30,6 +30,7 @@ func TestBreaking_HeaderParamBecameRequired(t *testing.T) { Path: "/api/{domain}/{project}/install-command", Source: load.NewSource("../data/openapi-test1.yaml"), }, errs[0]) + require.Equal(t, "'header' request parameter 'network-policies' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing an existing header param from required to optional @@ -52,4 +53,5 @@ func TestBreaking_HeaderParamBecameOptional(t *testing.T) { Path: "/api/{domain}/{project}/install-command", Source: load.NewSource("../data/openapi-test1.yaml"), }, errs[0]) + require.Equal(t, "'header' request parameter 'network-policies' became optional", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/localizations/localizations.go b/checker/localizations/localizations.go index dd0f69df..92ae1fc3 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 -// 2024-08-29 12:19:41.291936 +0300 IDT m=+0.005275876 +// 2024-08-29 12:31:51.84397 +0300 IDT m=+0.004795626 package localizations diff --git a/checker/localizations_src/en/messages.yaml b/checker/localizations_src/en/messages.yaml index 808ffb3b..c2c266e3 100644 --- a/checker/localizations_src/en/messages.yaml +++ b/checker/localizations_src/en/messages.yaml @@ -46,12 +46,11 @@ request-body-enum-value-removed: enum value %s removed from media-type %s of req response-mediatype-enum-value-removed: response schema %s enum value removed %s request-header-property-became-required: property %s of request header %s became required # done request-header-property-became-enum: property %s of request header %s was restricted to a list of enum values # done -request-parameter-became-required: "%s request parameter %s became required" -request-parameter-became-optional: "%s request parameter %s became optional" +request-parameter-became-required: "%s request parameter %s became required" # done +request-parameter-became-optional: "%s request parameter %s became optional" # done request-parameter-became-enum: "%s request parameter %s was restricted to a list of enum values" request-parameter-enum-value-removed: removed enum value %s from the %s request parameter %s request-parameter-enum-value-added: added enum value %s to the %s request parameter %s -pattern-changed-warn-comment: This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*') request-parameter-x-extensible-enum-value-removed: removed x-extensible-enum value %s from the %s request parameter %s request-parameter-max-decreased: for %s request parameter %s, max was decreased from %s to %s request-parameter-max-increased: for %s request parameter %s, max was increased from %s to %s @@ -63,9 +62,7 @@ request-parameter-max-length-increased: for %s request parameter %s, maxLength w request-parameter-min-length-increased: for %s request parameter %s, minLength was increased from %s to %s request-parameter-min-length-decreased: for %s request parameter %s, minLength was decreased from %s to %s request-parameter-max-length-set: for %s request parameter %s, maxLength was set to %s -request-parameter-max-length-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. request-parameter-max-set: for %s request parameter %s, max was set to %s -request-parameter-max-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. request-parameter-min-increased: for %s request parameter %s, min was increased from %s to %s request-parameter-min-decreased: for %s request parameter %s, min was decreased from %s to %s request-parameter-max-items-decreased: for %s request parameter %s, maxItems was decreased from %s to %s @@ -73,13 +70,10 @@ request-parameter-max-items-increased: for %s request parameter %s, maxItems was request-parameter-min-items-increased: for %s request parameter %s, minItems was increased from %s to %s request-parameter-min-items-decreased: for %s request parameter %s, minItems was decreased from %s to %s request-parameter-min-items-set: for %s request parameter %s, minItems was set to %s -request-parameter-min-items-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. request-parameter-min-set: for %s request parameter %s, min was set to %s -request-parameter-min-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. request-parameter-type-changed: for %s request parameter %s, type/format was changed from %s/%s to %s/%s request-parameter-type-generalized: for %s request parameter %s, type/format was generalized from %s/%s to %s/%s request-parameter-property-type-changed: for %s request parameter %s, type/format of property %s was changed from %s/%s to %s/%s -request-parameter-property-type-changed-warn-comment: This is a warning because parameter objects can be passed in differnt ways, some of which allow this type change and others do not. request-parameter-property-type-generalized: for %s request parameter %s, type/format of property %s was generalized from %s/%s to %s/%s request-parameter-property-type-specialized: for %s request parameter %s, type/format of property %s was specialized from %s/%s to %s/%s new-request-path-parameter: added path request parameter %s @@ -109,13 +103,9 @@ request-property-max-increased: max value of request property %s of media-type % request-body-max-length-increased: maxLength value of media-type %s of request body was increased from %s to %s request-property-max-length-increased: maxLength value of request property %s of media-type %s was increased from %s to %s request-body-max-length-set: maxLength value of media-type %s of request body was set to %s -request-body-max-length-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. request-property-max-length-set: maxLength value of request property %s of media-type %s was set to %s -request-property-max-length-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. request-body-max-set: max value of media-type %s of request body was set to %s -request-body-max-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. request-property-max-set: max value of request property %s of media-type %s was set to %s -request-property-max-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. request-body-min-increased: min value of media-type %s of request body was increased to %s request-property-min-increased: min value of request property %s of media-type %s was increased to %s request-read-only-property-min-increased: min value of request read-only property %s of media-type %s was increased to %s @@ -126,13 +116,9 @@ request-property-min-decreased: min value of request property %s of media-type % request-body-min-items-decreased: minItems value of media-type %s of request body was decreased from %s to %s request-property-min-items-decreased: minItems value of request property %s of media-type %s was decreased from %s to %s request-body-min-items-set: minItems value of media-type %s of request body was set to %s -request-body-min-items-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. request-property-min-items-set: minItems value of request property %s of media-type %s was set to %s -request-property-min-items-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. request-body-min-set: min value of media-type %s of request body was set to %s -request-body-min-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. request-property-min-set: min value of request property %s of media-type %s was set to %s -request-property-min-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. request-property-removed: removed request property %s of media-type %s request-body-type-changed: type/format of media-type %s of request body changed from %s/%s to %s/%s request-body-type-generalized: type/format of media-type %s of request body was generalized from %s/%s to %s/%s @@ -284,6 +270,21 @@ request-required-property-became-write-only: request required property %s became request-required-property-became-not-write-only: request required property %s became not write-only new-required-request-default-parameter-to-existing-path: added required %s request parameter %s to all path's operations new-optional-request-default-parameter-to-existing-path: added optional %s request parameter %s to all path's operations +# warnings +pattern-changed-warn-comment: This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*') +request-parameter-max-length-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. +request-parameter-max-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. +request-parameter-min-items-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. +request-parameter-min-set-comment: This is a warning because sometimes it is required to be set because of security reasons or current error in specification. But good clients should be checked to support this restriction before such change in specification. +request-parameter-property-type-changed-warn-comment: This is a warning because parameter objects can be passed in differnt ways, some of which allow this type change and others do not. +request-body-max-length-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. +request-property-max-length-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. +request-body-max-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. +request-property-max-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. +request-body-min-items-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. +request-property-min-items-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. +request-body-min-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. +request-property-min-set-comment: This is a warning because sometimes it is required to be set. But good clients should be checked to support this restriction before such change in specification. # descriptions request-body-added-required-description: required request body added request-body-added-optional-description: optional request body added diff --git a/docs/BREAKING-CHANGES-EXAMPLES.md b/docs/BREAKING-CHANGES-EXAMPLES.md index 1c8b48a2..c354344b 100644 --- a/docs/BREAKING-CHANGES-EXAMPLES.md +++ b/docs/BREAKING-CHANGES-EXAMPLES.md @@ -208,7 +208,7 @@ These examples are automatically generated from unit tests. [changing a response property schema type from a single value to to multiple types](../checker/check_response_property_type_changed_test.go?plain=1#L126) [changing a response property schema type from string to integer](../checker/check_response_property_type_changed_test.go?plain=1#L36) [changing a response schema type](../checker/check_response_property_type_changed_test.go?plain=1#L14) -[changing an existing header param from required to optional](../checker/check_request_parameter_required_value_updated_test.go?plain=1#L35) +[changing an existing header param from required to optional](../checker/check_request_parameter_required_value_updated_test.go?plain=1#L36) [changing an existing header param to optional](../checker/check_not_breaking_test.go?plain=1#L132) [changing an existing request body from required to optional](../checker/check_not_breaking_test.go?plain=1#L53) [changing discriminator mapping in the request body or request body property](../checker/check_request_discriminator_updated_test.go?plain=1#L113) From cda060b8f76d36ed4e448d50c77f3ac1b384cc9a Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 16:06:24 +0300 Subject: [PATCH 10/26] add test id to test comments --- checker/check_api_added_test.go | 4 +- checker/check_api_deprecation_test.go | 16 +-- .../check_api_operation_id_updated_test.go | 8 +- checker/check_api_removed_test.go | 12 +- checker/check_api_security_updated_test.go | 16 +-- checker/check_api_sunset_changed_test.go | 8 +- checker/check_api_tag_updated_test.go | 6 +- checker/check_breaking_min_max_test.go | 33 +++-- checker/check_breaking_test.go | 2 +- ...parameter_pattern_added_or_changed_test.go | 8 +- ..._property_pattern_added_or_changed_test.go | 8 +- checker/localizations_src/en/messages.yaml | 60 ++++----- docs/BREAKING-CHANGES-EXAMPLES.md | 119 +++++++++--------- scripts/get_tested_ids.sh | 12 ++ 14 files changed, 170 insertions(+), 142 deletions(-) create mode 100755 scripts/get_tested_ids.sh diff --git a/checker/check_api_added_test.go b/checker/check_api_added_test.go index c1067743..99b586ba 100644 --- a/checker/check_api_added_test.go +++ b/checker/check_api_added_test.go @@ -8,7 +8,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// CL: new paths or path operations +// CL: new paths or path operations: endpoint-added func TestApiAdded_DetectsNewPathsAndNewOperations(t *testing.T) { s1, err := open("../data/new_endpoints/base.yaml") require.NoError(t, err) @@ -36,7 +36,7 @@ func TestApiAdded_DetectsNewPathsAndNewOperations(t *testing.T) { require.Equal(t, "/api/test3", e1.Path) } -// CL: new paths or path operations +// CL: new paths or path operations: endpoint-added func TestApiAdded_DetectsModifiedPathsWithPathParam(t *testing.T) { s1, err := open("../data/new_endpoints/base_with_path_param.yaml") require.NoError(t, err) diff --git a/checker/check_api_deprecation_test.go b/checker/check_api_deprecation_test.go index 5acf8dbd..40ace1ab 100644 --- a/checker/check_api_deprecation_test.go +++ b/checker/check_api_deprecation_test.go @@ -45,7 +45,7 @@ func TestBreaking_DeprecationPast(t *testing.T) { require.Empty(t, errs) } -// BC: deprecating an operation with a deprecation policy and an invalid sunset date is breaking +// BC: deprecating an operation with a deprecation policy and an invalid sunset date is breaking: api-deprecated-sunset-parse func TestBreaking_DeprecationWithInvalidSunset(t *testing.T) { s1, err := open(getDeprecationFile("base.yaml")) @@ -64,7 +64,7 @@ func TestBreaking_DeprecationWithInvalidSunset(t *testing.T) { require.Equal(t, "failed to parse sunset date: 'sunset date doesn't conform with RFC3339: invalid'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: deprecating an operation with a deprecation policy and an invalid stability level is breaking +// BC: deprecating an operation with a deprecation policy and an invalid stability level is breaking: api-invalid-stability-level func TestBreaking_DeprecationWithInvalidStabilityLevel(t *testing.T) { s1, err := open(getDeprecationFile("base.yaml")) @@ -100,7 +100,7 @@ func TestBreaking_DeprecationWithoutSunsetNoPolicy(t *testing.T) { require.Empty(t, errs) } -// BC: deprecating an operation with a deprecation policy but without specifying sunset date is breaking +// BC: deprecating an operation with a deprecation policy but without specifying sunset date is breaking: api-deprecated-sunset-missing func TestBreaking_DeprecationWithoutSunsetWithPolicy(t *testing.T) { s1, err := open(getDeprecationFile("base.yaml")) @@ -211,7 +211,7 @@ func toJson(t *testing.T, value string) json.RawMessage { return data } -// BC: deprecating an operation with a deprecation policy and sunset date before required deprecation period is breaking +// BC: deprecating an operation with a deprecation policy and sunset date before required deprecation period is breaking: api-sunset-date-too-small func TestBreaking_DeprecationWithEarlySunset(t *testing.T) { s1, err := open(getDeprecationFile("base.yaml")) require.NoError(t, err) @@ -231,7 +231,7 @@ func TestBreaking_DeprecationWithEarlySunset(t *testing.T) { require.Equal(t, fmt.Sprintf("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 +// BC: deprecating an operation with a deprecation policy and sunset date after required deprecation period is not breaking: endpoint-deprecated func TestBreaking_DeprecationWithProperSunset(t *testing.T) { s1, err := open(getDeprecationFile("base.yaml")) @@ -249,6 +249,7 @@ func TestBreaking_DeprecationWithProperSunset(t *testing.T) { require.Len(t, errs, 1) // only a non-breaking change detected require.Equal(t, checker.INFO, errs[0].GetLevel()) + require.Equal(t, checker.EndpointDeprecatedId, errs[0].GetId()) require.Equal(t, "endpoint deprecated", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } @@ -267,7 +268,7 @@ func TestBreaking_DeprecationPathPast(t *testing.T) { require.Empty(t, errs) } -// CL: path operations that became deprecated +// CL: path operations that became deprecated: endpoint-deprecated func TestApiDeprecated_DetectsDeprecatedOperations(t *testing.T) { s1, err := open("../data/deprecation/base.yaml") require.NoError(t, err) @@ -290,7 +291,7 @@ func TestApiDeprecated_DetectsDeprecatedOperations(t *testing.T) { require.Equal(t, "endpoint deprecated", e0.GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: path operations that were re-activated +// CL: path operations that were re-activated: endpoint-reactivated func TestApiDeprecated_DetectsReactivatedOperations(t *testing.T) { s1, err := open("../data/deprecation/deprecated-future.yaml") require.NoError(t, err) @@ -313,6 +314,7 @@ func TestApiDeprecated_DetectsReactivatedOperations(t *testing.T) { require.Equal(t, "endpoint reactivated", e0.GetUncolorizedText(checker.NewDefaultLocalizer())) } +// BC: specifying an invalid stability level is breaking: api-invalid-stability-level func TestBreaking_InvaidStability(t *testing.T) { s1, err := open(getDeprecationFile("invalid-stability.yaml")) diff --git a/checker/check_api_operation_id_updated_test.go b/checker/check_api_operation_id_updated_test.go index 50a3e0cd..e2acc4d7 100644 --- a/checker/check_api_operation_id_updated_test.go +++ b/checker/check_api_operation_id_updated_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/load" ) -// CL: removing an existing operation id +// CL: removing an existing operation id: api-operation-id-removed func TestOperationIdRemoved(t *testing.T) { s1, err := open("../data/checker/operation_id_removed_base.yaml") require.NoError(t, err) @@ -31,9 +31,11 @@ func TestOperationIdRemoved(t *testing.T) { Source: load.NewSource("../data/checker/operation_id_removed_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + + require.Equal(t, "api operation id 'createOneGroup' removed and replaced with ''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: updating an existing operation id +// CL: updating an existing operation id: api-operation-id-removed func TestOperationIdUpdated(t *testing.T) { s1, err := open("../data/checker/operation_id_removed_base.yaml") require.NoError(t, err) @@ -59,7 +61,7 @@ func TestOperationIdUpdated(t *testing.T) { require.Equal(t, "api operation id 'createOneGroup' removed and replaced with 'newOperationId'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding a new operation id +// CL: adding a new operation id: api-operation-id-added func TestOperationIdAdded(t *testing.T) { s1, err := open("../data/checker/operation_id_added_base.yaml") require.NoError(t, err) diff --git a/checker/check_api_removed_test.go b/checker/check_api_removed_test.go index bc52ce33..773f4a21 100644 --- a/checker/check_api_removed_test.go +++ b/checker/check_api_removed_test.go @@ -8,7 +8,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// BC: deleting an operation before sunset date is breaking +// BC: deleting an operation before sunset date is breaking: api-removed-before-sunset func TestBreaking_RemoveBeforeSunset(t *testing.T) { s1, err := open(getDeprecationFile("deprecated-future.yaml")) @@ -41,7 +41,7 @@ func TestBreaking_DeprecationNoSunset(t *testing.T) { require.Empty(t, errs) } -// BC: removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not alpha stability level +// BC: removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not alpha stability level: api-path-removed-without-deprecation func TestBreaking_RemovedPathForAlphaBreaking(t *testing.T) { s1, err := open(getDeprecationFile("base-alpha-stability.yaml")) require.NoError(t, err) @@ -61,7 +61,7 @@ func TestBreaking_RemovedPathForAlphaBreaking(t *testing.T) { require.Equal(t, "api path removed without deprecation", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not draft stability level +// BC: removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not draft stability level: api-path-removed-without-deprecation func TestBreaking_RemovedPathForDraftBreaking(t *testing.T) { s1, err := open(getDeprecationFile("base-alpha-stability.yaml")) require.NoError(t, err) @@ -83,7 +83,7 @@ func TestBreaking_RemovedPathForDraftBreaking(t *testing.T) { require.Equal(t, "api path removed without deprecation", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: deleting a path with some operations having sunset date in the future is breaking +// BC: deleting a path with some operations having sunset date in the future is breaking: api-path-removed-before-sunset func TestBreaking_DeprecationPathMixed(t *testing.T) { s1, err := open(getDeprecationFile("deprecated-path-mixed.yaml")) @@ -101,7 +101,7 @@ func TestBreaking_DeprecationPathMixed(t *testing.T) { require.Equal(t, "api path removed before the sunset date '9999-08-10'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing a deprecated enpoint with an invalid date is breaking +// BC: removing a deprecated enpoint with an invalid date is breaking: api-path-sunset-parse func TestBreaking_RemoveEndpointWithInvalidSunset(t *testing.T) { s1, err := open(getDeprecationFile("deprecated-invalid.yaml")) @@ -122,7 +122,7 @@ func TestBreaking_RemoveEndpointWithInvalidSunset(t *testing.T) { require.Equal(t, "../data/deprecation/deprecated-invalid.yaml", errs[0].GetSource()) } -// test sunset date without double quotes, see https://github.com/Tufin/oasdiff/pull/198/files +// test sunset date without double quotes, see https://github.com/Tufin/oasdiff/pull/198/files: api-path-removed-before-sunset func TestBreaking_DeprecationPathMixed_RFC3339_Sunset(t *testing.T) { s1, err := open(getDeprecationFile("deprecated-path-mixed-rfc3339-sunset.yaml")) diff --git a/checker/check_api_security_updated_test.go b/checker/check_api_security_updated_test.go index 55aff872..417cbf2b 100644 --- a/checker/check_api_security_updated_test.go +++ b/checker/check_api_security_updated_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/load" ) -// CL: adding a new global security to the API +// CL: adding a new global security to the API: api-global-security-added func TestAPIGlobalSecurityyAdded(t *testing.T) { s1, err := open("../data/checker/api_security_global_added_base.yaml") require.NoError(t, err) @@ -28,7 +28,7 @@ func TestAPIGlobalSecurityyAdded(t *testing.T) { require.Equal(t, "security scheme 'petstore_auth' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing a global security from the API +// CL: removing a global security from the API: api-global-security-removed func TestAPIGlobalSecurityyDeleted(t *testing.T) { s1, err := open("../data/checker/api_security_global_added_revision.yaml") require.NoError(t, err) @@ -47,7 +47,7 @@ func TestAPIGlobalSecurityyDeleted(t *testing.T) { require.Equal(t, "removed security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing a security scope from an API global security +// CL: removing a security scope from an API global security: api-global-security-scope-removed func TestAPIGlobalSecurityScopeRemoved(t *testing.T) { s1, err := open("../data/checker/api_security_global_added_revision.yaml") require.NoError(t, err) @@ -67,7 +67,7 @@ func TestAPIGlobalSecurityScopeRemoved(t *testing.T) { require.Equal(t, "removed security scope 'read:pets' from global security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding a security scope from an API global security +// CL: adding a security scope from an API global security: api-global-security-scope-added func TestAPIGlobalSecurityScopeAdded(t *testing.T) { s1, err := open("../data/checker/api_security_global_added_revision.yaml") require.NoError(t, err) @@ -87,7 +87,7 @@ func TestAPIGlobalSecurityScopeAdded(t *testing.T) { require.Equal(t, "security scope 'read:pets' was added to global security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding a new security to the API endpoint +// CL: adding a new security to the API endpoint: api-security-added func TestAPISecurityAdded(t *testing.T) { s1, err := open("../data/checker/api_security_added_base.yaml") require.NoError(t, err) @@ -109,7 +109,7 @@ func TestAPISecurityAdded(t *testing.T) { require.Equal(t, "endpoint scheme security 'petstore_auth' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing a new security to the API endpoint +// CL: removing a new security to the API endpoint: api-security-removed func TestAPISecurityDeleted(t *testing.T) { s1, err := open("../data/checker/api_security_added_revision.yaml") require.NoError(t, err) @@ -131,7 +131,7 @@ func TestAPISecurityDeleted(t *testing.T) { require.Equal(t, "removed endpoint scheme security 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing a security scope from an API endpoint security +// CL: removing a security scope from an API endpoint security: api-security-scope-removed func TestAPISecurityScopeRemoved(t *testing.T) { s1, err := open("../data/checker/api_security_updated_base.yaml") require.NoError(t, err) @@ -153,7 +153,7 @@ func TestAPISecurityScopeRemoved(t *testing.T) { require.Equal(t, "removed security scope 'read:pets' from endpoint security scheme 'petstore_auth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding a security scope to an API endpoint security +// CL: adding a security scope to an API endpoint security: api-security-scope-added func TestAPISecurityScopeAdded(t *testing.T) { s1, err := open("../data/checker/api_security_updated_revision.yaml") require.NoError(t, err) diff --git a/checker/check_api_sunset_changed_test.go b/checker/check_api_sunset_changed_test.go index 657cf5e9..4777676c 100644 --- a/checker/check_api_sunset_changed_test.go +++ b/checker/check_api_sunset_changed_test.go @@ -8,7 +8,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// BC: deleting sunset header for a deprecated endpoint is breaking +// BC: deleting sunset header for a deprecated endpoint is breaking: sunset-deleted func TestBreaking_SunsetDeletedForDeprecatedEndpoint(t *testing.T) { s1, err := open(getDeprecationFile("deprecated-with-sunset.yaml")) @@ -26,7 +26,7 @@ func TestBreaking_SunsetDeletedForDeprecatedEndpoint(t *testing.T) { require.Equal(t, "api sunset date deleted, but deprecated=true kept", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing sunset to an earlier date for a deprecated endpoint with a deprecation policy is breaking +// BC: changing sunset to an earlier date for a deprecated endpoint with a deprecation policy is breaking: api-sunset-date-changed-too-small func TestBreaking_SunsetModifiedForDeprecatedEndpoint(t *testing.T) { s1, err := open(getDeprecationFile("deprecated-future.yaml")) @@ -44,7 +44,7 @@ func TestBreaking_SunsetModifiedForDeprecatedEndpoint(t *testing.T) { require.Equal(t, "api sunset date changed to earlier date from '9999-08-10' to '2022-08-10', new sunset date must be not earlier than '9999-08-10' at least '180' days from now", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing sunset to an invalid date for a deprecated endpoint is breaking +// BC: changing sunset to an invalid date for a deprecated endpoint is breaking: api-path-sunset-parse func TestBreaking_SunsetModifiedToInvalidForDeprecatedEndpoint(t *testing.T) { s1, err := open(getDeprecationFile("deprecated-future.yaml")) @@ -62,7 +62,7 @@ func TestBreaking_SunsetModifiedToInvalidForDeprecatedEndpoint(t *testing.T) { require.Equal(t, "failed to parse sunset date: 'sunset date doesn't conform with RFC3339: invalid-date'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing sunset from an invalid date for a deprecated endpoint is breaking +// BC: changing sunset from an invalid date for a deprecated endpoint is breaking: api-path-sunset-parse func TestBreaking_SunsetModifiedFromInvalidForDeprecatedEndpoint(t *testing.T) { s1, err := open(getDeprecationFile("deprecated-invalid.yaml")) diff --git a/checker/check_api_tag_updated_test.go b/checker/check_api_tag_updated_test.go index 96fda205..4388b692 100644 --- a/checker/check_api_tag_updated_test.go +++ b/checker/check_api_tag_updated_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/load" ) -// CL: adding a new tag +// CL: adding a new tag: api-tag-added func TestTagAdded(t *testing.T) { s1, err := open("../data/checker/tag_added_base.yaml") require.NoError(t, err) @@ -34,7 +34,7 @@ func TestTagAdded(t *testing.T) { require.Equal(t, "added api tag 'newTag'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing an existing tag +// CL: removing an existing tag: api-tag-removed func TestTagRemoved(t *testing.T) { s1, err := open("../data/checker/tag_removed_base.yaml") require.NoError(t, err) @@ -61,7 +61,7 @@ func TestTagRemoved(t *testing.T) { } -// CL: updating an existing tag +// CL: updating an existing tag: api-tag-removed, api-tag-added func TestTagUpdated(t *testing.T) { s1, err := open("../data/checker/tag_removed_base.yaml") require.NoError(t, err) diff --git a/checker/check_breaking_min_max_test.go b/checker/check_breaking_min_max_test.go index dbfe69a4..c021be2f 100644 --- a/checker/check_breaking_min_max_test.go +++ b/checker/check_breaking_min_max_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// BC: reducing max length in request is breaking +// BC: reducing max length in request is breaking: request-parameter-max-length-decreased func TestBreaking_RequestMaxLengthSmaller(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -26,6 +26,7 @@ func TestBreaking_RequestMaxLengthSmaller(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterMaxLengthDecreasedId, errs[0].GetId()) + require.Equal(t, "for 'path' request parameter 'domain', maxLength was decreased from '13' to '11'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: reducing max length in response is not breaking @@ -59,7 +60,7 @@ func TestBreaking_RequestMinLengthSmaller(t *testing.T) { require.Empty(t, errs) } -// BC: reducing min length in response is breaking +// BC: reducing min length in response is breaking: response-body-min-length-decreased func TestBreaking_MinLengthSmaller(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -71,6 +72,7 @@ func TestBreaking_MinLengthSmaller(t *testing.T) { require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Equal(t, checker.ResponseBodyMinLengthDecreasedId, errs[0].GetId()) + require.Equal(t, "minLength value of response body was decreased from '13' to '11'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: increasing max length in request is not breaking @@ -90,7 +92,7 @@ func TestBreaking_RequestMaxLengthGreater(t *testing.T) { require.Empty(t, errs) } -// BC: increasing max length in response is breaking +// BC: increasing max length in response is breaking: response-body-max-length-increased func TestBreaking_ResponseMaxLengthGreater(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -104,10 +106,12 @@ func TestBreaking_ResponseMaxLengthGreater(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) - require.NotEmpty(t, errs) + require.Len(t, errs, 1) + require.Equal(t, checker.ResponseBodyMaxLengthIncreasedId, errs[0].GetId()) + require.Equal(t, "maxLength value of response body was increased from '13' to '14'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing max length in request from nil to any value is breaking +// BC: changing max length in request from nil to any value is breaking: request-parameter-max-length-set func TestBreaking_MaxLengthFromNil(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -123,6 +127,7 @@ func TestBreaking_MaxLengthFromNil(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestParameterMaxLengthSetId, errs[0].GetId()) + require.Equal(t, "for 'path' request parameter 'domain', maxLength was set to '14'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: changing max length in response from nil to any value is not breaking @@ -157,7 +162,7 @@ func TestBreaking_RequestMaxLengthToNil(t *testing.T) { require.Empty(t, errs) } -// BC: changing max length in response from any value to nil is breaking +// BC: changing max length in response from any value to nil is breaking: response-body-max-length-unset func TestBreaking_ResponseMaxLengthToNil(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -173,6 +178,7 @@ func TestBreaking_ResponseMaxLengthToNil(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponseBodyMaxLengthUnsetId, errs[0].GetId()) + require.Equal(t, "maxLength value of response body was unset from '13'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: both max lengths in request are nil is not breaking @@ -217,7 +223,7 @@ func TestBreaking_RequestMinItemsSmaller(t *testing.T) { require.Empty(t, errs) } -// BC: reducing min items in response is breaking +// BC: reducing min items in response is breaking: response-body-min-items-decreased func TestBreaking_ResponseMinItemsSmaller(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -231,9 +237,10 @@ func TestBreaking_ResponseMinItemsSmaller(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponseBodyMinItemsDecreasedId, errs[0].GetId()) + require.Equal(t, "minItems value of response body was decreased from '13' to '11'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: increasing min items in request is breaking +// BC: increasing min items in request is breaking: request-parameter-min-items-increased func TestBreaking_RequeatMinItemsGreater(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -244,7 +251,9 @@ func TestBreaking_RequeatMinItemsGreater(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) - require.NotEmpty(t, errs) + require.Len(t, errs, 1) + require.Equal(t, checker.RequestParameterMinItemsIncreasedId, errs[0].GetId()) + require.Equal(t, "for 'path' request parameter 'domain', minItems was increased from '13' to '14'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: increasing min items in response is not breaking @@ -261,7 +270,7 @@ func TestBreaking_ResponseMinItemsGreater(t *testing.T) { require.Empty(t, errs) } -// BC: reducing max in request is breaking +// BC: reducing max in request is breaking: request-parameter-max-decreased func TestBreaking_MaxSmaller(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -275,7 +284,9 @@ func TestBreaking_MaxSmaller(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) - require.NotEmpty(t, errs) + require.Len(t, errs, 1) + require.Equal(t, checker.RequestParameterMaxDecreasedId, errs[0].GetId()) + require.Equal(t, "for 'path' request parameter 'domain', max was decreased from '13.00' to '11.00'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: reducing max in response is not breaking diff --git a/checker/check_breaking_test.go b/checker/check_breaking_test.go index c453ab17..95f32331 100644 --- a/checker/check_breaking_test.go +++ b/checker/check_breaking_test.go @@ -536,7 +536,7 @@ func TestBreaking_GeneralizedPattern(t *testing.T) { require.Empty(t, errs) } -// BC: modifying a pattern in request parameter is breaking +// BC: modifying a pattern in request parameter is breaking: request-parameter-pattern-removed func TestBreaking_ModifyParameterPattern(t *testing.T) { s1, err := open("../data/pattern-parameter-base.yaml") require.NoError(t, err) diff --git a/checker/check_request_parameter_pattern_added_or_changed_test.go b/checker/check_request_parameter_pattern_added_or_changed_test.go index 1b002f29..076ab56e 100644 --- a/checker/check_request_parameter_pattern_added_or_changed_test.go +++ b/checker/check_request_parameter_pattern_added_or_changed_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/load" ) -// CL: changing pattern of request parameters +// CL: changing pattern of request parameters: request-parameter-pattern-changed func TestRequestParameterPatternChanged(t *testing.T) { s1, err := open("../data/checker/request_parameter_pattern_added_or_changed_base.yaml") require.NoError(t, err) @@ -34,7 +34,7 @@ func TestRequestParameterPatternChanged(t *testing.T) { require.Equal(t, "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')", errs[0].GetComment(checker.NewDefaultLocalizer())) } -// CL: generalizing pattern of request parameters +// CL: generalizing pattern of request parameters: request-parameter-pattern-generalized func TestRequestParameterPatternGeneralized(t *testing.T) { s1, err := open("../data/checker/request_parameter_pattern_added_or_changed_base.yaml") require.NoError(t, err) @@ -57,7 +57,7 @@ func TestRequestParameterPatternGeneralized(t *testing.T) { require.Equal(t, "changed pattern of the 'query' request parameter 'category' from '^\\w+$' to a more general pattern '.*'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding pattern to request parameters +// CL: adding pattern to request parameters: request-parameter-pattern-added func TestRequestParameterPatternAdded(t *testing.T) { s1, err := open("../data/checker/request_parameter_pattern_added_or_changed_revision.yaml") require.NoError(t, err) @@ -81,7 +81,7 @@ func TestRequestParameterPatternAdded(t *testing.T) { require.Equal(t, "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')", errs[0].GetComment(checker.NewDefaultLocalizer())) } -// CL: removing pattern from request parameters +// CL: removing pattern from request parameters: request-parameter-pattern-removed func TestRequestParameterPatternRemoved(t *testing.T) { s1, err := open("../data/checker/request_parameter_pattern_added_or_changed_base.yaml") require.NoError(t, err) diff --git a/checker/check_request_property_pattern_added_or_changed_test.go b/checker/check_request_property_pattern_added_or_changed_test.go index 488c4760..ba545377 100644 --- a/checker/check_request_property_pattern_added_or_changed_test.go +++ b/checker/check_request_property_pattern_added_or_changed_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/load" ) -// CL: changing request property pattern +// CL: changing request property pattern: request-property-pattern-changed func TestRequestPropertyPatternChanged(t *testing.T) { s1, err := open("../data/checker/request_property_pattern_added_or_changed_base.yaml") require.NoError(t, err) @@ -35,7 +35,7 @@ func TestRequestPropertyPatternChanged(t *testing.T) { require.Equal(t, "This is a warning because it is difficult to automatically analyze if the new pattern is a superset of the previous pattern (e.g. changed from '[0-9]+' to '[0-9]*')", errs[0].GetComment(checker.NewDefaultLocalizer())) } -// CL: generalizing request property pattern +// CL: generalizing request property pattern: request-property-pattern-generalized func TestRequestPropertyPatternGeneralized(t *testing.T) { s1, err := open("../data/checker/request_property_pattern_added_or_changed_base.yaml") require.NoError(t, err) @@ -59,7 +59,7 @@ func TestRequestPropertyPatternGeneralized(t *testing.T) { require.Equal(t, "changed pattern of the request property 'name' of media-type 'application/json' from '^\\w+$' to a more general pattern '.*'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding request property pattern +// CL: adding request property pattern: request-property-pattern-added func TestRequestPropertyPatternAdded(t *testing.T) { s1, err := open("../data/checker/request_property_pattern_added_or_changed_revision.yaml") require.NoError(t, err) @@ -83,7 +83,7 @@ func TestRequestPropertyPatternAdded(t *testing.T) { require.Equal(t, "added pattern '^\\w+$' to the request property 'name' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing request property pattern +// CL: removing request property pattern: request-property-pattern-removed func TestRequestPropertyPatternRemoved(t *testing.T) { s1, err := open("../data/checker/request_property_pattern_added_or_changed_base.yaml") require.NoError(t, err) diff --git a/checker/localizations_src/en/messages.yaml b/checker/localizations_src/en/messages.yaml index c2c266e3..1893a858 100644 --- a/checker/localizations_src/en/messages.yaml +++ b/checker/localizations_src/en/messages.yaml @@ -5,15 +5,15 @@ request-body-added-optional: added optional request body request-parameter-removed: deleted the %s request parameter %s total-errors: "%d breaking changes: %d %s, %d %s\\n" total-changes: "%d changes: %d %s, %d %s, %d %s\\n" -request-parameter-pattern-added: added pattern %s to the %s request parameter %s -request-parameter-pattern-removed: removed pattern %s from the %s request parameter %s -request-parameter-pattern-changed: changed pattern of the %s request parameter %s from %s to %s -request-parameter-pattern-generalized: changed pattern of the %s request parameter %s from %s to a more general pattern %s -request-property-pattern-added: added pattern %s to the request property %s of media-type %s # done -request-property-pattern-removed: removed pattern %s from the request property %s of media-type %s # done -request-property-pattern-changed: changed pattern of the request property %s of media-type %s from %s to %s # done -request-property-pattern-generalized: changed pattern of the request property %s of media-type %s from %s to a more general pattern %s # done -api-deprecated-sunset-parse: "failed to parse sunset date: %v" +request-parameter-pattern-added: added pattern %s to the %s request parameter %s # tested +request-parameter-pattern-removed: removed pattern %s from the %s request parameter %s # tested +request-parameter-pattern-changed: changed pattern of the %s request parameter %s from %s to %s # tested +request-parameter-pattern-generalized: changed pattern of the %s request parameter %s from %s to a more general pattern %s # tested +request-property-pattern-added: added pattern %s to the request property %s of media-type %s # tested +request-property-pattern-removed: removed pattern %s from the request property %s of media-type %s # tested +request-property-pattern-changed: changed pattern of the request property %s of media-type %s from %s to %s # tested +request-property-pattern-generalized: changed pattern of the request property %s of media-type %s from %s to a more general pattern %s # tested +api-deprecated-sunset-parse: "failed to parse sunset date: %v" # tested api-path-sunset-parse: "failed to parse sunset date: %v" api-stability-decreased: endpoint stability level decreased from %s to %s api-invalid-stability-level: "failed to parse stability level: %v" @@ -35,19 +35,19 @@ sunset-deleted: api sunset date deleted, but deprecated=true kept api-sunset-date-changed-too-small: api sunset date changed to earlier date from %s to %s, new sunset date must be not earlier than %s at least %s days from now new-required-request-parameter: added required %s request parameter %s new-optional-request-parameter: added optional %s request parameter %s -new-required-request-property: added required request property %s to media-type %s # done -new-required-request-property-with-default: added required request property %s with a default value to media-type %s # done -new-optional-request-property: added optional request property %s to media-type %s # done -new-required-request-header-property: added required %s request header property %s # done +new-required-request-property: added required request property %s to media-type %s # tested +new-required-request-property-with-default: added required request property %s with a default value to media-type %s # tested +new-optional-request-property: added optional request property %s to media-type %s # tested +new-required-request-header-property: added required %s request header property %s # tested request-body-became-required: request body became required request-body-became-optional: request body became optional -request-body-became-enum: media-type %s of request body was restricted to a list of enum values # done -request-body-enum-value-removed: enum value %s removed from media-type %s of request body # done +request-body-became-enum: media-type %s of request body was restricted to a list of enum values # tested +request-body-enum-value-removed: enum value %s removed from media-type %s of request body # tested response-mediatype-enum-value-removed: response schema %s enum value removed %s -request-header-property-became-required: property %s of request header %s became required # done -request-header-property-became-enum: property %s of request header %s was restricted to a list of enum values # done -request-parameter-became-required: "%s request parameter %s became required" # done -request-parameter-became-optional: "%s request parameter %s became optional" # done +request-header-property-became-required: property %s of request header %s became required # tested +request-header-property-became-enum: property %s of request header %s was restricted to a list of enum values # tested +request-parameter-became-required: "%s request parameter %s became required" # tested +request-parameter-became-optional: "%s request parameter %s became optional" # tested request-parameter-became-enum: "%s request parameter %s was restricted to a list of enum values" request-parameter-enum-value-removed: removed enum value %s from the %s request parameter %s request-parameter-enum-value-added: added enum value %s to the %s request parameter %s @@ -77,9 +77,9 @@ request-parameter-property-type-changed: for %s request parameter %s, type/forma request-parameter-property-type-generalized: for %s request parameter %s, type/format of property %s was generalized from %s/%s to %s/%s request-parameter-property-type-specialized: for %s request parameter %s, type/format of property %s was specialized from %s/%s to %s/%s new-request-path-parameter: added path request parameter %s -request-property-became-required: request property %s of media-type %s became required # done -request-property-became-required-with-default: request property %s with a default value became required in media-type %s # done -request-property-became-optional: request property %s of media-type %s became optional # done +request-property-became-required: request property %s of media-type %s became required # tested +request-property-became-required-with-default: request property %s with a default value became required in media-type %s # tested +request-property-became-optional: request property %s of media-type %s became optional # tested request-property-became-not-nullable: request property %s of media-type %s became not nullable request-body-became-not-nullable: media-type %s of request body became not nullable request-property-became-nullable: request property %s of media-type %s became nullable @@ -162,22 +162,22 @@ response-property-max-increased: max value of %s response property was increased response-body-min-decreased: min value of response body was decreased from %s to %s response-property-min-decreased: min value of %s response property was decreased from %s to %s for response status %s api-security-added: endpoint scheme security %s was added -api-security-removed: removed endpoint scheme security %s # done +api-security-removed: removed endpoint scheme security %s # tested api-security-updated: endpoint scheme security %s was updated from %s to %s api-global-security-added: security scheme %s was added -api-global-security-removed: removed security scheme %s # done +api-global-security-removed: removed security scheme %s # tested api-global-security-scope-removed: removed security scope %s from global security scheme %s api-global-security-scope-added: security scope %s was added to global security scheme %s -api-security-scope-removed: removed security scope %s from endpoint security scheme %s # done +api-security-scope-removed: removed security scope %s from endpoint security scheme %s # tested api-stability-decreased-description: endpoint stability level decreased api-security-scope-added: security scope %s was added to endpoint security scheme %s api-security-component-type-changed: component security scheme %s type changed from %s to %s api-security-component-oauth-url-changed: component security scheme %s oauth url changed from %s to %s api-security-component-oauth-token-url-changed: component security scheme %s oauth token url changed from %s to %s api-security-component-added: component security scheme %s was added -api-security-component-removed: removed component security scheme %s # done +api-security-component-removed: removed component security scheme %s # tested api-security-component-oauth-scope-added: component security scheme %s oauth scope %s was added -api-security-component-oauth-scope-removed: removed component security scheme %s oauth scope %s # done +api-security-component-oauth-scope-removed: removed component security scheme %s oauth scope %s # tested api-security-component-oauth-scope-changed: component security scheme %s oauth scope %s was updated from %s to %s response-optional-property-added: added optional property %s to response status %s response-optional-write-only-property-added: added optional write-only property %s to response status %s @@ -197,9 +197,9 @@ response-optional-property-became-write-only: response optional property %s beca response-optional-property-became-read-only: response optional property %s became read-only for status %s response-optional-property-became-not-write-only: response optional property %s became not write-only for status %s response-optional-property-became-not-read-only: response optional property %s became not read-only for status %s -response-property-pattern-changed: changed pattern from %s to %s in property %s for response status %s # done -response-property-pattern-added: added pattern %s to property %s for response status %s # done -response-property-pattern-removed: removed pattern %s from property %s for response status %s # done +response-property-pattern-changed: changed pattern from %s to %s in property %s for response status %s # tested +response-property-pattern-added: added pattern %s to property %s for response status %s # tested +response-property-pattern-removed: removed pattern %s from property %s for response status %s # tested response-property-default-value-added: added default value %s to response property %s for response status %s response-property-default-value-changed: changed default value from %s to %s for property %s for response status %s response-property-default-value-removed: removed default value %s of property %s for response status %s diff --git a/docs/BREAKING-CHANGES-EXAMPLES.md b/docs/BREAKING-CHANGES-EXAMPLES.md index c354344b..24e9074c 100644 --- a/docs/BREAKING-CHANGES-EXAMPLES.md +++ b/docs/BREAKING-CHANGES-EXAMPLES.md @@ -29,8 +29,8 @@ These examples are automatically generated from unit tests. [changing an existing request body from optional to required is breaking](../checker/check_breaking_test.go?plain=1#L79) [changing an existing required property in response body to not-write-only is breaking](../checker/check_breaking_property_test.go?plain=1#L586) [changing an existing response header from required to optional is breaking](../checker/check_breaking_test.go?plain=1#L214) -[changing max length in request from nil to any value is breaking](../checker/check_breaking_min_max_test.go?plain=1#L110) -[changing max length in response from any value to nil is breaking](../checker/check_breaking_min_max_test.go?plain=1#L160) +[changing max length in request from nil to any value is breaking: request-parameter-max-length-set](../checker/check_breaking_min_max_test.go?plain=1#L114) +[changing max length in response from any value to nil is breaking: response-body-max-length-unset](../checker/check_breaking_min_max_test.go?plain=1#L165) [changing request's body schema type from number to integer is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L52) [changing request's body schema type from number to string is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L32) [changing request's body schema type from number/none to integer/int32 is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L92) @@ -40,44 +40,44 @@ These examples are automatically generated from unit tests. [changing response's body schema type from number to string is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L32) [changing response's body schema type from string to number is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L12) [changing response's embedded property schema type from string/none to integer/int32 is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L109) -[changing sunset from an invalid date for a deprecated endpoint is breaking](../checker/check_api_sunset_changed_test.go?plain=1#L65) -[changing sunset to an earlier date for a deprecated endpoint with a deprecation policy is breaking](../checker/check_api_sunset_changed_test.go?plain=1#L29) -[changing sunset to an invalid date for a deprecated endpoint is breaking](../checker/check_api_sunset_changed_test.go?plain=1#L47) +[changing sunset from an invalid date for a deprecated endpoint is breaking: api-path-sunset-parse](../checker/check_api_sunset_changed_test.go?plain=1#L65) +[changing sunset to an earlier date for a deprecated endpoint with a deprecation policy is breaking: api-sunset-date-changed-too-small](../checker/check_api_sunset_changed_test.go?plain=1#L29) +[changing sunset to an invalid date for a deprecated endpoint is breaking: api-path-sunset-parse](../checker/check_api_sunset_changed_test.go?plain=1#L47) [decreasing stability level is breaking](../checker/checker_test.go?plain=1#L11) [deleting a media-type from response is breaking](../checker/check_breaking_test.go?plain=1#L442) [deleting a non-required non-write-only property in response body is breaking with warning](../checker/check_breaking_property_test.go?plain=1#L528) [deleting a path is breaking](../checker/check_breaking_test.go?plain=1#L37) -[deleting a path with some operations having sunset date in the future is breaking](../checker/check_api_removed_test.go?plain=1#L86) +[deleting a path with some operations having sunset date in the future is breaking: api-path-removed-before-sunset](../checker/check_api_removed_test.go?plain=1#L86) [deleting a required property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L381) [deleting a required property in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L434) [deleting a required property under AllOf in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L465) [deleting an embedded optional property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L398) [deleting an enum value is breaking](../checker/check_breaking_test.go?plain=1#L101) -[deleting an operation before sunset date is breaking](../checker/check_api_removed_test.go?plain=1#L11) +[deleting an operation before sunset date is breaking: api-removed-before-sunset](../checker/check_api_removed_test.go?plain=1#L11) [deleting an operation is breaking](../checker/check_breaking_test.go?plain=1#L45) -[deleting sunset header for a deprecated endpoint is breaking](../checker/check_api_sunset_changed_test.go?plain=1#L11) -[deprecating an operation with a deprecation policy and an invalid stability level is breaking](../checker/check_api_deprecation_test.go?plain=1#L67) -[deprecating an operation with a deprecation policy and an invalid sunset date is breaking](../checker/check_api_deprecation_test.go?plain=1#L48) -[deprecating an operation with a deprecation policy and sunset date before required deprecation period is breaking](../checker/check_api_deprecation_test.go?plain=1#L214) -[deprecating an operation with a deprecation policy but without specifying sunset date is breaking](../checker/check_api_deprecation_test.go?plain=1#L103) +[deleting sunset header for a deprecated endpoint is breaking: sunset-deleted](../checker/check_api_sunset_changed_test.go?plain=1#L11) +[deprecating an operation with a deprecation policy and an invalid stability level is breaking: api-invalid-stability-level](../checker/check_api_deprecation_test.go?plain=1#L67) +[deprecating an operation with a deprecation policy and an invalid sunset date is breaking: api-deprecated-sunset-parse](../checker/check_api_deprecation_test.go?plain=1#L48) +[deprecating an operation with a deprecation policy and sunset date before required deprecation period is breaking: api-sunset-date-too-small](../checker/check_api_deprecation_test.go?plain=1#L214) +[deprecating an operation with a deprecation policy but without specifying sunset date is breaking: api-deprecated-sunset-missing](../checker/check_api_deprecation_test.go?plain=1#L103) [inclreasing request body min items is breaking](../checker/check_request_property_min_items_increased_test.go?plain=1#L12) -[increasing max length in response is breaking](../checker/check_breaking_min_max_test.go?plain=1#L93) -[increasing min items in request is breaking](../checker/check_breaking_min_max_test.go?plain=1#L236) +[increasing max length in response is breaking: response-body-max-length-increased](../checker/check_breaking_min_max_test.go?plain=1#L95) +[increasing min items in request is breaking: request-parameter-min-items-increased](../checker/check_breaking_min_max_test.go?plain=1#L243) [modifying a pattern in a schema is breaking](../checker/check_breaking_test.go?plain=1#L507) -[modifying a pattern in request parameter is breaking](../checker/check_breaking_test.go?plain=1#L539) +[modifying a pattern in request parameter is breaking: request-parameter-pattern-removed](../checker/check_breaking_test.go?plain=1#L539) [modifying the default value of an optional request parameter is breaking](../checker/check_breaking_test.go?plain=1#L570) [new header, query and cookie required request default param is breaking](../checker/check_new_request_non_path_default_parameter_test.go?plain=1#L12) [new required header param is breaking](../checker/check_breaking_test.go?plain=1#L173) [new required path param is breaking](../checker/check_breaking_test.go?plain=1#L156) [new required property in request header is breaking](../checker/check_breaking_property_test.go?plain=1#L18) -[reducing max in request is breaking](../checker/check_breaking_min_max_test.go?plain=1#L264) -[reducing max length in request is breaking](../checker/check_breaking_min_max_test.go?plain=1#L12) -[reducing min items in response is breaking](../checker/check_breaking_min_max_test.go?plain=1#L220) -[reducing min length in response is breaking](../checker/check_breaking_min_max_test.go?plain=1#L62) +[reducing max in request is breaking: request-parameter-max-decreased](../checker/check_breaking_min_max_test.go?plain=1#L273) +[reducing max length in request is breaking: request-parameter-max-length-decreased](../checker/check_breaking_min_max_test.go?plain=1#L12) +[reducing min items in response is breaking: response-body-min-items-decreased](../checker/check_breaking_min_max_test.go?plain=1#L226) +[reducing min length in response is breaking: response-body-min-length-decreased](../checker/check_breaking_min_max_test.go?plain=1#L63) [removing 'allOf' subschema from the request body or request body property is breaking with warn](../checker/check_breaking_test.go?plain=1#L749) [removing 'anyOf' schema from the request body or request body property is breaking](../checker/check_breaking_test.go?plain=1#L684) [removing 'oneOf' schema from the request body or request body property is breaking](../checker/check_breaking_test.go?plain=1#L706) -[removing a deprecated enpoint with an invalid date is breaking](../checker/check_api_removed_test.go?plain=1#L104) +[removing a deprecated enpoint with an invalid date is breaking: api-path-sunset-parse](../checker/check_api_removed_test.go?plain=1#L104) [removing a media type from request body is breaking](../checker/check_breaking_test.go?plain=1#L668) [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#L422) @@ -86,8 +86,8 @@ These examples are automatically generated from unit tests. [removing an existing response with successful status is breaking](../checker/check_breaking_test.go?plain=1#L251) [removing an schema object from components is breaking (optional)](../checker/check_breaking_test.go?plain=1#L643) [removing the default value of an optional request parameter is breaking](../checker/check_breaking_test.go?plain=1#L606) -[removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not alpha stability level](../checker/check_api_removed_test.go?plain=1#L44) -[removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not draft stability level](../checker/check_api_removed_test.go?plain=1#L64) +[removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not alpha stability level: api-path-removed-without-deprecation](../checker/check_api_removed_test.go?plain=1#L44) +[removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not draft stability level: api-path-removed-without-deprecation](../checker/check_api_removed_test.go?plain=1#L64) [removing/updating a property enum in response is breaking (optional)](../checker/check_breaking_test.go?plain=1#L333) [removing/updating a tag is breaking (optional)](../checker/check_breaking_test.go?plain=1#L351) [removing/updating an enum in request body is breaking (optional)](../checker/check_breaking_test.go?plain=1#L310) @@ -97,6 +97,7 @@ These examples are automatically generated from unit tests. [specifying a non-text, not-json stability level in base is breaking](../checker/checker_test.go?plain=1#L82) [specifying an invalid stability level in base is breaking](../checker/checker_test.go?plain=1#L65) [specifying an invalid stability level in revision is breaking](../checker/checker_test.go?plain=1#L48) +[specifying an invalid stability level is breaking: api-invalid-stability-level](../checker/check_api_deprecation_test.go?plain=1#L317) ## Examples of non-breaking changes [adding a media-type to response is not breaking](../checker/check_not_breaking_test.go?plain=1#L184) @@ -110,8 +111,8 @@ These examples are automatically generated from unit tests. [adding an enum value to request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L143) [adding an operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L277) [adding an optional request body is not breaking](../checker/check_not_breaking_test.go?plain=1#L38) -[both max lengths in request are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L178) -[both max lengths in response are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L192) +[both max lengths in request are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L184) +[both max lengths in response are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L198) [changing a link to operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L175) [changing an existing property in request body items to required with a default value is not breaking](../checker/check_breaking_property_test.go?plain=1#L647) [changing an existing property in request body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L335) @@ -122,14 +123,14 @@ These examples are automatically generated from unit tests. [changing an existing write-only property in response body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L558) [changing comments is not breaking](../checker/check_not_breaking_test.go?plain=1#L106) [changing extensions is not breaking](../checker/check_not_breaking_test.go?plain=1#L94) -[changing max length in request from any value to nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L144) -[changing max length in response from nil to any value is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L128) +[changing max length in request from any value to nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L149) +[changing max length in response from nil to any value is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L133) [changing operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L166) [changing request's body schema type from integer to number is not breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L72) [changing response's body schema type from number to integer is not breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L52) [changing response's body schema type from number/none to integer/int32 is not breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L90) [changing servers is not breaking](../checker/check_not_breaking_test.go?plain=1#L252) -[deleting a path after sunset date of all contained operations is not breaking](../checker/check_api_deprecation_test.go?plain=1#L255) +[deleting a path after sunset date of all contained operations is not breaking](../checker/check_api_deprecation_test.go?plain=1#L256) [deleting a pattern from a schema is not breaking](../checker/check_breaking_test.go?plain=1#L459) [deleting a required write-only property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L510) [deleting a tag is not breaking](../checker/check_not_breaking_test.go?plain=1#L71) @@ -140,13 +141,13 @@ These examples are automatically generated from unit tests. [deprecating a parameter is not breaking](../checker/check_not_breaking_test.go?plain=1#L213) [deprecating a schema is not breaking](../checker/check_not_breaking_test.go?plain=1#L239) [deprecating an operation with a default deprecation policy but without specifying sunset date is not breaking](../checker/check_api_deprecation_test.go?plain=1#L121) -[deprecating an operation with a deprecation policy and sunset date after required deprecation period is not breaking](../checker/check_api_deprecation_test.go?plain=1#L234) +[deprecating an operation with a deprecation policy and sunset date after required deprecation period is not breaking: endpoint-deprecated](../checker/check_api_deprecation_test.go?plain=1#L234) [deprecating an operation without a deprecation policy and without specifying sunset date is not breaking for alpha level](../checker/check_api_deprecation_test.go?plain=1#L137) [deprecating an operation without a deprecation policy and without specifying sunset date is not breaking for draft level](../checker/check_api_deprecation_test.go?plain=1#L171) [deprecating an operation without a deprecation policy but without specifying sunset date is not breaking](../checker/check_api_deprecation_test.go?plain=1#L87) [descreasing request body min items is not breaking](../checker/check_request_property_min_items_increased_test.go?plain=1#L35) -[increasing max length in request is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L76) -[increasing min items in response is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L250) +[increasing max length in request is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L78) +[increasing min items in response is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L259) [increasing stability level is not breaking](../checker/checker_test.go?plain=1#L33) [modifying a pattern to ".*" in a schema is not breaking](../checker/check_breaking_test.go?plain=1#L556) [modifying a pattern to .* in a schema is not breaking](../checker/check_breaking_test.go?plain=1#L525) @@ -156,10 +157,10 @@ These examples are automatically generated from unit tests. [new required response header param is not breaking](../checker/check_not_breaking_test.go?plain=1#L152) [no change is not breaking](../checker/check_not_breaking_test.go?plain=1#L27) [no change to headers for a deprecated endpoint is not breaking](../checker/check_api_sunset_changed_test.go?plain=1#L99) -[reducing max in response is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L281) -[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) +[reducing max in response is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L292) +[reducing max length in response is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L32) +[reducing min items in request is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L212) +[reducing min length in request is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L49) [removing an existing response with error status is not breaking](../checker/check_breaking_test.go?plain=1#L406) [removing an existing response with unparseable status is not breaking](../checker/check_breaking_test.go?plain=1#L390) [removing the path without a deprecation policy and without specifying sunset date is not breaking for alpha level](../checker/check_api_deprecation_test.go?plain=1#L152) @@ -173,22 +174,22 @@ These examples are automatically generated from unit tests. [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 global security to the API: api-global-security-added](../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) [adding a new oauth security scope](../checker/check_components_security_updated_test.go?plain=1#L117) -[adding a new operation id](../checker/check_api_operation_id_updated_test.go?plain=1#L62) +[adding a new operation id: api-operation-id-added](../checker/check_api_operation_id_updated_test.go?plain=1#L64) [adding a new optional request property](../checker/check_request_property_updated_test.go?plain=1#L70) [adding a new required request property with a default value](../checker/check_request_property_updated_test.go?plain=1#L117) [adding a new required request property](../checker/check_request_property_updated_test.go?plain=1#L12) [adding a new security component](../checker/check_components_security_updated_test.go?plain=1#L77) -[adding a new security to the API endpoint](../checker/check_api_security_updated_test.go?plain=1#L90) -[adding a new tag](../checker/check_api_tag_updated_test.go?plain=1#L12) +[adding a new security to the API endpoint: api-security-added](../checker/check_api_security_updated_test.go?plain=1#L90) +[adding a new tag: api-tag-added](../checker/check_api_tag_updated_test.go?plain=1#L12) [adding a non-success response status](../checker/check_response_status_updated_test.go?plain=1#L37) [adding a required property to response body is detected](../checker/check_response_required_property_updated_test.go?plain=1#L12) [adding a required write-only property to response body is detected](../checker/check_response_required_property_updated_test.go?plain=1#L58) -[adding a security scope from an API global security](../checker/check_api_security_updated_test.go?plain=1#L70) -[adding a security scope to an API endpoint security](../checker/check_api_security_updated_test.go?plain=1#L156) +[adding a security scope from an API global security: api-global-security-scope-added](../checker/check_api_security_updated_test.go?plain=1#L70) +[adding a security scope to an API endpoint security: api-security-scope-added](../checker/check_api_security_updated_test.go?plain=1#L156) [adding a success response status](../checker/check_response_status_updated_test.go?plain=1#L12) [adding an enum value to a response property](../checker/check_response_property_enum_value_added_test.go?plain=1#L12) [adding an enum value to a response write-only property](../checker/check_response_property_enum_value_added_test.go?plain=1#L38) @@ -196,11 +197,11 @@ These examples are automatically generated from unit tests. [adding an optional write-only property to a response](../checker/check_response_optional_property_updated_test.go?plain=1#L34) [adding discriminator to the request body or request body property](../checker/check_request_discriminator_updated_test.go?plain=1#L13) [adding discriminator to the response body or response property](../checker/check_response_discriminator_updated_test.go?plain=1#L13) -[adding pattern to request parameters](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L60) +[adding pattern to request parameters: request-parameter-pattern-added](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L60) [adding request body default value or request property default value](../checker/check_request_property_default_value_changed_test.go?plain=1#L58) [adding request parameter default value](../checker/check_request_parameters_default_value_changed_test.go?plain=1#L34) [adding request property enum values](../checker/check_request_property_enum_value_updated_test.go?plain=1#L67) -[adding request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L62) +[adding request property pattern: request-property-pattern-added](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L62) [adding response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L70) [adding response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L37) [adding two new request properties, one required, one optional](../checker/check_request_property_updated_test.go?plain=1#L35) @@ -225,7 +226,7 @@ These examples are automatically generated from unit tests. [changing optional response property to required](../checker/check_response_property_became_required_test.go?plain=1#L12) [changing optional response property to write-only](../checker/check_response_optional_property_write_only_read_only_test.go?plain=1#L12) [changing optional response write-only property to required](../checker/check_response_property_became_required_test.go?plain=1#L33) -[changing pattern of request parameters](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L12) +[changing pattern of request parameters: request-parameter-pattern-changed](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L12) [changing properties of subschemas under allOf](../checker/check_response_property_type_changed_test.go?plain=1#L84) [changing request body and property types from array to object](../checker/check_request_property_type_changed_test.go?plain=1#L90) [changing request body and property types from object to array](../checker/check_request_property_type_changed_test.go?plain=1#L125) @@ -243,7 +244,7 @@ These examples are automatically generated from unit tests. [changing request path parameter type](../checker/check_request_parameters_type_changed_test.go?plain=1#L14) [changing request property default value](../checker/check_request_property_default_value_changed_test.go?plain=1#L34) [changing request property format](../checker/check_request_property_type_changed_test.go?plain=1#L160) -[changing request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L12) +[changing request property pattern: request-property-pattern-changed](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L12) [changing request property required value to false](../checker/check_request_property_required_updated_test.go?plain=1#L36) [changing request property required value to true](../checker/check_request_property_required_updated_test.go?plain=1#L12) [changing request property to not nullable](../checker/check_request_property_became_not_nuallable_test.go?plain=1#L12) @@ -285,9 +286,9 @@ These examples are automatically generated from unit tests. [decreasing request property maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L12) [decreasing request read-only property maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L38) [deprecating an operation with sunset greater than min](../checker/check_not_breaking_test.go?plain=1#L198) -[generalizing pattern of request parameters](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L37) +[generalizing pattern of request parameters: request-parameter-pattern-generalized](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L37) [generalizing request property format](../checker/check_request_property_type_changed_test.go?plain=1#L186) -[generalizing request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L38) +[generalizing request property pattern: request-property-pattern-generalized](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L38) [generalizing request's query param property type from integer to number](../checker/check_request_parameters_type_changed_test.go?plain=1#L250) [increasing max length of request body](../checker/check_request_property_max_length_updated_test.go?plain=1#L12) [increasing max length of request property](../checker/check_request_property_max_length_updated_test.go?plain=1#L128) @@ -305,40 +306,40 @@ These examples are automatically generated from unit tests. [increasing request property maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L65) [making request property required, while also giving it a default value](../checker/check_request_property_required_updated_test.go?plain=1#L60) [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/check_api_deprecation_test.go?plain=1#L270) -[path operations that were re-activated](../checker/check_api_deprecation_test.go?plain=1#L293) +[new paths or path operations: endpoint-added](../checker/check_api_added_test.go?plain=1#L11) +[path operations that became deprecated: endpoint-deprecated](../checker/check_api_deprecation_test.go?plain=1#L271) +[path operations that were re-activated: endpoint-reactivated](../checker/check_api_deprecation_test.go?plain=1#L294) [removing 'allOf' subschema from the request body or request body property](../checker/check_request_property_all_of_updated_test.go?plain=1#L48) [removing 'allOf' subschema from the response body or response body property](../checker/check_response_property_all_of_updated_test.go?plain=1#L46) [removing 'anyOf' schema from the request body or request body property](../checker/check_request_property_any_of_updated_test.go?plain=1#L48) [removing 'anyOf' schema from the response body or response body property](../checker/check_response_property_any_of_updated_test.go?plain=1#L46) [removing 'oneOf' schema from the request body or request body property](../checker/check_request_property_one_of_updated_test.go?plain=1#L48) [removing 'oneOf' schema from the response body or response body property](../checker/check_response_property_one_of_updated_test.go?plain=1#L55) -[removing a global security from the API](../checker/check_api_security_updated_test.go?plain=1#L31) +[removing a global security from the API: api-global-security-removed](../checker/check_api_security_updated_test.go?plain=1#L31) [removing a new media type to response](../checker/check_response_mediatype_updated_test.go?plain=1#L34) [removing a new oauth security scope](../checker/check_components_security_updated_test.go?plain=1#L139) [removing a new security component](../checker/check_components_security_updated_test.go?plain=1#L97) -[removing a new security to the API endpoint](../checker/check_api_security_updated_test.go?plain=1#L112) +[removing a new security to the API endpoint: api-security-removed](../checker/check_api_security_updated_test.go?plain=1#L112) [removing a non-success response status](../checker/check_response_status_updated_test.go?plain=1#L62) [removing a required request property](../checker/check_request_property_updated_test.go?plain=1#L94) [removing a required write-only property that was required in response body is detected](../checker/check_response_required_property_updated_test.go?plain=1#L83) -[removing a security scope from an API endpoint security](../checker/check_api_security_updated_test.go?plain=1#L134) -[removing a security scope from an API global security](../checker/check_api_security_updated_test.go?plain=1#L50) +[removing a security scope from an API endpoint security: api-security-scope-removed](../checker/check_api_security_updated_test.go?plain=1#L134) +[removing a security scope from an API global security: api-global-security-scope-removed](../checker/check_api_security_updated_test.go?plain=1#L50) [removing an enum value from a response property](../checker/check_response_property_enum_value_removed_test.go?plain=1#L12) [removing an enum value from a response write-only property](../checker/check_response_property_enum_value_removed_test.go?plain=1#L36) [removing an enum value from request parameter](../checker/check_request_parameter_enum_value_updated_test.go?plain=1#L12) [removing an existent property that was required in response body is detected](../checker/check_response_required_property_updated_test.go?plain=1#L35) -[removing an existing operation id](../checker/check_api_operation_id_updated_test.go?plain=1#L12) -[removing an existing tag](../checker/check_api_tag_updated_test.go?plain=1#L37) +[removing an existing operation id: api-operation-id-removed](../checker/check_api_operation_id_updated_test.go?plain=1#L12) +[removing an existing tag: api-tag-removed](../checker/check_api_tag_updated_test.go?plain=1#L37) [removing an optional write-only property from a response](../checker/check_response_optional_property_updated_test.go?plain=1#L12) [removing discriminator from the request body or request body property](../checker/check_request_discriminator_updated_test.go?plain=1#L46) [removing discriminator from the response body or response property](../checker/check_response_discriminator_updated_test.go?plain=1#L47) [removing media type from request body](../checker/check_request_body_mediatype_updated_test.go?plain=1#L34) -[removing pattern from request parameters](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L84) +[removing pattern from request parameters: request-parameter-pattern-removed](../checker/check_request_parameter_pattern_added_or_changed_test.go?plain=1#L84) [removing request body default value or request property default value](../checker/check_request_property_default_value_changed_test.go?plain=1#L91) [removing request parameter default value](../checker/check_request_parameters_default_value_changed_test.go?plain=1#L58) [removing request property enum values](../checker/check_request_property_enum_value_updated_test.go?plain=1#L12) -[removing request property pattern](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L86) +[removing request property pattern: request-property-pattern-removed](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L86) [removing request read-only property enum values](../checker/check_request_property_enum_value_updated_test.go?plain=1#L39) [removing response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L108) [removing response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L62) @@ -347,5 +348,5 @@ These examples are automatically generated from unit tests. [setting maxLength of request body](../checker/check_request_property_max_length_set_test.go?plain=1#L12) [setting maxLength of request parameters](../checker/check_request_parameters_max_length_set_test.go?plain=1#L12) [setting maxLength of request propreties](../checker/check_request_property_max_length_set_test.go?plain=1#L35) -[updating an existing operation id](../checker/check_api_operation_id_updated_test.go?plain=1#L36) -[updating an existing tag](../checker/check_api_tag_updated_test.go?plain=1#L64) +[updating an existing operation id: api-operation-id-removed](../checker/check_api_operation_id_updated_test.go?plain=1#L38) +[updating an existing tag: api-tag-removed, api-tag-added](../checker/check_api_tag_updated_test.go?plain=1#L64) diff --git a/scripts/get_tested_ids.sh b/scripts/get_tested_ids.sh new file mode 100755 index 00000000..0b5d1041 --- /dev/null +++ b/scripts/get_tested_ids.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if [[ $1 == "-v" ]]; then + echo "Test IDs with line numbers:" + grep -nRE --exclude-dir=localizations,localizations_src "// (CL|BC): .*: .*-.*" checker/* | cut -d":" -f1,2,5 +else + cmd='grep -nRE --exclude-dir=localizations,localizations_src "// (CL|BC): .*: .*-.*" checker/* | cut -d":" -f5 | tr , '\n' | sort -u' + cmd_with_wc=$cmd"|wc -l|xargs echo" + count=$(eval "$cmd_with_wc") + echo "Unique test IDs ("$count"):" + eval "$cmd" +fi From 8f74710a24adf9ec67167c9317153488c8c0bc63 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 22:07:25 +0300 Subject: [PATCH 11/26] add test id to test comments --- checker/check_breaking_property_test.go | 70 +++++--- ...heck_breaking_request_type_changed_test.go | 10 +- ...eck_breaking_response_type_changed_test.go | 10 +- checker/check_breaking_test.go | 56 +++--- .../check_components_security_updated_test.go | 16 +- ...request_non_path_default_parameter_test.go | 2 +- ...eck_new_request_non_path_parameter_test.go | 2 +- .../check_request_property_updated_test.go | 4 +- checker/checker_test.go | 2 +- checker/localizations/localizations.go | 131 +++++++------- checker/localizations_src/en/messages.yaml | 3 +- docs/BREAKING-CHANGES-EXAMPLES.md | 166 +++++++++--------- scripts/get_tested_ids.sh | 7 +- 13 files changed, 244 insertions(+), 235 deletions(-) diff --git a/checker/check_breaking_property_test.go b/checker/check_breaking_property_test.go index 445156ea..859aeac6 100644 --- a/checker/check_breaking_property_test.go +++ b/checker/check_breaking_property_test.go @@ -15,7 +15,7 @@ func getReqPropFile(file string) string { return fmt.Sprintf("../data/required-properties/%s", file) } -// BC: new required property in request header is breaking +// BC: new required property in request header is breaking: new-required-request-header-property func TestBreaking_NewRequiredProperty(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -55,7 +55,7 @@ func TestBreaking_NewNonRequiredProperty(t *testing.T) { require.Empty(t, errs) } -// BC: changing an existing property in request header to required is breaking +// BC: changing an existing property in request header to required is breaking: request-header-property-became-required func TestBreaking_PropertyRequiredEnabled(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -106,7 +106,7 @@ func TestBreaking_PropertyRequiredDisabled(t *testing.T) { require.Empty(t, errs) } -// BC: changing an existing property in response body to optional is breaking +// BC: changing an existing property in response body to optional is breaking: response-property-became-optional func TestBreaking_RespBodyRequiredPropertyDisabled(t *testing.T) { s1, err := open(getReqPropFile("response-base.json")) require.NoError(t, err) @@ -123,7 +123,7 @@ func TestBreaking_RespBodyRequiredPropertyDisabled(t *testing.T) { require.Equal(t, "property 'helpAndSupport/title' became optional for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing a request body to enum is breaking +// BC: changing a request body to enum is breaking: request-body-became-enum func TestBreaking_ReqBodyBecameEnum(t *testing.T) { s1, err := open("../data/enums/request-body-no-enum.yaml") require.NoError(t, err) @@ -154,7 +154,7 @@ func TestBreaking_ReqBodyEnumValueAdded(t *testing.T) { require.Empty(t, errs) } -// BC: changing a request body type and changing it to enum simultaneously is breaking +// BC: changing a request body type and changing it to enum simultaneously is breaking: request-body-became-enum, request-body-type-changed func TestBreaking_ReqBodyBecameEnumAndTypeChanged(t *testing.T) { s1, err := open("../data/enums/request-body-no-enum.yaml") require.NoError(t, err) @@ -174,7 +174,7 @@ func TestBreaking_ReqBodyBecameEnumAndTypeChanged(t *testing.T) { require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'string'/'' to 'int'/''", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an existing property in request body to enum is breaking +// BC: changing an existing property in request body to enum is breaking: request-property-became-enum func TestBreaking_ReqPropertyBecameEnum(t *testing.T) { s1, err := open("../data/enums/request-property-no-enum.yaml") require.NoError(t, err) @@ -191,7 +191,7 @@ func TestBreaking_ReqPropertyBecameEnum(t *testing.T) { require.Equal(t, "request property 'name' of media-type 'application/json' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an existing path param to enum is breaking +// BC: changing an existing path param to enum is breaking: request-parameter-became-enum func TestBreaking_ReqParameterBecameEnum(t *testing.T) { s1, err := open("../data/enums/request-parameter-op-no-enum.yaml") require.NoError(t, err) @@ -208,7 +208,7 @@ func TestBreaking_ReqParameterBecameEnum(t *testing.T) { require.Equal(t, "'path' request parameter 'bookId' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an existing property in request header to enum is breaking +// BC: changing an existing property in request header to enum is breaking: request-header-property-became-enum func TestBreaking_ReqParameterHeaderPropertyBecameEnum(t *testing.T) { s1, err := open("../data/enums/request-parameter-property-no-enum.yaml") require.NoError(t, err) @@ -225,7 +225,7 @@ func TestBreaking_ReqParameterHeaderPropertyBecameEnum(t *testing.T) { require.Equal(t, "property 'name' of request header 'bookId' was restricted to a list of enum values", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing a response body to nullable is breaking +// BC: changing a response body to nullable is breaking: response-body-became-nullable func TestBreaking_RespBodyNullable(t *testing.T) { s1, err := open("../data/nullable/base-body.yaml") require.NoError(t, err) @@ -242,7 +242,7 @@ func TestBreaking_RespBodyNullable(t *testing.T) { require.Equal(t, "response body became nullable", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing a request property to not nullable is breaking +// BC: changing a request property to not nullable is breaking: request-property-became-not-nullable func TestBreaking_ReqBodyPropertyNotNullable(t *testing.T) { s1, err := open("../data/nullable/base-req.yaml") require.NoError(t, err) @@ -256,9 +256,10 @@ func TestBreaking_ReqBodyPropertyNotNullable(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyBecomeNotNullableId, errs[0].GetId()) + require.Equal(t, "request property 'id' of media-type 'application/json' became not nullable", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing a response property to nullable is breaking +// BC: changing a response property to nullable is breaking: response-property-became-nullable func TestBreaking_RespBodyPropertyNullable(t *testing.T) { s1, err := open("../data/nullable/base-property.yaml") require.NoError(t, err) @@ -272,9 +273,10 @@ func TestBreaking_RespBodyPropertyNullable(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponsePropertyBecameNullableId, errs[0].GetId()) + require.Equal(t, "property 'name' became nullable for response status '201'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an embedded response property to nullable is breaking +// BC: changing an embedded response property to nullable is breaking: response-property-became-nullable func TestBreaking_RespBodyEmbeddedPropertyNullable(t *testing.T) { s1, err := open("../data/nullable/base-embedded-property.yaml") require.NoError(t, err) @@ -288,9 +290,10 @@ func TestBreaking_RespBodyEmbeddedPropertyNullable(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.ResponsePropertyBecameNullableId, errs[0].GetId()) + require.Equal(t, "property 'name/name' became nullable for response status '201'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing a required property in response body to optional and also deleting it is breaking +// BC: changing a required property in response body to optional and also deleting it is breaking: response-required-property-removed func TestBreaking_RespBodyDeleteAndDisableRequiredProperty(t *testing.T) { s1, err := open(getReqPropFile("response-del-required-prop-base.yaml")) require.NoError(t, err) @@ -301,7 +304,9 @@ func TestBreaking_RespBodyDeleteAndDisableRequiredProperty(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) - require.NotEmpty(t, errs) + require.Len(t, errs, 1) + require.Equal(t, checker.ResponseRequiredPropertyRemovedId, errs[0].GetId()) + require.Equal(t, "removed required property 'name' from response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: adding a non-existent required property in request body is not breaking @@ -346,7 +351,7 @@ func TestBreaking_ReqBodyRequiredPropertyDisabled(t *testing.T) { require.Empty(t, errs) } -// BC: changing an existing property in request body to required is breaking +// BC: changing an existing property in request body to required is breaking: request-property-became-required func TestBreaking_ReqBodyRequiredPropertyEnabled(t *testing.T) { s1, err := open(getReqPropFile("request-revision.yaml")) require.NoError(t, err) @@ -360,9 +365,10 @@ func TestBreaking_ReqBodyRequiredPropertyEnabled(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyBecameRequiredId, errs[0].GetId()) + require.Equal(t, "request property 'email' of media-type 'application/json' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: adding a new required property in request body is breaking +// BC: adding a new required property in request body is breaking: new-required-request-property func TestBreaking_ReqBodyNewRequiredProperty(t *testing.T) { s1, err := open(getReqPropFile("request-new-base.yaml")) require.NoError(t, err) @@ -376,9 +382,10 @@ func TestBreaking_ReqBodyNewRequiredProperty(t *testing.T) { require.NotEmpty(t, errs) require.Len(t, errs, 1) require.Equal(t, checker.NewRequiredRequestPropertyId, errs[0].GetId()) + require.Equal(t, "added required request property 'email' to media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: deleting a required property in request is breaking with warn +// BC: deleting a required property in request is breaking with warn: request-property-removed func TestBreaking_ReqBodyDeleteRequiredProperty(t *testing.T) { s1, err := open(getReqPropFile("request-new-revision.yaml")) require.NoError(t, err) @@ -393,9 +400,10 @@ func TestBreaking_ReqBodyDeleteRequiredProperty(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.RequestPropertyRemovedId, errs[0].GetId()) require.Equal(t, checker.WARN, errs[0].GetLevel()) + require.Equal(t, "removed request property 'email' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: deleting an embedded optional property in request is breaking with warn +// BC: deleting an embedded optional property in request is breaking with warn: request-property-removed func TestBreaking_ReqBodyDeleteRequiredProperty2(t *testing.T) { s1, err := open(getReqPropFile("request-property-items.yaml")) require.NoError(t, err) @@ -431,7 +439,7 @@ func TestBreaking_RespBodyNewRequiredProperty(t *testing.T) { require.Empty(t, errs) } -// BC: deleting a required property in response body is breaking +// BC: deleting a required property in response body is breaking: response-required-property-removed func TestBreaking_RespBodyDeleteRequiredProperty(t *testing.T) { s1, err := open(getReqPropFile("response-new-revision.json")) require.NoError(t, err) @@ -462,7 +470,7 @@ func TestBreaking_RespBodyNewAllOfRequiredProperty(t *testing.T) { require.Empty(t, errs) } -// BC: deleting a required property under AllOf in response body is breaking +// BC: deleting a required property under AllOf in response body is breaking: response-required-property-removed func TestBreaking_RespBodyDeleteAllOfRequiredProperty(t *testing.T) { s1, err := open(getReqPropFile("response-allof-revision.json")) require.NoError(t, err) @@ -507,7 +515,7 @@ func TestBreaking_ReadOnlyPropertyRequiredEnabled(t *testing.T) { require.Empty(t, errs) } -// BC: deleting a required write-only property in response body is not breaking +// BC: deleting a required write-only property in response body is not breaking: request-property-removed func TestBreaking_WriteOnlyDeleteRequiredProperty(t *testing.T) { s1, err := open(getReqPropFile("write-only-delete-base.yaml")) require.NoError(t, err) @@ -525,7 +533,7 @@ func TestBreaking_WriteOnlyDeleteRequiredProperty(t *testing.T) { require.Equal(t, "removed request property 'test' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: deleting a non-required non-write-only property in response body is breaking with warning +// BC: deleting a non-required non-write-only property in response body is breaking with warning: request-property-removed, response-optional-property-removed func TestBreaking_WriteOnlyDeleteNonRequiredProperty(t *testing.T) { s1, err := open(getReqPropFile("write-only-delete-partial-base.yaml")) require.NoError(t, err) @@ -583,7 +591,7 @@ func TestBreaking_RequiredPropertyWriteOnlyEnabled(t *testing.T) { require.Empty(t, errs) } -// BC: changing an existing required property in response body to not-write-only is breaking +// BC: changing an existing required property in response body to not-write-only is breaking: response-required-property-became-not-write-only func TestBreaking_RequiredPropertyWriteOnlyDisabled(t *testing.T) { s1, err := open(getReqPropFile("write-only-changed-revision.yaml")) require.NoError(t, err) @@ -608,7 +616,7 @@ func TestBreaking_RequiredPropertyWriteOnlyDisabled(t *testing.T) { require.Equal(t, "response required property 'test' became not write-only for status '200'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an existing property in request body to required is breaking +// BC: changing an existing property in request body to required is breaking: request-property-became-required func TestBreaking_Body(t *testing.T) { s1, err := open(getReqPropFile("body1.yaml")) require.NoError(t, err) @@ -626,7 +634,7 @@ func TestBreaking_Body(t *testing.T) { require.Equal(t, "request property 'id' of media-type 'application/json' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an existing property in request body items to required is breaking +// BC: changing an existing property in request body items to required is breaking: request-property-became-required func TestBreaking_Items(t *testing.T) { s1, err := open(getReqPropFile("items1.yaml")) require.NoError(t, err) @@ -658,7 +666,7 @@ func TestBreaking_ItemsWithDefault(t *testing.T) { require.Empty(t, errs) } -// BC: changing an existing property in request body anyOf to required is breaking +// BC: changing an existing property in request body anyOf to required is breaking: request-property-became-required func TestBreaking_AnyOf(t *testing.T) { s1, err := open(getReqPropFile("anyOf1.yaml")) require.NoError(t, err) @@ -675,7 +683,7 @@ func TestBreaking_AnyOf(t *testing.T) { require.Equal(t, "request property '/anyOf[subschema #1]/id' of media-type 'application/json' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an existing property under another property in request body to required is breaking +// BC: changing an existing property under another property in request body to required is breaking: request-property-became-required func TestBreaking_NestedProp(t *testing.T) { s1, err := open(getReqPropFile("nested-property1.yaml")) require.NoError(t, err) @@ -692,7 +700,7 @@ func TestBreaking_NestedProp(t *testing.T) { require.Equal(t, "request property 'id/userId' of media-type 'application/json' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing a response property to optional under AllOf, AnyOf or OneOf is breaking +// BC: changing a response property to optional under AllOf, AnyOf or OneOf is breaking: response-property-became-optional func TestBreaking_OneOf(t *testing.T) { s1, err := open("../data/x-of/base.json") require.NoError(t, err) @@ -704,7 +712,13 @@ func TestBreaking_OneOf(t *testing.T) { require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 3) + + require.Equal(t, checker.ResponsePropertyBecameOptionalId, errs[0].GetId()) require.Equal(t, "property '/allOf[#/components/schemas/ProblemSchema]/changedProperty' became optional for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ResponsePropertyBecameOptionalId, errs[1].GetId()) require.Equal(t, "property '/anyOf[#/components/schemas/ProblemSchema]/changedProperty' became optional for response status '200'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ResponsePropertyBecameOptionalId, errs[2].GetId()) require.Equal(t, "property '/oneOf[#/components/schemas/ProblemSchema]/changedProperty' became optional for response status '200'", errs[2].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_breaking_request_type_changed_test.go b/checker/check_breaking_request_type_changed_test.go index f7adbd96..b373498f 100644 --- a/checker/check_breaking_request_type_changed_test.go +++ b/checker/check_breaking_request_type_changed_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// BC: changing request's body schema type from string to number is breaking +// BC: changing request's body schema type from string to number is breaking: request-body-type-changed func TestBreaking_ReqTypeStringToNumber(t *testing.T) { file := "../data/type-change/simple-request.yaml" @@ -29,7 +29,7 @@ func TestBreaking_ReqTypeStringToNumber(t *testing.T) { require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'string'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing request's body schema type from number to string is breaking +// BC: changing request's body schema type from number to string is breaking: request-body-type-changed func TestBreaking_ReqTypeNumberToString(t *testing.T) { file := "../data/type-change/simple-request.yaml" @@ -49,7 +49,7 @@ func TestBreaking_ReqTypeNumberToString(t *testing.T) { require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'number'/'' to 'string'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing request's body schema type from number to integer is breaking +// BC: changing request's body schema type from number to integer is breaking: request-body-type-changed func TestBreaking_ReqTypeNumberToInteger(t *testing.T) { file := "../data/type-change/simple-request.yaml" @@ -69,7 +69,7 @@ func TestBreaking_ReqTypeNumberToInteger(t *testing.T) { require.Equal(t, "type/format of media-type 'application/json' of request body changed from 'number'/'' to 'integer'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing request's body schema type from integer to number is not breaking +// BC: changing request's body schema type from integer to number is not breaking: request-body-type-generalized func TestBreaking_ReqTypeIntegerToNumber(t *testing.T) { file := "../data/type-change/simple-request.yaml" @@ -89,7 +89,7 @@ func TestBreaking_ReqTypeIntegerToNumber(t *testing.T) { require.Equal(t, "type/format of media-type 'application/json' of request body was generalized from 'integer'/'' to 'number'/''", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing request's body schema type from number/none to integer/int32 is breaking +// BC: changing request's body schema type from number/none to integer/int32 is breaking: request-body-type-changed func TestBreaking_ReqTypeNumberToInt32(t *testing.T) { file := "../data/type-change/simple-request.yaml" diff --git a/checker/check_breaking_response_type_changed_test.go b/checker/check_breaking_response_type_changed_test.go index e9f5248a..a18b2db2 100644 --- a/checker/check_breaking_response_type_changed_test.go +++ b/checker/check_breaking_response_type_changed_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// BC: changing response's body schema type from string to number is breaking +// BC: changing response's body schema type from string to number is breaking: response-body-type-changed func TestBreaking_RespTypeStringToNumber(t *testing.T) { file := "../data/type-change/simple-response.yaml" @@ -29,7 +29,7 @@ func TestBreaking_RespTypeStringToNumber(t *testing.T) { require.Equal(t, "body type/format changed from 'string'/'' to 'number'/'' for response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing response's body schema type from number to string is breaking +// BC: changing response's body schema type from number to string is breaking: response-body-type-changed func TestBreaking_RespTypeNumberToString(t *testing.T) { file := "../data/type-change/simple-response.yaml" @@ -67,7 +67,7 @@ func TestBreaking_RespTypeNumberToInteger(t *testing.T) { require.Empty(t, errs) } -// BC: changing response's body schema type from integer to number is breaking +// BC: changing response's body schema type from integer to number is breaking: response-body-type-changed func TestBreaking_RespTypeIntegerToNumber(t *testing.T) { file := "../data/type-change/simple-response.yaml" @@ -106,7 +106,7 @@ func TestBreaking_RespTypeNumberToInt32(t *testing.T) { require.Empty(t, errs) } -// BC: changing response's embedded property schema type from string/none to integer/int32 is breaking +// BC: changing response's embedded property schema type from string/none to integer/int32 is breaking: response-property-type-changed func TestBreaking_RespTypeChanged(t *testing.T) { s1, err := open("../data/type-change/base-response.yaml") require.NoError(t, err) @@ -118,6 +118,6 @@ func TestBreaking_RespTypeChanged(t *testing.T) { require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) - require.Equal(t, "response-property-type-changed", errs[0].GetId()) + require.Equal(t, checker.ResponsePropertyTypeChangedId, errs[0].GetId()) require.Equal(t, "'/items/testField' response property type/format changed from 'string'/'' to 'integer'/'int32' for status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_breaking_test.go b/checker/check_breaking_test.go index 95f32331..e7fe25cf 100644 --- a/checker/check_breaking_test.go +++ b/checker/check_breaking_test.go @@ -34,7 +34,7 @@ func d(t *testing.T, config *diff.Config, v1, v2 int) checker.Changes { return errs } -// BC: deleting a path is breaking +// BC: deleting a path is breaking: api-path-removed-without-deprecation func TestBreaking_DeletedPath(t *testing.T) { errs := d(t, diff.NewConfig(), 1, 701) require.Len(t, errs, 1) @@ -42,7 +42,7 @@ func TestBreaking_DeletedPath(t *testing.T) { require.Equal(t, "api path removed without deprecation", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: deleting an operation is breaking +// BC: deleting an operation is breaking: api-removed-without-deprecation: api-removed-without-deprecation func TestBreaking_DeletedOp(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -58,7 +58,7 @@ func TestBreaking_DeletedOp(t *testing.T) { require.Equal(t, "api removed without deprecation", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: adding a required request body is breaking +// BC: adding a required request body is breaking: request-body-added-required func TestBreaking_AddingRequiredRequestBody(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -76,7 +76,7 @@ func TestBreaking_AddingRequiredRequestBody(t *testing.T) { require.Equal(t, "added required request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an existing request body from optional to required is breaking +// BC: changing an existing request body from optional to required is breaking: request-body-became-required func TestBreaking_RequestBodyRequiredEnabled(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -98,7 +98,7 @@ func TestBreaking_RequestBodyRequiredEnabled(t *testing.T) { require.Equal(t, "request body became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: deleting an enum value is breaking +// BC: deleting an enum value is breaking: request-parameter-enum-value-removed func TestBreaking_DeletedEnum(t *testing.T) { errs := d(t, diff.NewConfig(), 702, 1) require.NotEmpty(t, errs) @@ -107,7 +107,7 @@ func TestBreaking_DeletedEnum(t *testing.T) { require.Equal(t, "removed enum value 'removed-value' from the 'path' request parameter 'domain'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: added an enum value to response breaking +// BC: added an enum value to response breaking: response-property-enum-value-added func TestBreaking_AddedResponseEnum(t *testing.T) { errs := d(t, diff.NewConfig(), 703, 704) require.NotEmpty(t, errs) @@ -153,7 +153,7 @@ func TestBreaking_PathParamRename(t *testing.T) { require.Empty(t, errs) } -// BC: new required path param is breaking +// BC: new required path param is breaking: new-request-path-parameter func TestBreaking_NewPathParam(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -170,7 +170,7 @@ func TestBreaking_NewPathParam(t *testing.T) { require.Equal(t, "added path request parameter 'project'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: new required header param is breaking +// BC: new required header param is breaking: new-required-request-parameter func TestBreaking_NewRequiredHeaderParam(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -187,7 +187,7 @@ func TestBreaking_NewRequiredHeaderParam(t *testing.T) { require.Equal(t, "added required 'header' request parameter 'network-policies'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an existing header param from optional to required is breaking +// BC: changing an existing header param from optional to required is breaking: request-parameter-became-required func TestBreaking_HeaderParamRequiredEnabled(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -211,7 +211,7 @@ func TestBreaking_HeaderParamRequiredEnabled(t *testing.T) { require.Equal(t, "'header' request parameter 'network-policies' became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: changing an existing response header from required to optional is breaking +// BC: changing an existing response header from required to optional is breaking: response-header-became-optional func TestBreaking_ResponseHeaderParamRequiredDisabled(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -228,7 +228,7 @@ func TestBreaking_ResponseHeaderParamRequiredDisabled(t *testing.T) { require.Equal(t, "header 'X-RateLimit-Limit' became optional for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing an existing required response header is breaking as error +// BC: removing an existing required response header is breaking as error: required-response-header-removed func TestBreaking_ResponseHeaderRemoved(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -248,7 +248,7 @@ func TestBreaking_ResponseHeaderRemoved(t *testing.T) { require.Equal(t, "removed mandatory header 'X-RateLimit-Limit' for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing an existing response with successful status is breaking +// BC: removing an existing response with successful status is breaking: response-success-status-removed func TestBreaking_ResponseSuccessStatusUpdated(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -267,7 +267,7 @@ func TestBreaking_ResponseSuccessStatusUpdated(t *testing.T) { require.Equal(t, "removed success response status '200'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing an existing response with non-successful status is breaking (optional) +// BC: removing an existing response with non-successful status is breaking (optional): response-non-success-status-removed func TestBreaking_ResponseNonSuccessStatusUpdated(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -286,7 +286,7 @@ func TestBreaking_ResponseNonSuccessStatusUpdated(t *testing.T) { require.Equal(t, "removed non-success response status '400'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing/updating an operation id is breaking (optional) +// BC: removing/updating an operation id is breaking (optional): api-operation-id-removed func TestBreaking_OperationIdRemoved(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -307,7 +307,7 @@ func TestBreaking_OperationIdRemoved(t *testing.T) { verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.APIOperationIdRemovedId) } -// BC: removing/updating an enum in request body is breaking (optional) +// BC: removing/updating an enum in request body is breaking (optional): request-body-enum-value-removed func TestBreaking_RequestBodyEnumRemoved(t *testing.T) { s1, err := open("../data/enums/request-body-enum.yaml") require.NoError(t, err) @@ -330,7 +330,7 @@ func TestBreaking_RequestBodyEnumRemoved(t *testing.T) { require.Equal(t, "enum value 'VALUE_1' removed from media-type 'application/json' of request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing/updating a property enum in response is breaking (optional) +// BC: removing/updating a property enum in response is breaking (optional): response-property-enum-value-removed func TestBreaking_ResponsePropertyEnumRemoved(t *testing.T) { s1 := l(t, 704) s2 := l(t, 703) @@ -348,7 +348,7 @@ func TestBreaking_ResponsePropertyEnumRemoved(t *testing.T) { require.Equal(t, "removed 'QWE' enum value from 'respenum' response property for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing/updating a tag is breaking (optional) +// BC: removing/updating a tag is breaking (optional): api-tag-removed func TestBreaking_TagRemoved(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -367,7 +367,7 @@ func TestBreaking_TagRemoved(t *testing.T) { require.Equal(t, "removed api tag 'security'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing/updating a media type enum in response (optional) +// BC: removing/updating a media type enum in response (optional): response-mediatype-enum-value-removed func TestBreaking_ResponseMediaTypeEnumRemoved(t *testing.T) { s1, err := open("../data/enums/response-enum.yaml") require.NoError(t, err) @@ -419,7 +419,7 @@ func TestBreaking_ResponseErrorStatusRemoved(t *testing.T) { require.Empty(t, errs) } -// BC: removing an existing optional response header is breaking as warn +// BC: removing an existing optional response header is breaking as warn: optional-response-header-removed func TestBreaking_OptionalResponseHeaderRemoved(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -439,7 +439,7 @@ func TestBreaking_OptionalResponseHeaderRemoved(t *testing.T) { require.Equal(t, "removed optional header 'X-RateLimit-Limit' for response status 'default'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: deleting a media-type from response is breaking +// BC: deleting a media-type from response is breaking: response-media-type-removed func TestBreaking_ResponseDeleteMediaType(t *testing.T) { s1, err := open("../data/response-media-type-base.yaml") require.NoError(t, err) @@ -470,7 +470,7 @@ func TestBreaking_DeletePatten(t *testing.T) { require.Empty(t, errs) } -// BC: adding a pattern to a schema is breaking +// BC: adding a pattern to a schema is breaking: request-property-pattern-added func TestBreaking_AddPattern(t *testing.T) { s1, err := open("../data/pattern-revision.yaml") require.NoError(t, err) @@ -487,7 +487,7 @@ func TestBreaking_AddPattern(t *testing.T) { require.Equal(t, "added pattern '^[a-z]+$' to the request property 'created' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: adding a pattern to a schema is breaking for recursive properties +// BC: adding a pattern to a schema is breaking for recursive properties: request-property-pattern-added func TestBreaking_AddPatternRecursive(t *testing.T) { s1, err := open("../data/pattern-revision-recursive.yaml") require.NoError(t, err) @@ -504,7 +504,7 @@ func TestBreaking_AddPatternRecursive(t *testing.T) { require.Equal(t, "added pattern '^[a-z]+$' to the request property 'data/created' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: modifying a pattern in a schema is breaking +// BC: modifying a pattern in a schema is breaking: request-property-pattern-changed func TestBreaking_ModifyPattern(t *testing.T) { s1, err := open("../data/pattern-base.yaml") require.NoError(t, err) @@ -567,7 +567,7 @@ func TestBreaking_ModifyPatternToAnyString(t *testing.T) { require.Empty(t, errs) } -// BC: modifying the default value of an optional request parameter is breaking +// BC: modifying the default value of an optional request parameter is breaking: request-parameter-default-value-changed func TestBreaking_ModifyRequiredOptionalParamDefaultValue(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -585,7 +585,7 @@ func TestBreaking_ModifyRequiredOptionalParamDefaultValue(t *testing.T) { require.Equal(t, "for 'header' request parameter 'network-policies', default value was changed from 'X' to 'Y'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: setting the default value of an optional request parameter is breaking +// BC: setting the default value of an optional request parameter is breaking: request-parameter-default-value-added func TestBreaking_SettingOptionalParamDefaultValue(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -603,7 +603,7 @@ func TestBreaking_SettingOptionalParamDefaultValue(t *testing.T) { require.Equal(t, "for 'header' request parameter 'network-policies', default value 'Y' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// BC: removing the default value of an optional request parameter is breaking +// BC: removing the default value of an optional request parameter is breaking: request-parameter-default-value-removed func TestBreaking_RemovingOptionalParamDefaultValue(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -617,7 +617,7 @@ func TestBreaking_RemovingOptionalParamDefaultValue(t *testing.T) { require.NoError(t, err) errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm) require.Len(t, errs, 1) - require.Equal(t, "request-parameter-default-value-removed", errs[0].GetId()) + require.Equal(t, checker.RequestParameterDefaultValueRemovedId, errs[0].GetId()) require.Equal(t, "for 'header' request parameter 'network-policies', default value 'Y' was removed", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } @@ -640,7 +640,7 @@ func TestBreaking_ModifyRequiredRequiredParamDefaultValue(t *testing.T) { require.Empty(t, errs) } -// BC: removing an schema object from components is breaking (optional) +// BC: removing an schema object from components is breaking (optional): api-schema-removed func TestBreaking_SchemaRemoved(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) diff --git a/checker/check_components_security_updated_test.go b/checker/check_components_security_updated_test.go index 4d5e85ee..4a0d1b37 100644 --- a/checker/check_components_security_updated_test.go +++ b/checker/check_components_security_updated_test.go @@ -8,7 +8,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// CL: changing security component oauth's url +// CL: changing security component oauth's url: api-security-component-oauth-url-changed func TestComponentSecurityOauthURLUpdated(t *testing.T) { s1, err := open("../data/checker/component_security_updated_base.yaml") require.NoError(t, err) @@ -30,7 +30,7 @@ func TestComponentSecurityOauthURLUpdated(t *testing.T) { require.Equal(t, "component security scheme 'petstore_auth' oauth url changed from 'http://example.org/api/oauth/dialog' to 'http://example.new.org/api/oauth/dialog'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: changing security component token url +// CL: changing security component token url: api-security-component-oauth-token-url-changed func TestComponentSecurityOauthTokenUpdated(t *testing.T) { s1, err := open("../data/checker/component_security_updated_base.yaml") require.NoError(t, err) @@ -52,7 +52,7 @@ func TestComponentSecurityOauthTokenUpdated(t *testing.T) { require.Equal(t, "component security scheme 'petstore_auth' oauth token url changed from '' to 'http://example.new.org/api/oauth/dialog'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: changing security component type +// CL: changing security component type: api-security-component-type-changed func TestComponentSecurityTypeUpdated(t *testing.T) { s1, err := open("../data/checker/component_security_updated_base.yaml") require.NoError(t, err) @@ -74,7 +74,7 @@ func TestComponentSecurityTypeUpdated(t *testing.T) { require.Equal(t, "component security scheme 'petstore_auth' type changed from 'oauth2' to 'http'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding a new security component +// CL: adding a new security component: api-security-component-added func TestComponentSecurityAdded(t *testing.T) { s1, err := open("../data/checker/component_security_updated_base.yaml") require.NoError(t, err) @@ -94,7 +94,7 @@ func TestComponentSecurityAdded(t *testing.T) { require.Equal(t, "component security scheme 'BasicAuth' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing a new security component +// CL: removing a new security component: api-security-component-removed func TestComponentSecurityRemoved(t *testing.T) { s1, err := open("../data/checker/component_security_updated_revision.yaml") require.NoError(t, err) @@ -114,7 +114,7 @@ func TestComponentSecurityRemoved(t *testing.T) { require.Equal(t, "removed component security scheme 'BasicAuth'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding a new oauth security scope +// CL: adding a new oauth security scope: api-security-component-oauth-scope-added func TestComponentSecurityOauthScopeAdded(t *testing.T) { s1, err := open("../data/checker/component_security_updated_base.yaml") require.NoError(t, err) @@ -136,7 +136,7 @@ func TestComponentSecurityOauthScopeAdded(t *testing.T) { require.Equal(t, "component security scheme 'petstore_auth' oauth scope 'admin:pets' was added", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing a new oauth security scope +// CL: removing a new oauth security scope: api-security-component-oauth-scope-removed func TestComponentSecurityOauthScopeRemoved(t *testing.T) { s1, err := open("../data/checker/component_security_updated_base.yaml") require.NoError(t, err) @@ -159,7 +159,7 @@ func TestComponentSecurityOauthScopeRemoved(t *testing.T) { require.Equal(t, "removed component security scheme 'petstore_auth' oauth scope 'admin:pets'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing a new oauth security scope +// CL: removing a new oauth security scope: api-security-component-oauth-scope-changed func TestComponentSecurityOauthScopeUpdated(t *testing.T) { s1, err := open("../data/checker/component_security_updated_base.yaml") require.NoError(t, err) diff --git a/checker/check_new_request_non_path_default_parameter_test.go b/checker/check_new_request_non_path_default_parameter_test.go index ebae2b39..46968c51 100644 --- a/checker/check_new_request_non_path_default_parameter_test.go +++ b/checker/check_new_request_non_path_default_parameter_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/load" ) -// BC: new header, query and cookie required request default param is breaking +// BC: new header, query and cookie required request default param is breaking: new-required-request-default-parameter-to-existing-path, new-optional-request-default-parameter-to-existing-path func TestNewRequestNonPathParameter_DetectsNewRequiredPathsAndNewOperations(t *testing.T) { s1, err := open("../data/request_params/base.yaml") require.NoError(t, err) diff --git a/checker/check_new_request_non_path_parameter_test.go b/checker/check_new_request_non_path_parameter_test.go index 1731b3bb..dc86f04b 100644 --- a/checker/check_new_request_non_path_parameter_test.go +++ b/checker/check_new_request_non_path_parameter_test.go @@ -8,7 +8,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// CL: new header, query and cookie request params +// CL: new header, query and cookie request params: new-optional-request-parameter func TestNewRequestNonPathParameter_DetectsNewPathsAndNewOperations(t *testing.T) { s1, err := open("../data/request_params/base.yaml") require.NoError(t, err) diff --git a/checker/check_request_property_updated_test.go b/checker/check_request_property_updated_test.go index 21609bb5..42ff42c4 100644 --- a/checker/check_request_property_updated_test.go +++ b/checker/check_request_property_updated_test.go @@ -32,7 +32,7 @@ func TestRequiredRequestPropertyAdded(t *testing.T) { require.Equal(t, "added required request property 'description' to media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding two new request properties, one required, one optional +// CL: adding two new request properties, one required, one optional: new-required-request-property, new-optional-request-property func TestRequiredRequestPropertiesAdded(t *testing.T) { s1, err := open("../data/checker/request_property_added_base.yaml") require.NoError(t, err) @@ -114,7 +114,7 @@ func TestRequiredRequestPropertyRemoved(t *testing.T) { require.Equal(t, "removed request property 'description' of media-type 'application/json'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: adding a new required request property with a default value +// CL: adding a new required request property with a default value: new-required-request-property-with-default func TestRequiredRequestPropertyAddedWithDefault(t *testing.T) { s1, err := open("../data/checker/request_property_added_base.yaml") require.NoError(t, err) diff --git a/checker/checker_test.go b/checker/checker_test.go index 6bad706e..07eed368 100644 --- a/checker/checker_test.go +++ b/checker/checker_test.go @@ -8,7 +8,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -// BC: decreasing stability level is breaking +// BC: decreasing stability level is breaking: api-stability-decreased func TestBreaking_StabilityLevelDecreased(t *testing.T) { s1, err := open(getDeprecationFile("base-beta-stability.yaml")) diff --git a/checker/localizations/localizations.go b/checker/localizations/localizations.go index 92ae1fc3..ea8bbd34 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 -// 2024-08-29 12:31:51.84397 +0300 IDT m=+0.004795626 +// 2024-08-29 17:33:13.914404 +0300 IDT m=+0.005655876 package localizations @@ -12,71 +12,70 @@ import ( ) var localizations = map[string]string{ - "en.messages.api-deprecated-sunset-missing": "sunset date is missing for deprecated API", - "en.messages.api-deprecated-sunset-missing-description": "endpoint deprecated without sunset date", - "en.messages.api-deprecated-sunset-parse": "failed to parse sunset date: %v", - "en.messages.api-deprecated-sunset-parse-description": "endpoint deprecated with invalid sunset date", - "en.messages.api-global-security-added": "security scheme %s was added", - "en.messages.api-global-security-added-description": "security scheme added in security", - "en.messages.api-global-security-removed": "removed security scheme %s", - "en.messages.api-global-security-removed-description": "security scheme deleted in security", - "en.messages.api-global-security-scope-added": "security scope %s was added to global security scheme %s", - "en.messages.api-global-security-scope-added-description": "scope added to a security scheme in security", - "en.messages.api-global-security-scope-removed": "removed security scope %s from global security scheme %s", - "en.messages.api-global-security-scope-removed-description": "scope deleted from a security scheme in security", - "en.messages.api-invalid-stability-level": "failed to parse stability level: %v", - "en.messages.api-invalid-stability-level-description": "invalid stability level", - "en.messages.api-operation-id-added": "api operation id %s was added", - "en.messages.api-operation-id-added-description": "operation ID added to an endpoint", - "en.messages.api-operation-id-removed": "api operation id %s removed and replaced with %s", - "en.messages.api-operation-id-removed-description": "operation ID deleted from an endpoint", - "en.messages.api-path-removed-before-sunset": "api path removed before the sunset date %s", - "en.messages.api-path-removed-before-sunset-description": "path and endpoint deleted before sunset date", - "en.messages.api-path-removed-without-deprecation": "api path removed without deprecation", - "en.messages.api-path-removed-without-deprecation-description": "path and endpoint deleted without deprecation", - "en.messages.api-path-sunset-parse": "failed to parse sunset date: %v", - "en.messages.api-path-sunset-parse-description": "path and endpoint deleted with invalid or missing sunset date", - "en.messages.api-removed-before-sunset": "api removed before the sunset date %s", - "en.messages.api-removed-before-sunset-description": "endpoint deleted before sunset date", - "en.messages.api-removed-without-deprecation": "api removed without deprecation", - "en.messages.api-removed-without-deprecation-description": "endpoint deleted without deprecation", - "en.messages.api-schema-removed": "removed schema %s", - "en.messages.api-schema-removed-description": "schema deleted from components/schemas", - "en.messages.api-security-added": "endpoint scheme security %s was added", - "en.messages.api-security-added-description": "security requirements added to endpoint", - "en.messages.api-security-component-added": "component security scheme %s was added", - "en.messages.api-security-component-added-description": "security scheme added in components/securitySchemes", - "en.messages.api-security-component-oauth-scope-added": "component security scheme %s oauth scope %s was added", - "en.messages.api-security-component-oauth-scope-added-description": "scope added to OAuth flow in components/securitySchemes", - "en.messages.api-security-component-oauth-scope-changed": "component security scheme %s oauth scope %s was updated from %s to %s", - "en.messages.api-security-component-oauth-scope-changed-description": "scope modified in OAuth flow in components/securitySchemes", - "en.messages.api-security-component-oauth-scope-removed": "removed component security scheme %s oauth scope %s", - "en.messages.api-security-component-oauth-scope-removed-description": "scope deleted from OAuth flow in components/securitySchemes", - "en.messages.api-security-component-oauth-token-url-changed": "component security scheme %s oauth token url changed from %s to %s", - "en.messages.api-security-component-oauth-token-url-changed-description": "token URL modified in OAuth flow in components/securitySchemes", - "en.messages.api-security-component-oauth-url-changed": "component security scheme %s oauth url changed from %s to %s", - "en.messages.api-security-component-oauth-url-changed-description": "auth URL modified in OAuth flow in components/securitySchemes", - "en.messages.api-security-component-removed": "removed component security scheme %s", - "en.messages.api-security-component-removed-description": "security scheme deleted in components/securitySchemes", - "en.messages.api-security-component-type-changed": "component security scheme %s type changed from %s to %s", - "en.messages.api-security-component-type-changed-description": "security scheme type modified in components/securitySchemes", - "en.messages.api-security-removed": "removed endpoint scheme security %s", - "en.messages.api-security-removed-description": "security requirements deleted from endpoint", - "en.messages.api-security-scope-added": "security scope %s was added to endpoint security scheme %s", - "en.messages.api-security-scope-added-description": "scope added to an endpoint's security scheme", - "en.messages.api-security-scope-removed": "removed security scope %s from endpoint security scheme %s", - "en.messages.api-security-scope-removed-description": "scope deleted from an endpoint's security scheme", - "en.messages.api-security-updated": "endpoint scheme security %s was updated from %s to %s", - "en.messages.api-stability-decreased": "endpoint stability level decreased from %s to %s", - "en.messages.api-stability-decreased-description": "endpoint stability level decreased", - "en.messages.api-sunset-date-changed-too-small": "api sunset date changed to earlier date from %s to %s, new sunset date must be not earlier than %s at least %s days from now", - "en.messages.api-sunset-date-changed-too-small-description": "modified sunset date doesn't meet min required deprecation days", - "en.messages.api-sunset-date-too-small": "sunset date %s is too small, must be at least %s days from now", - "en.messages.api-sunset-date-too-small-description": "deprecated endpoint sunset before min required deprecation days", - "en.messages.api-tag-added": "added api tag %s", - "en.messages.api-tag-added-description": "endpoint tag added", - "en.messages.api-tag-removed": "removed api tag %s", - "en.messages.api-tag-removed-description": "endpoint tag deleted", + "en.messages.api-deprecated-sunset-missing": "sunset date is missing for deprecated API", + "en.messages.api-deprecated-sunset-missing-description": "endpoint deprecated without sunset date", + "en.messages.api-deprecated-sunset-parse": "failed to parse sunset date: %v", + "en.messages.api-deprecated-sunset-parse-description": "endpoint deprecated with invalid sunset date", + "en.messages.api-global-security-added": "security scheme %s was added", + "en.messages.api-global-security-added-description": "security scheme added in security", + "en.messages.api-global-security-removed": "removed security scheme %s", + "en.messages.api-global-security-removed-description": "security scheme deleted in security", + "en.messages.api-global-security-scope-added": "security scope %s was added to global security scheme %s", + "en.messages.api-global-security-scope-added-description": "scope added to a security scheme in security", + "en.messages.api-global-security-scope-removed": "removed security scope %s from global security scheme %s", + "en.messages.api-global-security-scope-removed-description": "scope deleted from a security scheme in security", + "en.messages.api-invalid-stability-level": "failed to parse stability level: %v", + "en.messages.api-invalid-stability-level-description": "invalid stability level", + "en.messages.api-operation-id-added": "api operation id %s was added", + "en.messages.api-operation-id-added-description": "operation ID added to an endpoint", + "en.messages.api-operation-id-removed": "api operation id %s removed and replaced with %s", + "en.messages.api-operation-id-removed-description": "operation ID deleted from an endpoint", + "en.messages.api-path-removed-before-sunset": "api path removed before the sunset date %s", + "en.messages.api-path-removed-before-sunset-description": "path and endpoint deleted before sunset date", + "en.messages.api-path-removed-without-deprecation": "api path removed without deprecation", + "en.messages.api-path-removed-without-deprecation-description": "path and endpoint deleted without deprecation", + "en.messages.api-path-sunset-parse": "failed to parse sunset date: %v", + "en.messages.api-path-sunset-parse-description": "path and endpoint deleted with invalid or missing sunset date", + "en.messages.api-removed-before-sunset": "api removed before the sunset date %s", + "en.messages.api-removed-before-sunset-description": "endpoint deleted before sunset date", + "en.messages.api-removed-without-deprecation": "api removed without deprecation", + "en.messages.api-removed-without-deprecation-description": "endpoint deleted without deprecation", + "en.messages.api-schema-removed": "removed schema %s", + "en.messages.api-schema-removed-description": "schema deleted from components/schemas", + "en.messages.api-security-added": "endpoint scheme security %s was added", + "en.messages.api-security-added-description": "security requirements added to endpoint", + "en.messages.api-security-component-added": "component security scheme %s was added", + "en.messages.api-security-component-added-description": "security scheme added in components/securitySchemes", + "en.messages.api-security-component-oauth-scope-added": "component security scheme %s oauth scope %s was added", + "en.messages.api-security-component-oauth-scope-added-description": "scope added to OAuth flow in components/securitySchemes", + "en.messages.api-security-component-oauth-scope-changed": "component security scheme %s oauth scope %s was updated from %s to %s", + "en.messages.api-security-component-oauth-scope-changed-description": "scope modified in OAuth flow in components/securitySchemes", + "en.messages.api-security-component-oauth-scope-removed": "removed component security scheme %s oauth scope %s", + "en.messages.api-security-component-oauth-scope-removed-description": "scope deleted from OAuth flow in components/securitySchemes", + "en.messages.api-security-component-oauth-token-url-changed": "component security scheme %s oauth token url changed from %s to %s", + "en.messages.api-security-component-oauth-token-url-changed-description": "token URL modified in OAuth flow in components/securitySchemes", + "en.messages.api-security-component-oauth-url-changed": "component security scheme %s oauth url changed from %s to %s", + "en.messages.api-security-component-oauth-url-changed-description": "auth URL modified in OAuth flow in components/securitySchemes", + "en.messages.api-security-component-removed": "removed component security scheme %s", + "en.messages.api-security-component-removed-description": "security scheme deleted in components/securitySchemes", + "en.messages.api-security-component-type-changed": "component security scheme %s type changed from %s to %s", + "en.messages.api-security-component-type-changed-description": "security scheme type modified in components/securitySchemes", + "en.messages.api-security-removed": "removed endpoint scheme security %s", + "en.messages.api-security-removed-description": "security requirements deleted from endpoint", + "en.messages.api-security-scope-added": "security scope %s was added to endpoint security scheme %s", + "en.messages.api-security-scope-added-description": "scope added to an endpoint's security scheme", + "en.messages.api-security-scope-removed": "removed security scope %s from endpoint security scheme %s", + "en.messages.api-security-scope-removed-description": "scope deleted from an endpoint's security scheme", + "en.messages.api-stability-decreased": "endpoint stability level decreased from %s to %s", + "en.messages.api-stability-decreased-description": "endpoint stability level decreased", + "en.messages.api-sunset-date-changed-too-small": "api sunset date changed to earlier date from %s to %s, new sunset date must be not earlier than %s at least %s days from now", + "en.messages.api-sunset-date-changed-too-small-description": "modified sunset date doesn't meet min required deprecation days", + "en.messages.api-sunset-date-too-small": "sunset date %s is too small, must be at least %s days from now", + "en.messages.api-sunset-date-too-small-description": "deprecated endpoint sunset before min required deprecation days", + "en.messages.api-tag-added": "added api tag %s", + "en.messages.api-tag-added-description": "endpoint tag added", + "en.messages.api-tag-removed": "removed api tag %s", + "en.messages.api-tag-removed-description": "endpoint tag deleted", "en.messages.at": "at", "en.messages.endpoint-added": "endpoint added", "en.messages.endpoint-added-description": "endpoint added", diff --git a/checker/localizations_src/en/messages.yaml b/checker/localizations_src/en/messages.yaml index 1893a858..3d46146a 100644 --- a/checker/localizations_src/en/messages.yaml +++ b/checker/localizations_src/en/messages.yaml @@ -163,13 +163,11 @@ response-body-min-decreased: min value of response body was decreased from %s to response-property-min-decreased: min value of %s response property was decreased from %s to %s for response status %s api-security-added: endpoint scheme security %s was added api-security-removed: removed endpoint scheme security %s # tested -api-security-updated: endpoint scheme security %s was updated from %s to %s api-global-security-added: security scheme %s was added api-global-security-removed: removed security scheme %s # tested api-global-security-scope-removed: removed security scope %s from global security scheme %s api-global-security-scope-added: security scope %s was added to global security scheme %s api-security-scope-removed: removed security scope %s from endpoint security scheme %s # tested -api-stability-decreased-description: endpoint stability level decreased api-security-scope-added: security scope %s was added to endpoint security scheme %s api-security-component-type-changed: component security scheme %s type changed from %s to %s api-security-component-oauth-url-changed: component security scheme %s oauth url changed from %s to %s @@ -300,6 +298,7 @@ api-operation-id-removed-description: operation ID deleted from an endpoint api-path-removed-before-sunset-description: path and endpoint deleted before sunset date api-path-removed-without-deprecation-description: path and endpoint deleted without deprecation api-path-sunset-parse-description: path and endpoint deleted with invalid or missing sunset date +api-stability-decreased-description: endpoint stability level decreased api-removed-before-sunset-description: endpoint deleted before sunset date api-removed-without-deprecation-description: endpoint deleted without deprecation api-schema-removed-description: schema deleted from components/schemas diff --git a/docs/BREAKING-CHANGES-EXAMPLES.md b/docs/BREAKING-CHANGES-EXAMPLES.md index 24e9074c..9522a70d 100644 --- a/docs/BREAKING-CHANGES-EXAMPLES.md +++ b/docs/BREAKING-CHANGES-EXAMPLES.md @@ -4,57 +4,58 @@ 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 a new required property in request body is breaking](../checker/check_breaking_property_test.go?plain=1#L365) -[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) -[adding a required request body is breaking](../checker/check_breaking_test.go?plain=1#L61) -[changing a request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L126) -[changing a request body type and changing it to enum simultaneously is breaking](../checker/check_breaking_property_test.go?plain=1#L157) -[changing a request property to not nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L245) -[changing a required property in response body to optional and also deleting it is breaking](../checker/check_breaking_property_test.go?plain=1#L293) -[changing a response body to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L228) -[changing a response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L261) -[changing a response property to optional under AllOf, AnyOf or OneOf is breaking](../checker/check_breaking_property_test.go?plain=1#L695) -[changing an embedded response property to nullable is breaking](../checker/check_breaking_property_test.go?plain=1#L277) -[changing an existing header param from optional to required is breaking](../checker/check_breaking_test.go?plain=1#L190) -[changing an existing path param to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L194) -[changing an existing property in request body anyOf to required is breaking](../checker/check_breaking_property_test.go?plain=1#L661) -[changing an existing property in request body items to required is breaking](../checker/check_breaking_property_test.go?plain=1#L629) -[changing an existing property in request body to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L177) -[changing an existing property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L349) -[changing an existing property in request header to enum is breaking](../checker/check_breaking_property_test.go?plain=1#L211) -[changing an existing property in request header to required is breaking](../checker/check_breaking_property_test.go?plain=1#L58) -[changing an existing property in response body to optional is breaking](../checker/check_breaking_property_test.go?plain=1#L109) -[changing an existing property under another property in request body to required is breaking](../checker/check_breaking_property_test.go?plain=1#L678) -[changing an existing request body from optional to required is breaking](../checker/check_breaking_test.go?plain=1#L79) -[changing an existing required property in response body to not-write-only is breaking](../checker/check_breaking_property_test.go?plain=1#L586) -[changing an existing response header from required to optional is breaking](../checker/check_breaking_test.go?plain=1#L214) +[adding a new required property in request body is breaking: new-required-request-property](../checker/check_breaking_property_test.go?plain=1#L371) +[adding a pattern to a schema is breaking for recursive properties: request-property-pattern-added](../checker/check_breaking_test.go?plain=1#L490) +[adding a pattern to a schema is breaking: request-property-pattern-added](../checker/check_breaking_test.go?plain=1#L473) +[adding a required request body is breaking: request-body-added-required](../checker/check_breaking_test.go?plain=1#L61) +[changing a request body to enum is breaking: request-body-became-enum](../checker/check_breaking_property_test.go?plain=1#L126) +[changing a request body type and changing it to enum simultaneously is breaking: request-body-became-enum, request-body-type-changed](../checker/check_breaking_property_test.go?plain=1#L157) +[changing a request property to not nullable is breaking: request-property-became-not-nullable](../checker/check_breaking_property_test.go?plain=1#L245) +[changing a required property in response body to optional and also deleting it is breaking: response-required-property-removed](../checker/check_breaking_property_test.go?plain=1#L296) +[changing a response body to nullable is breaking: response-body-became-nullable](../checker/check_breaking_property_test.go?plain=1#L228) +[changing a response property to nullable is breaking: response-property-became-nullable](../checker/check_breaking_property_test.go?plain=1#L262) +[changing a response property to optional under AllOf, AnyOf or OneOf is breaking: response-property-became-optional](../checker/check_breaking_property_test.go?plain=1#L703) +[changing an embedded response property to nullable is breaking: response-property-became-nullable](../checker/check_breaking_property_test.go?plain=1#L279) +[changing an existing header param from optional to required is breaking: request-parameter-became-required](../checker/check_breaking_test.go?plain=1#L190) +[changing an existing header param from optional to required is breaking](../checker/check_request_parameter_required_value_updated_test.go?plain=1#L13) +[changing an existing path param to enum is breaking: request-parameter-became-enum](../checker/check_breaking_property_test.go?plain=1#L194) +[changing an existing property in request body anyOf to required is breaking: request-property-became-required](../checker/check_breaking_property_test.go?plain=1#L669) +[changing an existing property in request body items to required is breaking: request-property-became-required](../checker/check_breaking_property_test.go?plain=1#L637) +[changing an existing property in request body to enum is breaking: request-property-became-enum](../checker/check_breaking_property_test.go?plain=1#L177) +[changing an existing property in request body to required is breaking: request-property-became-required](../checker/check_breaking_property_test.go?plain=1#L354) +[changing an existing property in request header to enum is breaking: request-header-property-became-enum](../checker/check_breaking_property_test.go?plain=1#L211) +[changing an existing property in request header to required is breaking: request-header-property-became-required](../checker/check_breaking_property_test.go?plain=1#L58) +[changing an existing property in response body to optional is breaking: response-property-became-optional](../checker/check_breaking_property_test.go?plain=1#L109) +[changing an existing property under another property in request body to required is breaking: request-property-became-required](../checker/check_breaking_property_test.go?plain=1#L686) +[changing an existing request body from optional to required is breaking: request-body-became-required](../checker/check_breaking_test.go?plain=1#L79) +[changing an existing required property in response body to not-write-only is breaking: response-required-property-became-not-write-only](../checker/check_breaking_property_test.go?plain=1#L594) +[changing an existing response header from required to optional is breaking: response-header-became-optional](../checker/check_breaking_test.go?plain=1#L214) [changing max length in request from nil to any value is breaking: request-parameter-max-length-set](../checker/check_breaking_min_max_test.go?plain=1#L114) [changing max length in response from any value to nil is breaking: response-body-max-length-unset](../checker/check_breaking_min_max_test.go?plain=1#L165) -[changing request's body schema type from number to integer is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L52) -[changing request's body schema type from number to string is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L32) -[changing request's body schema type from number/none to integer/int32 is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L92) -[changing request's body schema type from string to number is breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L12) +[changing request's body schema type from number to integer is breaking: request-body-type-changed](../checker/check_breaking_request_type_changed_test.go?plain=1#L52) +[changing request's body schema type from number to string is breaking: request-body-type-changed](../checker/check_breaking_request_type_changed_test.go?plain=1#L32) +[changing request's body schema type from number/none to integer/int32 is breaking: request-body-type-changed](../checker/check_breaking_request_type_changed_test.go?plain=1#L92) +[changing request's body schema type from string to number is breaking: request-body-type-changed](../checker/check_breaking_request_type_changed_test.go?plain=1#L12) [changing request's query param property type from number to string is breaking](../checker/check_request_parameters_type_changed_test.go?plain=1#L216) -[changing response's body schema type from integer to number is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L70) -[changing response's body schema type from number to string is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L32) -[changing response's body schema type from string to number is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L12) -[changing response's embedded property schema type from string/none to integer/int32 is breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L109) +[changing response's body schema type from integer to number is breaking: response-body-type-changed](../checker/check_breaking_response_type_changed_test.go?plain=1#L70) +[changing response's body schema type from number to string is breaking: response-body-type-changed](../checker/check_breaking_response_type_changed_test.go?plain=1#L32) +[changing response's body schema type from string to number is breaking: response-body-type-changed](../checker/check_breaking_response_type_changed_test.go?plain=1#L12) +[changing response's embedded property schema type from string/none to integer/int32 is breaking: response-property-type-changed](../checker/check_breaking_response_type_changed_test.go?plain=1#L109) [changing sunset from an invalid date for a deprecated endpoint is breaking: api-path-sunset-parse](../checker/check_api_sunset_changed_test.go?plain=1#L65) [changing sunset to an earlier date for a deprecated endpoint with a deprecation policy is breaking: api-sunset-date-changed-too-small](../checker/check_api_sunset_changed_test.go?plain=1#L29) [changing sunset to an invalid date for a deprecated endpoint is breaking: api-path-sunset-parse](../checker/check_api_sunset_changed_test.go?plain=1#L47) -[decreasing stability level is breaking](../checker/checker_test.go?plain=1#L11) -[deleting a media-type from response is breaking](../checker/check_breaking_test.go?plain=1#L442) -[deleting a non-required non-write-only property in response body is breaking with warning](../checker/check_breaking_property_test.go?plain=1#L528) -[deleting a path is breaking](../checker/check_breaking_test.go?plain=1#L37) +[decreasing stability level is breaking: api-stability-decreased](../checker/checker_test.go?plain=1#L11) +[deleting a media-type from response is breaking: response-media-type-removed](../checker/check_breaking_test.go?plain=1#L442) +[deleting a non-required non-write-only property in response body is breaking with warning: request-property-removed, response-optional-property-removed](../checker/check_breaking_property_test.go?plain=1#L536) +[deleting a path is breaking: api-path-removed-without-deprecation](../checker/check_breaking_test.go?plain=1#L37) [deleting a path with some operations having sunset date in the future is breaking: api-path-removed-before-sunset](../checker/check_api_removed_test.go?plain=1#L86) -[deleting a required property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L381) -[deleting a required property in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L434) -[deleting a required property under AllOf in response body is breaking](../checker/check_breaking_property_test.go?plain=1#L465) -[deleting an embedded optional property in request is breaking with warn](../checker/check_breaking_property_test.go?plain=1#L398) -[deleting an enum value is breaking](../checker/check_breaking_test.go?plain=1#L101) +[deleting a required property in request is breaking with warn: request-property-removed](../checker/check_breaking_property_test.go?plain=1#L388) +[deleting a required property in response body is breaking: response-required-property-removed](../checker/check_breaking_property_test.go?plain=1#L442) +[deleting a required property under AllOf in response body is breaking: response-required-property-removed](../checker/check_breaking_property_test.go?plain=1#L473) +[deleting an embedded optional property in request is breaking with warn: request-property-removed](../checker/check_breaking_property_test.go?plain=1#L406) +[deleting an enum value is breaking: request-parameter-enum-value-removed](../checker/check_breaking_test.go?plain=1#L101) [deleting an operation before sunset date is breaking: api-removed-before-sunset](../checker/check_api_removed_test.go?plain=1#L11) -[deleting an operation is breaking](../checker/check_breaking_test.go?plain=1#L45) +[deleting an operation is breaking: api-removed-without-deprecation: api-removed-without-deprecation](../checker/check_breaking_test.go?plain=1#L45) [deleting sunset header for a deprecated endpoint is breaking: sunset-deleted](../checker/check_api_sunset_changed_test.go?plain=1#L11) [deprecating an operation with a deprecation policy and an invalid stability level is breaking: api-invalid-stability-level](../checker/check_api_deprecation_test.go?plain=1#L67) [deprecating an operation with a deprecation policy and an invalid sunset date is breaking: api-deprecated-sunset-parse](../checker/check_api_deprecation_test.go?plain=1#L48) @@ -63,13 +64,13 @@ These examples are automatically generated from unit tests. [inclreasing request body min items is breaking](../checker/check_request_property_min_items_increased_test.go?plain=1#L12) [increasing max length in response is breaking: response-body-max-length-increased](../checker/check_breaking_min_max_test.go?plain=1#L95) [increasing min items in request is breaking: request-parameter-min-items-increased](../checker/check_breaking_min_max_test.go?plain=1#L243) -[modifying a pattern in a schema is breaking](../checker/check_breaking_test.go?plain=1#L507) +[modifying a pattern in a schema is breaking: request-property-pattern-changed](../checker/check_breaking_test.go?plain=1#L507) [modifying a pattern in request parameter is breaking: request-parameter-pattern-removed](../checker/check_breaking_test.go?plain=1#L539) -[modifying the default value of an optional request parameter is breaking](../checker/check_breaking_test.go?plain=1#L570) -[new header, query and cookie required request default param is breaking](../checker/check_new_request_non_path_default_parameter_test.go?plain=1#L12) -[new required header param is breaking](../checker/check_breaking_test.go?plain=1#L173) -[new required path param is breaking](../checker/check_breaking_test.go?plain=1#L156) -[new required property in request header is breaking](../checker/check_breaking_property_test.go?plain=1#L18) +[modifying the default value of an optional request parameter is breaking: request-parameter-default-value-changed](../checker/check_breaking_test.go?plain=1#L570) +[new header, query and cookie required request default param is breaking: new-required-request-default-parameter-to-existing-path, new-optional-request-default-parameter-to-existing-path](../checker/check_new_request_non_path_default_parameter_test.go?plain=1#L12) +[new required header param is breaking: new-required-request-parameter](../checker/check_breaking_test.go?plain=1#L173) +[new required path param is breaking: new-request-path-parameter](../checker/check_breaking_test.go?plain=1#L156) +[new required property in request header is breaking: new-required-request-header-property](../checker/check_breaking_property_test.go?plain=1#L18) [reducing max in request is breaking: request-parameter-max-decreased](../checker/check_breaking_min_max_test.go?plain=1#L273) [reducing max length in request is breaking: request-parameter-max-length-decreased](../checker/check_breaking_min_max_test.go?plain=1#L12) [reducing min items in response is breaking: response-body-min-items-decreased](../checker/check_breaking_min_max_test.go?plain=1#L226) @@ -80,19 +81,19 @@ These examples are automatically generated from unit tests. [removing a deprecated enpoint with an invalid date is breaking: api-path-sunset-parse](../checker/check_api_removed_test.go?plain=1#L104) [removing a media type from request body is breaking](../checker/check_breaking_test.go?plain=1#L668) [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#L422) -[removing an existing required response header is breaking as error](../checker/check_breaking_test.go?plain=1#L231) -[removing an existing response with non-successful status is breaking (optional)](../checker/check_breaking_test.go?plain=1#L270) -[removing an existing response with successful status is breaking](../checker/check_breaking_test.go?plain=1#L251) -[removing an schema object from components is breaking (optional)](../checker/check_breaking_test.go?plain=1#L643) -[removing the default value of an optional request parameter is breaking](../checker/check_breaking_test.go?plain=1#L606) +[removing an existing optional response header is breaking as warn: optional-response-header-removed](../checker/check_breaking_test.go?plain=1#L422) +[removing an existing required response header is breaking as error: required-response-header-removed](../checker/check_breaking_test.go?plain=1#L231) +[removing an existing response with non-successful status is breaking (optional): response-non-success-status-removed](../checker/check_breaking_test.go?plain=1#L270) +[removing an existing response with successful status is breaking: response-success-status-removed](../checker/check_breaking_test.go?plain=1#L251) +[removing an schema object from components is breaking (optional): api-schema-removed](../checker/check_breaking_test.go?plain=1#L643) +[removing the default value of an optional request parameter is breaking: request-parameter-default-value-removed](../checker/check_breaking_test.go?plain=1#L606) [removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not alpha stability level: api-path-removed-without-deprecation](../checker/check_api_removed_test.go?plain=1#L44) [removing the path without a deprecation policy and without specifying sunset date is breaking if some APIs are not draft stability level: api-path-removed-without-deprecation](../checker/check_api_removed_test.go?plain=1#L64) -[removing/updating a property enum in response is breaking (optional)](../checker/check_breaking_test.go?plain=1#L333) -[removing/updating a tag is breaking (optional)](../checker/check_breaking_test.go?plain=1#L351) -[removing/updating an enum in request body is breaking (optional)](../checker/check_breaking_test.go?plain=1#L310) -[removing/updating an operation id is breaking (optional)](../checker/check_breaking_test.go?plain=1#L289) -[setting the default value of an optional request parameter is breaking](../checker/check_breaking_test.go?plain=1#L588) +[removing/updating a property enum in response is breaking (optional): response-property-enum-value-removed](../checker/check_breaking_test.go?plain=1#L333) +[removing/updating a tag is breaking (optional): api-tag-removed](../checker/check_breaking_test.go?plain=1#L351) +[removing/updating an enum in request body is breaking (optional): request-body-enum-value-removed](../checker/check_breaking_test.go?plain=1#L310) +[removing/updating an operation id is breaking (optional): api-operation-id-removed](../checker/check_breaking_test.go?plain=1#L289) +[setting the default value of an optional request parameter is breaking: request-parameter-default-value-added](../checker/check_breaking_test.go?plain=1#L588) [specializing request's query param property type from string to number is breaking](../checker/check_request_parameters_type_changed_test.go?plain=1#L233) [specifying a non-text, not-json stability level in base is breaking](../checker/checker_test.go?plain=1#L82) [specifying an invalid stability level in base is breaking](../checker/checker_test.go?plain=1#L65) @@ -101,10 +102,10 @@ These examples are automatically generated from unit tests. ## Examples of non-breaking changes [adding a media-type to response is not breaking](../checker/check_not_breaking_test.go?plain=1#L184) -[adding a new required property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L420) -[adding a new required property under AllOf in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L451) -[adding a new required read-only property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L482) -[adding a non-existent required property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L307) +[adding a new required property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L428) +[adding a new required property under AllOf in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L459) +[adding a new required read-only property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L490) +[adding a non-existent required property in request body is not breaking](../checker/check_breaking_property_test.go?plain=1#L312) [adding a required property to response is not breaking](../checker/check_not_breaking_test.go?plain=1#L289) [adding a tag is not breaking](../checker/check_not_breaking_test.go?plain=1#L266) [adding an enum value is not breaking](../checker/check_not_breaking_test.go?plain=1#L82) @@ -114,25 +115,25 @@ These examples are automatically generated from unit tests. [both max lengths in request are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L184) [both max lengths in response are nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L198) [changing a link to operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L175) -[changing an existing property in request body items to required with a default value is not breaking](../checker/check_breaking_property_test.go?plain=1#L647) -[changing an existing property in request body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L335) +[changing an existing property in request body items to required with a default value is not breaking](../checker/check_breaking_property_test.go?plain=1#L655) +[changing an existing property in request body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L340) [changing an existing property in request header to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L85) -[changing an existing property in response body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L321) -[changing an existing read-only property in request body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L496) -[changing an existing required property in response body to write-only is not breaking](../checker/check_breaking_property_test.go?plain=1#L572) -[changing an existing write-only property in response body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L558) +[changing an existing property in response body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L326) +[changing an existing read-only property in request body to required is not breaking](../checker/check_breaking_property_test.go?plain=1#L504) +[changing an existing required property in response body to write-only is not breaking](../checker/check_breaking_property_test.go?plain=1#L580) +[changing an existing write-only property in response body to optional is not breaking](../checker/check_breaking_property_test.go?plain=1#L566) [changing comments is not breaking](../checker/check_not_breaking_test.go?plain=1#L106) [changing extensions is not breaking](../checker/check_not_breaking_test.go?plain=1#L94) [changing max length in request from any value to nil is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L149) [changing max length in response from nil to any value is not breaking](../checker/check_breaking_min_max_test.go?plain=1#L133) [changing operation ID is not breaking](../checker/check_not_breaking_test.go?plain=1#L166) -[changing request's body schema type from integer to number is not breaking](../checker/check_breaking_request_type_changed_test.go?plain=1#L72) +[changing request's body schema type from integer to number is not breaking: request-body-type-generalized](../checker/check_breaking_request_type_changed_test.go?plain=1#L72) [changing response's body schema type from number to integer is not breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L52) [changing response's body schema type from number/none to integer/int32 is not breaking](../checker/check_breaking_response_type_changed_test.go?plain=1#L90) [changing servers is not breaking](../checker/check_not_breaking_test.go?plain=1#L252) [deleting a path after sunset date of all contained operations is not breaking](../checker/check_api_deprecation_test.go?plain=1#L256) [deleting a pattern from a schema is not breaking](../checker/check_breaking_test.go?plain=1#L459) -[deleting a required write-only property in response body is not breaking](../checker/check_breaking_property_test.go?plain=1#L510) +[deleting a required write-only property in response body is not breaking: request-property-removed](../checker/check_breaking_property_test.go?plain=1#L518) [deleting a tag is not breaking](../checker/check_not_breaking_test.go?plain=1#L71) [deleting an operation after sunset date is not breaking](../checker/check_api_deprecation_test.go?plain=1#L33) [deleting an operation without sunset date is not breaking](../checker/check_api_removed_test.go?plain=1#L29) @@ -177,12 +178,12 @@ These examples are automatically generated from unit tests. [adding a new global security to the API: api-global-security-added](../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) -[adding a new oauth security scope](../checker/check_components_security_updated_test.go?plain=1#L117) +[adding a new oauth security scope: api-security-component-oauth-scope-added](../checker/check_components_security_updated_test.go?plain=1#L117) [adding a new operation id: api-operation-id-added](../checker/check_api_operation_id_updated_test.go?plain=1#L64) [adding a new optional request property](../checker/check_request_property_updated_test.go?plain=1#L70) -[adding a new required request property with a default value](../checker/check_request_property_updated_test.go?plain=1#L117) +[adding a new required request property with a default value: new-required-request-property-with-default](../checker/check_request_property_updated_test.go?plain=1#L117) [adding a new required request property](../checker/check_request_property_updated_test.go?plain=1#L12) -[adding a new security component](../checker/check_components_security_updated_test.go?plain=1#L77) +[adding a new security component: api-security-component-added](../checker/check_components_security_updated_test.go?plain=1#L77) [adding a new security to the API endpoint: api-security-added](../checker/check_api_security_updated_test.go?plain=1#L90) [adding a new tag: api-tag-added](../checker/check_api_tag_updated_test.go?plain=1#L12) [adding a non-success response status](../checker/check_response_status_updated_test.go?plain=1#L37) @@ -204,7 +205,7 @@ These examples are automatically generated from unit tests. [adding request property pattern: request-property-pattern-added](../checker/check_request_property_pattern_added_or_changed_test.go?plain=1#L62) [adding response body default value or response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L70) [adding response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L37) -[adding two new request properties, one required, one optional](../checker/check_request_property_updated_test.go?plain=1#L35) +[adding two new request properties, one required, one optional: new-required-request-property, new-optional-request-property](../checker/check_request_property_updated_test.go?plain=1#L35) [changing a response property schema format](../checker/check_response_property_type_changed_test.go?plain=1#L60) [changing a response property schema type from a single value to to multiple types](../checker/check_response_property_type_changed_test.go?plain=1#L126) [changing a response property schema type from string to integer](../checker/check_response_property_type_changed_test.go?plain=1#L36) @@ -266,9 +267,9 @@ These examples are automatically generated from unit tests. [changing response body default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L46) [changing response body property default value](../checker/check_response_property_default_value_changed_test.go?plain=1#L12) [changing response property pattern](../checker/check_response_pattern_added_or_changed_test.go?plain=1#L12) -[changing security component oauth's url](../checker/check_components_security_updated_test.go?plain=1#L11) -[changing security component token url](../checker/check_components_security_updated_test.go?plain=1#L33) -[changing security component type](../checker/check_components_security_updated_test.go?plain=1#L55) +[changing security component oauth's url: api-security-component-oauth-url-changed](../checker/check_components_security_updated_test.go?plain=1#L11) +[changing security component token url: api-security-component-oauth-token-url-changed](../checker/check_components_security_updated_test.go?plain=1#L33) +[changing security component type: api-security-component-type-changed](../checker/check_components_security_updated_test.go?plain=1#L55) [changing write-only required response property to optional](../checker/check_response_property_became_optional_test.go?plain=1#L33) [decreasing max length of request body](../checker/check_request_property_max_length_updated_test.go?plain=1#L41) [decreasing max length of request property](../checker/check_request_property_max_length_updated_test.go?plain=1#L70) @@ -305,7 +306,7 @@ These examples are automatically generated from unit tests. [increasing request body maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L91) [increasing request property maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L65) [making request property required, while also giving it a default value](../checker/check_request_property_required_updated_test.go?plain=1#L60) -[new header, query and cookie request params](../checker/check_new_request_non_path_parameter_test.go?plain=1#L11) +[new header, query and cookie request params: new-optional-request-parameter](../checker/check_new_request_non_path_parameter_test.go?plain=1#L11) [new paths or path operations: endpoint-added](../checker/check_api_added_test.go?plain=1#L11) [path operations that became deprecated: endpoint-deprecated](../checker/check_api_deprecation_test.go?plain=1#L271) [path operations that were re-activated: endpoint-reactivated](../checker/check_api_deprecation_test.go?plain=1#L294) @@ -317,8 +318,9 @@ These examples are automatically generated from unit tests. [removing 'oneOf' schema from the response body or response body property](../checker/check_response_property_one_of_updated_test.go?plain=1#L55) [removing a global security from the API: api-global-security-removed](../checker/check_api_security_updated_test.go?plain=1#L31) [removing a new media type to response](../checker/check_response_mediatype_updated_test.go?plain=1#L34) -[removing a new oauth security scope](../checker/check_components_security_updated_test.go?plain=1#L139) -[removing a new security component](../checker/check_components_security_updated_test.go?plain=1#L97) +[removing a new oauth security scope: api-security-component-oauth-scope-changed](../checker/check_components_security_updated_test.go?plain=1#L162) +[removing a new oauth security scope: api-security-component-oauth-scope-removed](../checker/check_components_security_updated_test.go?plain=1#L139) +[removing a new security component: api-security-component-removed](../checker/check_components_security_updated_test.go?plain=1#L97) [removing a new security to the API endpoint: api-security-removed](../checker/check_api_security_updated_test.go?plain=1#L112) [removing a non-success response status](../checker/check_response_status_updated_test.go?plain=1#L62) [removing a required request property](../checker/check_request_property_updated_test.go?plain=1#L94) diff --git a/scripts/get_tested_ids.sh b/scripts/get_tested_ids.sh index 0b5d1041..bfeae801 100755 --- a/scripts/get_tested_ids.sh +++ b/scripts/get_tested_ids.sh @@ -1,12 +1,7 @@ #!/bin/sh if [[ $1 == "-v" ]]; then - echo "Test IDs with line numbers:" grep -nRE --exclude-dir=localizations,localizations_src "// (CL|BC): .*: .*-.*" checker/* | cut -d":" -f1,2,5 else - cmd='grep -nRE --exclude-dir=localizations,localizations_src "// (CL|BC): .*: .*-.*" checker/* | cut -d":" -f5 | tr , '\n' | sort -u' - cmd_with_wc=$cmd"|wc -l|xargs echo" - count=$(eval "$cmd_with_wc") - echo "Unique test IDs ("$count"):" - eval "$cmd" + grep -nRE --exclude-dir=localizations,localizations_src '// (CL|BC): .*: .*-.*' checker/* | cut -d: -f5 | tr , '\n' | awk '{$1=$1};1' | sort -u fi From 05bb6a226f328f7e42975005613d688d71b928c6 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 29 Aug 2024 22:20:20 +0300 Subject: [PATCH 12/26] add script to print untested ids --- scripts/get_tested_ids.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/get_tested_ids.sh b/scripts/get_tested_ids.sh index bfeae801..b23f6698 100755 --- a/scripts/get_tested_ids.sh +++ b/scripts/get_tested_ids.sh @@ -1,7 +1,9 @@ -#!/bin/sh +#!/bin/bash -if [[ $1 == "-v" ]]; then +if [[ $1 == "lines" ]]; then grep -nRE --exclude-dir=localizations,localizations_src "// (CL|BC): .*: .*-.*" checker/* | cut -d":" -f1,2,5 -else +elif [[ $1 == "ids" ]]; then grep -nRE --exclude-dir=localizations,localizations_src '// (CL|BC): .*: .*-.*' checker/* | cut -d: -f5 | tr , '\n' | awk '{$1=$1};1' | sort -u +elif [[ $1 == "diff" ]]; then + diff --side-by-side <(grep -nRE --exclude-dir=localizations,localizations_src '// (CL|BC): .*: .*-.*' checker/* | cut -d: -f5 | tr , '\n' | awk '{$1=$1};1' | sort -u) <(cat checker/localizations_src/en/messages.yaml | sed '/# warnings/q' | cut -d":" -f1 | sort -n) fi From a25eacd3d797e879e0da452f19e3572e9d56d71c Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 30 Aug 2024 16:04:26 +0300 Subject: [PATCH 13/26] add message generator --- checker/check_breaking_test.go | 2 +- checker/check_not_breaking_test.go | 32 ++--- ...eck_request_body_mediatype_updated_test.go | 6 +- ...equest_body_required_value_updated_test.go | 6 +- .../check_request_discriminator_updated.go | 37 +++-- ...heck_request_discriminator_updated_test.go | 122 ++++++++-------- checker/generator/checks.go | 125 +++++++++++++++++ checker/generator/checks_test.go | 12 ++ checker/generator/messages.yaml | 130 ++++++++++++++++++ checker/generator/value_set.go | 30 ++++ checker/localizations/localizations.go | 14 +- checker/localizations_src/en/messages.yaml | 12 +- go.mod | 1 + go.sum | 2 + scripts/get_tested_ids.sh | 6 +- 15 files changed, 429 insertions(+), 108 deletions(-) create mode 100644 checker/generator/checks.go create mode 100644 checker/generator/checks_test.go create mode 100644 checker/generator/messages.yaml create mode 100644 checker/generator/value_set.go diff --git a/checker/check_breaking_test.go b/checker/check_breaking_test.go index e7fe25cf..df70125e 100644 --- a/checker/check_breaking_test.go +++ b/checker/check_breaking_test.go @@ -304,7 +304,7 @@ func TestBreaking_OperationIdRemoved(t *testing.T) { require.Len(t, errs, 1) require.Equal(t, checker.APIOperationIdRemovedId, errs[0].GetId()) require.Equal(t, "api operation id 'GetSecurityScores' removed and replaced with 'newOperationId'", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) - verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.APIOperationIdRemovedId) + verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.APIOperationIdRemovedId, "api operation id 'GetSecurityScores' removed and replaced with 'newOperationId'") } // BC: removing/updating an enum in request body is breaking (optional): request-body-enum-value-removed diff --git a/checker/check_not_breaking_test.go b/checker/check_not_breaking_test.go index 69dcacbb..f3248938 100644 --- a/checker/check_not_breaking_test.go +++ b/checker/check_not_breaking_test.go @@ -11,7 +11,7 @@ import ( "github.com/tufin/oasdiff/diff" ) -func verifyNonBreakingChangeIsChangelogEntry(t *testing.T, d *diff.Diff, osm *diff.OperationsSourcesMap, changeId string) { +func verifyNonBreakingChangeIsChangelogEntry(t *testing.T, d *diff.Diff, osm *diff.OperationsSourcesMap, changeId string, text string) { t.Helper() // Check no breaking change is detected @@ -22,6 +22,7 @@ func verifyNonBreakingChangeIsChangelogEntry(t *testing.T, d *diff.Diff, osm *di require.Len(t, errs, 1) require.Equal(t, checker.INFO, errs[0].GetLevel()) require.Equal(t, changeId, errs[0].GetId()) + require.Equal(t, text, errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } // BC: no change is not breaking @@ -50,7 +51,7 @@ func TestBreaking_AddingOptionalRequestBody(t *testing.T) { require.Empty(t, errs) } -// CL: changing an existing request body from required to optional +// CL: changing an existing request body from required to optional: request-body-became-optional func TestBreaking_RequestBodyRequiredDisabled(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -65,7 +66,7 @@ func TestBreaking_RequestBodyRequiredDisabled(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) - verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.RequestBodyBecameOptionalId) + verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.RequestBodyBecameOptionalId, "request body became optional") } // BC: deleting a tag is not breaking @@ -129,7 +130,7 @@ func TestBreaking_NewOptionalHeaderParam(t *testing.T) { require.Empty(t, errs) } -// CL: changing an existing header param to optional +// CL: changing an existing header param to optional: request-parameter-became-optional func TestBreaking_HeaderParamRequiredDisabled(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -139,10 +140,7 @@ func TestBreaking_HeaderParamRequiredDisabled(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) - changes := checker.CheckBackwardCompatibilityUntilLevel(allChecksConfig(), d, osm, checker.INFO) - require.NotEmpty(t, changes) - require.Equal(t, checker.RequestParameterBecomeOptionalId, changes[0].GetId()) - require.Len(t, changes, 1) + verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.RequestParameterBecomeOptionalId, "'header' request parameter 'network-policies' became optional") } func deleteResponseHeader(response *openapi3.Response, name string) { @@ -195,7 +193,7 @@ func TestBreaking_ResponseAddMediaType(t *testing.T) { require.Empty(t, errs) } -// CL: deprecating an operation with sunset greater than min +// CL: deprecating an operation with sunset greater than min: endpoint-deprecated func TestBreaking_DeprecatedOperation(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -205,9 +203,7 @@ func TestBreaking_DeprecatedOperation(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) - errs := checker.CheckBackwardCompatibilityUntilLevel(allChecksConfig(), d, osm, checker.INFO) - require.Len(t, errs, 1) - require.Equal(t, errs[0].GetLevel(), checker.INFO) + verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.EndpointDeprecatedId, "endpoint deprecated") } // BC: deprecating a parameter is not breaking @@ -263,7 +259,7 @@ func TestBreaking_Servers(t *testing.T) { require.Empty(t, errs) } -// BC: adding a tag is not breaking +// BC: adding a tag is not breaking: api-tag-added func TestBreaking_TagAdded(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -271,10 +267,10 @@ func TestBreaking_TagAdded(t *testing.T) { s2.Spec.Paths.Value(securityScorePath).Get.Tags = append(s2.Spec.Paths.Value(securityScorePath).Get.Tags, "newTag") d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) - verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.APITagAddedId) + verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.APITagAddedId, "added api tag 'newTag'") } -// BC: adding an operation ID is not breaking +// BC: adding an operation ID is not breaking: api-operation-id-added func TestBreaking_OperationIdAdded(t *testing.T) { s1 := l(t, 1) s2 := l(t, 1) @@ -283,10 +279,10 @@ func TestBreaking_OperationIdAdded(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) - verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.APIOperationIdAddId) + verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.APIOperationIdAddId, "api operation id 'GetSecurityScores' was added") } -// BC: adding a required property to response is not breaking +// BC: adding a required property to response is not breaking: response-required-property-added func TestBreaking_RequiredResponsePropertyAdded(t *testing.T) { s1, err := open("../data/checker/response_required_property_added_base.yaml") require.NoError(t, err) @@ -296,5 +292,5 @@ func TestBreaking_RequiredResponsePropertyAdded(t *testing.T) { d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) require.NoError(t, err) - verifyNonBreakingChangeIsChangelogEntry(t, d, osm, "response-required-property-added") + verifyNonBreakingChangeIsChangelogEntry(t, d, osm, checker.ResponseRequiredPropertyAddedId, "added required property 'data/new' to response status '200'") } diff --git a/checker/check_request_body_mediatype_updated_test.go b/checker/check_request_body_mediatype_updated_test.go index 61c337d9..2a29e4e0 100644 --- a/checker/check_request_body_mediatype_updated_test.go +++ b/checker/check_request_body_mediatype_updated_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/load" ) -// CL: adding a new media type to request body +// CL: adding a new media type to request body: request-body-media-type-added func TestRequestBodyMediaTypeAdded(t *testing.T) { s1, err := open("../data/checker/request_body_media_type_updated_base.yaml") require.NoError(t, err) @@ -29,9 +29,10 @@ func TestRequestBodyMediaTypeAdded(t *testing.T) { Source: load.NewSource("../data/checker/request_body_media_type_updated_revision.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "added media type 'application/json' to the request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing media type from request body +// CL: removing media type from request body: request-body-media-type-removed func TestRequestBodyMediaTypeRemoved(t *testing.T) { s1, err := open("../data/checker/request_body_media_type_updated_revision.yaml") require.NoError(t, err) @@ -51,4 +52,5 @@ func TestRequestBodyMediaTypeRemoved(t *testing.T) { Source: load.NewSource("../data/checker/request_body_media_type_updated_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "removed media type 'application/json' from the request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_body_required_value_updated_test.go b/checker/check_request_body_required_value_updated_test.go index 67950e66..70fbbc3a 100644 --- a/checker/check_request_body_required_value_updated_test.go +++ b/checker/check_request_body_required_value_updated_test.go @@ -9,7 +9,7 @@ import ( "github.com/tufin/oasdiff/load" ) -// CL: changing request's body to required is breaking +// CL: changing request's body to required is breaking: request-body-became-required func TestRequestBodyBecameRequired(t *testing.T) { s1, err := open("../data/checker/request_body_became_required_base.yaml") require.NoError(t, err) @@ -30,9 +30,10 @@ func TestRequestBodyBecameRequired(t *testing.T) { Source: load.NewSource("../data/checker/request_body_became_required_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "request body became required", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: changing request's body to optional +// CL: changing request's body to optional: request-body-became-optional func TestRequestBodyBecameOptional(t *testing.T) { s1, err := open("../data/checker/request_body_became_optional_base.yaml") require.NoError(t, err) @@ -53,4 +54,5 @@ func TestRequestBodyBecameOptional(t *testing.T) { Source: load.NewSource("../data/checker/request_body_became_optional_base.yaml"), OperationId: "createOneGroup", }, errs[0]) + require.Equal(t, "request body became optional", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) } diff --git a/checker/check_request_discriminator_updated.go b/checker/check_request_discriminator_updated.go index bd011871..0a8f5b75 100644 --- a/checker/check_request_discriminator_updated.go +++ b/checker/check_request_discriminator_updated.go @@ -50,7 +50,7 @@ func RequestDiscriminatorUpdatedCheck(diffReport *diff.Diff, operationsSources * )) } - for _, mediaTypeDiff := range operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified { + for mediaType, mediaTypeDiff := range operationItem.RequestBodyDiff.ContentDiff.MediaTypeModified { if mediaTypeDiff.SchemaDiff == nil { continue } @@ -58,6 +58,7 @@ func RequestDiscriminatorUpdatedCheck(diffReport *diff.Diff, operationsSources * processDiscriminatorDiffForRequest( mediaTypeDiff.SchemaDiff.DiscriminatorDiff, "", + mediaType, appendResultItem) CheckModifiedPropertiesDiff( @@ -66,6 +67,7 @@ func RequestDiscriminatorUpdatedCheck(diffReport *diff.Diff, operationsSources * processDiscriminatorDiffForRequest( propertyDiff.DiscriminatorDiff, propertyFullName(propertyPath, propertyName), + mediaType, appendResultItem) }) @@ -78,6 +80,7 @@ func RequestDiscriminatorUpdatedCheck(diffReport *diff.Diff, operationsSources * func processDiscriminatorDiffForRequest( discriminatorDiff *diff.DiscriminatorDiff, propertyName string, + mediaType string, appendResultItem func(messageId string, a ...any)) { if discriminatorDiff == nil { @@ -91,17 +94,17 @@ func processDiscriminatorDiffForRequest( if discriminatorDiff.Added { if propertyName == "" { - appendResultItem(messageIdPrefix + "-added") + appendResultItem(messageIdPrefix+"-added", mediaType) } else { - appendResultItem(messageIdPrefix+"-added", propertyName) + appendResultItem(messageIdPrefix+"-added", propertyName, mediaType) } return } if discriminatorDiff.Deleted { if propertyName == "" { - appendResultItem(messageIdPrefix + "-removed") + appendResultItem(messageIdPrefix+"-removed", mediaType) } else { - appendResultItem(messageIdPrefix+"-removed", propertyName) + appendResultItem(messageIdPrefix+"-removed", propertyName, mediaType) } return } @@ -110,12 +113,14 @@ func processDiscriminatorDiffForRequest( if propertyName == "" { appendResultItem(messageIdPrefix+"-property-name-changed", discriminatorDiff.PropertyNameDiff.From, - discriminatorDiff.PropertyNameDiff.To) + discriminatorDiff.PropertyNameDiff.To, + mediaType) } else { appendResultItem(messageIdPrefix+"-property-name-changed", propertyName, discriminatorDiff.PropertyNameDiff.From, - discriminatorDiff.PropertyNameDiff.To) + discriminatorDiff.PropertyNameDiff.To, + mediaType) } } @@ -123,22 +128,26 @@ func processDiscriminatorDiffForRequest( if len(discriminatorDiff.MappingDiff.Added) > 0 { if propertyName == "" { appendResultItem(messageIdPrefix+"-mapping-added", - discriminatorDiff.MappingDiff.Added) + discriminatorDiff.MappingDiff.Added, + mediaType) } else { appendResultItem(messageIdPrefix+"-mapping-added", discriminatorDiff.MappingDiff.Added, - propertyName) + propertyName, + mediaType) } } if len(discriminatorDiff.MappingDiff.Deleted) > 0 { if propertyName == "" { appendResultItem(messageIdPrefix+"-mapping-deleted", - discriminatorDiff.MappingDiff.Deleted) + discriminatorDiff.MappingDiff.Deleted, + mediaType) } else { appendResultItem(messageIdPrefix+"-mapping-deleted", discriminatorDiff.MappingDiff.Deleted, - propertyName) + propertyName, + mediaType) } } @@ -147,13 +156,15 @@ func processDiscriminatorDiffForRequest( appendResultItem(messageIdPrefix+"-mapping-changed", k, v.From, - v.To) + v.To, + mediaType) } else { appendResultItem(messageIdPrefix+"-mapping-changed", k, v.From, v.To, - propertyName) + propertyName, + mediaType) } } diff --git a/checker/check_request_discriminator_updated_test.go b/checker/check_request_discriminator_updated_test.go index c75ac798..dc7276a3 100644 --- a/checker/check_request_discriminator_updated_test.go +++ b/checker/check_request_discriminator_updated_test.go @@ -10,7 +10,7 @@ import ( "github.com/tufin/oasdiff/utils" ) -// CL: adding discriminator to the request body or request body property +// CL: adding discriminator to the request body or request body property: request-body-discriminator-added, request-property-discriminator-added func TestRequestDiscriminatorUpdatedCheckAdded(t *testing.T) { s1, err := open("../data/checker/request_property_discriminator_added_base.yaml") require.NoError(t, err) @@ -23,27 +23,30 @@ func TestRequestDiscriminatorUpdatedCheckAdded(t *testing.T) { require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.RequestBodyDiscriminatorAddedId, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_discriminator_added_revision.yaml"), - OperationId: "updatePets", - }, - { - Id: checker.RequestPropertyDiscriminatorAddedId, - Args: []any{"/oneOf[#/components/schemas/Dog]/breed"}, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_discriminator_added_revision.yaml"), - OperationId: "updatePets", - }}, errs) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestBodyDiscriminatorAddedId, + Args: []any{"application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_discriminator_added_revision.yaml"), + OperationId: "updatePets", + }, errs[0]) + require.Equal(t, "added discriminator to media-type 'application/json' of request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyDiscriminatorAddedId, + Args: []any{"/oneOf[#/components/schemas/Dog]/breed", "application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_discriminator_added_revision.yaml"), + OperationId: "updatePets", + }, errs[1]) + require.Equal(t, "added discriminator to property '/oneOf[#/components/schemas/Dog]/breed' of media-type 'application/json' of request body", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } -// CL: removing discriminator from the request body or request body property +// CL: removing discriminator from the request body or request body property: request-body-discriminator-removed, request-property-discriminator-removed func TestRequestDiscriminatorUpdatedCheckRemoved(t *testing.T) { s1, err := open("../data/checker/request_property_discriminator_added_revision.yaml") require.NoError(t, err) @@ -56,24 +59,27 @@ func TestRequestDiscriminatorUpdatedCheckRemoved(t *testing.T) { require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.RequestBodyDiscriminatorRemovedId, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_discriminator_added_base.yaml"), - OperationId: "updatePets", - }, - { - Id: checker.RequestPropertyDiscriminatorRemovedId, - Args: []any{"/oneOf[#/components/schemas/Dog]/breed"}, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_discriminator_added_base.yaml"), - OperationId: "updatePets", - }}, errs) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestBodyDiscriminatorRemovedId, + Args: []any{"application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_discriminator_added_base.yaml"), + OperationId: "updatePets", + }, errs[0]) + require.Equal(t, "removed discriminator from media-type 'application/json' of request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyDiscriminatorRemovedId, + Args: []any{"/oneOf[#/components/schemas/Dog]/breed", "application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_discriminator_added_base.yaml"), + OperationId: "updatePets", + }, errs[1]) + require.Equal(t, "removed discriminator from property '/oneOf[#/components/schemas/Dog]/breed' of media-type 'application/json' of request body", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing discriminator propertyName in the request body or request body property @@ -89,25 +95,27 @@ func TestRequestDiscriminatorUpdatedCheckPropertyNameChanging(t *testing.T) { require.Len(t, errs, 2) - require.ElementsMatch(t, []checker.ApiChange{ - { - Id: checker.RequestBodyDiscriminatorPropertyNameChangedId, - Args: []any{"petType", "petType2"}, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_discriminator_added_property_name_changed.yaml"), - OperationId: "updatePets", - }, - { - Id: checker.RequestPropertyDiscriminatorPropertyNameChangedId, - Args: []any{"/oneOf[#/components/schemas/Dog]/breed", "name", "name2"}, - Level: checker.INFO, - Operation: "POST", - Path: "/pets", - Source: load.NewSource("../data/checker/request_property_discriminator_added_property_name_changed.yaml"), - OperationId: "updatePets", - }}, errs) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestBodyDiscriminatorPropertyNameChangedId, + Args: []any{"petType", "petType2", "application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_discriminator_added_property_name_changed.yaml"), + OperationId: "updatePets", + }, errs[0]) + require.Equal(t, "discriminator property name changed from 'petType' to 'petType2' for media-type 'application/json' of request body", errs[0].GetUncolorizedText(checker.NewDefaultLocalizer())) + + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyDiscriminatorPropertyNameChangedId, + Args: []any{"/oneOf[#/components/schemas/Dog]/breed", "name", "name2", "application/json"}, + Level: checker.INFO, + Operation: "POST", + Path: "/pets", + Source: load.NewSource("../data/checker/request_property_discriminator_added_property_name_changed.yaml"), + OperationId: "updatePets", + }, errs[1]) + require.Equal(t, "request discriminator property name changed from '/oneOf[#/components/schemas/Dog]/breed' to 'name' for 'name2' request property of media-type 'application/json'", errs[1].GetUncolorizedText(checker.NewDefaultLocalizer())) } // CL: changing discriminator mapping in the request body or request body property diff --git a/checker/generator/checks.go b/checker/generator/checks.go new file mode 100644 index 00000000..05ef3f24 --- /dev/null +++ b/checker/generator/checks.go @@ -0,0 +1,125 @@ +package generator + +import ( + "fmt" + "os" + "slices" + "strings" + + "github.com/iancoleman/strcase" +) + +func Generate() error { + out, err := os.Create("messages.yaml") + if err != nil { + return err + } + defer out.Close() + + // request + getSchemaValues([]string{"media-type", "request body"}, nil).generate(out) + getSchemaValues([]string{"property", "media-type", "request body"}, nil).generate(out) + getSchemaValues([]string{"request parameter"}, []bool{true}).generate(out) + + // response + getSchemaValues([]string{"media-type", "response"}, nil).generate(out) + getSchemaValues([]string{"property", "media-type", "response"}, nil).generate(out) + // getSchemaValues([]string{"request parameter"}, []bool{true}).generate(out) + + return nil +} + +func getSchemaValues(hierarchy []string, attributed []bool) valueSets { + return []valueSet{ + { + adjective: "value", + hierarchy: hierarchy, + attributed: attributed, + nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, + actions: []string{"set", "increase", "decrease"}, + }, + { + adjective: "", + hierarchy: hierarchy, + nouns: []string{"type/format"}, + actions: []string{"change", "generalize"}, + }, + { + adjective: "", + hierarchy: hierarchy, + nouns: []string{"anyOf", "oneOf", "allOf"}, + actions: []string{"add", "remove"}, + }, + } +} + +func generateId(hierarchy []string, noun, action string) string { + if before, _, found := strings.Cut(noun, "/"); found { + noun = before + } + return strcase.ToKebab(concat(hierarchy) + "-" + noun + "-" + conjugate(action)) +} + +func concat(list []string) string { + copy := slices.Clone(list) + slices.Reverse(copy) + return strings.Join(copy, "-") +} + +func generateMessage(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { + return standardizeSpaces(fmt.Sprintf("%s %s of %s was %s", noun, adjective, getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) +} + +func getHierarchyMessage(hierarchy []string, atttibuted []bool) string { + + copy := slices.Clone(hierarchy) + + if atttibuted != nil { + for i, s := range hierarchy { + if atttibuted[i] { + copy[i] = "%s " + s + } + } + } + + result := strings.Join(copy, " %s of ") + + if !isTopLevel(hierarchy[len(hierarchy)-1]) { + result += " %s" + } + + return result +} + +func isTopLevel(s string) bool { + return s == "request body" +} + +func standardizeSpaces(s string) string { + return strings.Join(strings.Fields(s), " ") +} + +func getActionMessage(action string) string { + if isUnary(action) { + return conjugate(action) + " to %s" + } + return conjugate(action) + " from %s to %s" +} + +func isUnary(action string) bool { + switch action { + case "set": + return true + } + return false +} + +func conjugate(verb string) string { + switch verb { + case "set": + return "set" + case "add": + return "added" + } + return verb + "d" +} diff --git a/checker/generator/checks_test.go b/checker/generator/checks_test.go new file mode 100644 index 00000000..877cb293 --- /dev/null +++ b/checker/generator/checks_test.go @@ -0,0 +1,12 @@ +package generator_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/tufin/oasdiff/checker/generator" +) + +func TestGenerator(t *testing.T) { + require.NoError(t, generator.Generate()) +} diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml new file mode 100644 index 00000000..81f46d93 --- /dev/null +++ b/checker/generator/messages.yaml @@ -0,0 +1,130 @@ +request-body-media-type-max-set: max value of media-type %s of request body was set to %s +request-body-media-type-max-increased: max value of media-type %s of request body was increased from %s to %s +request-body-media-type-max-decreased: max value of media-type %s of request body was decreased from %s to %s +request-body-media-type-max-length-set: maxLength value of media-type %s of request body was set to %s +request-body-media-type-max-length-increased: maxLength value of media-type %s of request body was increased from %s to %s +request-body-media-type-max-length-decreased: maxLength value of media-type %s of request body was decreased from %s to %s +request-body-media-type-min-set: min value of media-type %s of request body was set to %s +request-body-media-type-min-increased: min value of media-type %s of request body was increased from %s to %s +request-body-media-type-min-decreased: min value of media-type %s of request body was decreased from %s to %s +request-body-media-type-min-length-set: minLength value of media-type %s of request body was set to %s +request-body-media-type-min-length-increased: minLength value of media-type %s of request body was increased from %s to %s +request-body-media-type-min-length-decreased: minLength value of media-type %s of request body was decreased from %s to %s +request-body-media-type-min-items-set: minItems value of media-type %s of request body was set to %s +request-body-media-type-min-items-increased: minItems value of media-type %s of request body was increased from %s to %s +request-body-media-type-min-items-decreased: minItems value of media-type %s of request body was decreased from %s to %s +request-body-media-type-max-items-set: maxItems value of media-type %s of request body was set to %s +request-body-media-type-max-items-increased: maxItems value of media-type %s of request body was increased from %s to %s +request-body-media-type-max-items-decreased: maxItems value of media-type %s of request body was decreased from %s to %s +request-body-media-type-type-changed: type/format of media-type %s of request body was changed from %s to %s +request-body-media-type-type-generalized: type/format of media-type %s of request body was generalized from %s to %s +request-body-media-type-any-of-added: anyOf of media-type %s of request body was added from %s to %s +request-body-media-type-any-of-removed: anyOf of media-type %s of request body was removed from %s to %s +request-body-media-type-one-of-added: oneOf of media-type %s of request body was added from %s to %s +request-body-media-type-one-of-removed: oneOf of media-type %s of request body was removed from %s to %s +request-body-media-type-all-of-added: allOf of media-type %s of request body was added from %s to %s +request-body-media-type-all-of-removed: allOf of media-type %s of request body was removed from %s to %s +request-body-media-type-property-max-set: max value of property %s of media-type %s of request body was set to %s +request-body-media-type-property-max-increased: max value of property %s of media-type %s of request body was increased from %s to %s +request-body-media-type-property-max-decreased: max value of property %s of media-type %s of request body was decreased from %s to %s +request-body-media-type-property-max-length-set: maxLength value of property %s of media-type %s of request body was set to %s +request-body-media-type-property-max-length-increased: maxLength value of property %s of media-type %s of request body was increased from %s to %s +request-body-media-type-property-max-length-decreased: maxLength value of property %s of media-type %s of request body was decreased from %s to %s +request-body-media-type-property-min-set: min value of property %s of media-type %s of request body was set to %s +request-body-media-type-property-min-increased: min value of property %s of media-type %s of request body was increased from %s to %s +request-body-media-type-property-min-decreased: min value of property %s of media-type %s of request body was decreased from %s to %s +request-body-media-type-property-min-length-set: minLength value of property %s of media-type %s of request body was set to %s +request-body-media-type-property-min-length-increased: minLength value of property %s of media-type %s of request body was increased from %s to %s +request-body-media-type-property-min-length-decreased: minLength value of property %s of media-type %s of request body was decreased from %s to %s +request-body-media-type-property-min-items-set: minItems value of property %s of media-type %s of request body was set to %s +request-body-media-type-property-min-items-increased: minItems value of property %s of media-type %s of request body was increased from %s to %s +request-body-media-type-property-min-items-decreased: minItems value of property %s of media-type %s of request body was decreased from %s to %s +request-body-media-type-property-max-items-set: maxItems value of property %s of media-type %s of request body was set to %s +request-body-media-type-property-max-items-increased: maxItems value of property %s of media-type %s of request body was increased from %s to %s +request-body-media-type-property-max-items-decreased: maxItems value of property %s of media-type %s of request body was decreased from %s to %s +request-body-media-type-property-type-changed: type/format of property %s of media-type %s of request body was changed from %s to %s +request-body-media-type-property-type-generalized: type/format of property %s of media-type %s of request body was generalized from %s to %s +request-body-media-type-property-any-of-added: anyOf of property %s of media-type %s of request body was added from %s to %s +request-body-media-type-property-any-of-removed: anyOf of property %s of media-type %s of request body was removed from %s to %s +request-body-media-type-property-one-of-added: oneOf of property %s of media-type %s of request body was added from %s to %s +request-body-media-type-property-one-of-removed: oneOf of property %s of media-type %s of request body was removed from %s to %s +request-body-media-type-property-all-of-added: allOf of property %s of media-type %s of request body was added from %s to %s +request-body-media-type-property-all-of-removed: allOf of property %s of media-type %s of request body was removed from %s to %s +request-parameter-max-set: max value of %s request parameter %s was set to %s +request-parameter-max-increased: max value of %s request parameter %s was increased from %s to %s +request-parameter-max-decreased: max value of %s request parameter %s was decreased from %s to %s +request-parameter-max-length-set: maxLength value of %s request parameter %s was set to %s +request-parameter-max-length-increased: maxLength value of %s request parameter %s was increased from %s to %s +request-parameter-max-length-decreased: maxLength value of %s request parameter %s was decreased from %s to %s +request-parameter-min-set: min value of %s request parameter %s was set to %s +request-parameter-min-increased: min value of %s request parameter %s was increased from %s to %s +request-parameter-min-decreased: min value of %s request parameter %s was decreased from %s to %s +request-parameter-min-length-set: minLength value of %s request parameter %s was set to %s +request-parameter-min-length-increased: minLength value of %s request parameter %s was increased from %s to %s +request-parameter-min-length-decreased: minLength value of %s request parameter %s was decreased from %s to %s +request-parameter-min-items-set: minItems value of %s request parameter %s was set to %s +request-parameter-min-items-increased: minItems value of %s request parameter %s was increased from %s to %s +request-parameter-min-items-decreased: minItems value of %s request parameter %s was decreased from %s to %s +request-parameter-max-items-set: maxItems value of %s request parameter %s was set to %s +request-parameter-max-items-increased: maxItems value of %s request parameter %s was increased from %s to %s +request-parameter-max-items-decreased: maxItems value of %s request parameter %s was decreased from %s to %s +request-parameter-type-changed: type/format of request parameter %s was changed from %s to %s +request-parameter-type-generalized: type/format of request parameter %s was generalized from %s to %s +request-parameter-any-of-added: anyOf of request parameter %s was added from %s to %s +request-parameter-any-of-removed: anyOf of request parameter %s was removed from %s to %s +request-parameter-one-of-added: oneOf of request parameter %s was added from %s to %s +request-parameter-one-of-removed: oneOf of request parameter %s was removed from %s to %s +request-parameter-all-of-added: allOf of request parameter %s was added from %s to %s +request-parameter-all-of-removed: allOf of request parameter %s was removed from %s to %s +response-media-type-max-set: max value of media-type %s of response %s was set to %s +response-media-type-max-increased: max value of media-type %s of response %s was increased from %s to %s +response-media-type-max-decreased: max value of media-type %s of response %s was decreased from %s to %s +response-media-type-max-length-set: maxLength value of media-type %s of response %s was set to %s +response-media-type-max-length-increased: maxLength value of media-type %s of response %s was increased from %s to %s +response-media-type-max-length-decreased: maxLength value of media-type %s of response %s was decreased from %s to %s +response-media-type-min-set: min value of media-type %s of response %s was set to %s +response-media-type-min-increased: min value of media-type %s of response %s was increased from %s to %s +response-media-type-min-decreased: min value of media-type %s of response %s was decreased from %s to %s +response-media-type-min-length-set: minLength value of media-type %s of response %s was set to %s +response-media-type-min-length-increased: minLength value of media-type %s of response %s was increased from %s to %s +response-media-type-min-length-decreased: minLength value of media-type %s of response %s was decreased from %s to %s +response-media-type-min-items-set: minItems value of media-type %s of response %s was set to %s +response-media-type-min-items-increased: minItems value of media-type %s of response %s was increased from %s to %s +response-media-type-min-items-decreased: minItems value of media-type %s of response %s was decreased from %s to %s +response-media-type-max-items-set: maxItems value of media-type %s of response %s was set to %s +response-media-type-max-items-increased: maxItems value of media-type %s of response %s was increased from %s to %s +response-media-type-max-items-decreased: maxItems value of media-type %s of response %s was decreased from %s to %s +response-media-type-type-changed: type/format of media-type %s of response %s was changed from %s to %s +response-media-type-type-generalized: type/format of media-type %s of response %s was generalized from %s to %s +response-media-type-any-of-added: anyOf of media-type %s of response %s was added from %s to %s +response-media-type-any-of-removed: anyOf of media-type %s of response %s was removed from %s to %s +response-media-type-one-of-added: oneOf of media-type %s of response %s was added from %s to %s +response-media-type-one-of-removed: oneOf of media-type %s of response %s was removed from %s to %s +response-media-type-all-of-added: allOf of media-type %s of response %s was added from %s to %s +response-media-type-all-of-removed: allOf of media-type %s of response %s was removed from %s to %s +response-media-type-property-max-set: max value of property %s of media-type %s of response %s was set to %s +response-media-type-property-max-increased: max value of property %s of media-type %s of response %s was increased from %s to %s +response-media-type-property-max-decreased: max value of property %s of media-type %s of response %s was decreased from %s to %s +response-media-type-property-max-length-set: maxLength value of property %s of media-type %s of response %s was set to %s +response-media-type-property-max-length-increased: maxLength value of property %s of media-type %s of response %s was increased from %s to %s +response-media-type-property-max-length-decreased: maxLength value of property %s of media-type %s of response %s was decreased from %s to %s +response-media-type-property-min-set: min value of property %s of media-type %s of response %s was set to %s +response-media-type-property-min-increased: min value of property %s of media-type %s of response %s was increased from %s to %s +response-media-type-property-min-decreased: min value of property %s of media-type %s of response %s was decreased from %s to %s +response-media-type-property-min-length-set: minLength value of property %s of media-type %s of response %s was set to %s +response-media-type-property-min-length-increased: minLength value of property %s of media-type %s of response %s was increased from %s to %s +response-media-type-property-min-length-decreased: minLength value of property %s of media-type %s of response %s was decreased from %s to %s +response-media-type-property-min-items-set: minItems value of property %s of media-type %s of response %s was set to %s +response-media-type-property-min-items-increased: minItems value of property %s of media-type %s of response %s was increased from %s to %s +response-media-type-property-min-items-decreased: minItems value of property %s of media-type %s of response %s was decreased from %s to %s +response-media-type-property-max-items-set: maxItems value of property %s of media-type %s of response %s was set to %s +response-media-type-property-max-items-increased: maxItems value of property %s of media-type %s of response %s was increased from %s to %s +response-media-type-property-max-items-decreased: maxItems value of property %s of media-type %s of response %s was decreased from %s to %s +response-media-type-property-type-changed: type/format of property %s of media-type %s of response %s was changed from %s to %s +response-media-type-property-type-generalized: type/format of property %s of media-type %s of response %s was generalized from %s to %s +response-media-type-property-any-of-added: anyOf of property %s of media-type %s of response %s was added from %s to %s +response-media-type-property-any-of-removed: anyOf of property %s of media-type %s of response %s was removed from %s to %s +response-media-type-property-one-of-added: oneOf of property %s of media-type %s of response %s was added from %s to %s +response-media-type-property-one-of-removed: oneOf of property %s of media-type %s of response %s was removed from %s to %s +response-media-type-property-all-of-added: allOf of property %s of media-type %s of response %s was added from %s to %s +response-media-type-property-all-of-removed: allOf of property %s of media-type %s of response %s was removed from %s to %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go new file mode 100644 index 00000000..cc7fa8f0 --- /dev/null +++ b/checker/generator/value_set.go @@ -0,0 +1,30 @@ +package generator + +import ( + "fmt" + "io" +) + +type valueSets []valueSet + +func (vs valueSets) generate(out io.Writer) { + for _, v := range vs { + v.generate(out) + } +} + +type valueSet struct { + adjective string + hierarchy []string + attributed []bool + nouns []string + actions []string +} + +func (v valueSet) generate(out io.Writer) { + for _, noun := range v.nouns { + for _, action := range v.actions { + fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, v.attributed, noun, v.adjective, action))) + } + } +} diff --git a/checker/localizations/localizations.go b/checker/localizations/localizations.go index ea8bbd34..38cb602a 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 -// 2024-08-29 17:33:13.914404 +0300 IDT m=+0.005655876 +// 2024-08-29 23:38:04.760758 +0300 IDT m=+0.007109585 package localizations @@ -133,7 +133,7 @@ var localizations = map[string]string{ "en.messages.request-body-default-value-changed-description": "request body default value modified", "en.messages.request-body-default-value-removed": "default value %s was removed from media-type %s of request body", "en.messages.request-body-default-value-removed-description": "request body default value unset", - "en.messages.request-body-discriminator-added": "added request discriminator", + "en.messages.request-body-discriminator-added": "added discriminator to media-type %s of request body", "en.messages.request-body-discriminator-added-description": "request body discriminator added", "en.messages.request-body-discriminator-mapping-added": "added %s mapping keys to request discriminator", "en.messages.request-body-discriminator-mapping-added-description": "request body discriminator mapping added", @@ -141,9 +141,9 @@ var localizations = map[string]string{ "en.messages.request-body-discriminator-mapping-changed-description": "request body discriminator mapping changed", "en.messages.request-body-discriminator-mapping-deleted": "removed %s mapping keys from request discriminator", "en.messages.request-body-discriminator-mapping-deleted-description": "request body discriminator mapping deleted", - "en.messages.request-body-discriminator-property-name-changed": "request discriminator property name changed from %s to %s", + "en.messages.request-body-discriminator-property-name-changed": "discriminator property name of media-type %s of request body changed from %s to %s", "en.messages.request-body-discriminator-property-name-changed-description": "request body discriminator property name changed", - "en.messages.request-body-discriminator-removed": "removed request discriminator", + "en.messages.request-body-discriminator-removed": "removed discriminator from media-type %s of request body", "en.messages.request-body-discriminator-removed-description": "request body discriminator deleted", "en.messages.request-body-enum-value-removed": "enum value %s removed from media-type %s of request body", "en.messages.request-body-enum-value-removed-description": "request body enum value deleted", @@ -303,7 +303,7 @@ var localizations = map[string]string{ "en.messages.request-property-default-value-changed-description": "request property default value changed", "en.messages.request-property-default-value-removed": "%s request property default value %s was removed", "en.messages.request-property-default-value-removed-description": "request property default value unset", - "en.messages.request-property-discriminator-added": "added discriminator to %s request property", + "en.messages.request-property-discriminator-added": "added discriminator to property %s of media-type %s of request body", "en.messages.request-property-discriminator-added-description": "request property discriminator added", "en.messages.request-property-discriminator-mapping-added": "added %s discriminator mapping keys to %s request property", "en.messages.request-property-discriminator-mapping-added-description": "request property discriminator mapping added", @@ -311,9 +311,9 @@ var localizations = map[string]string{ "en.messages.request-property-discriminator-mapping-changed-description": "request property discriminator mapping changed", "en.messages.request-property-discriminator-mapping-deleted": "removed %s discriminator mapping keys from %s request property", "en.messages.request-property-discriminator-mapping-deleted-description": "request property discriminator mapping deleted", - "en.messages.request-property-discriminator-property-name-changed": "request discriminator property name changed for %s request property from %s to %s", + "en.messages.request-property-discriminator-property-name-changed": "discriminator property name of request property %s of media-type %s changed from %s to %s", "en.messages.request-property-discriminator-property-name-changed-description": "request property discriminator property name changed", - "en.messages.request-property-discriminator-removed": "removed discriminator from %s request property", + "en.messages.request-property-discriminator-removed": "removed discriminator from property %s of media-type %s of request body", "en.messages.request-property-discriminator-removed-description": "request property discriminator removed", "en.messages.request-property-enum-value-added": "added %s enum value to request property %s of media type %s", "en.messages.request-property-enum-value-added-description": "request property enum value added", diff --git a/checker/localizations_src/en/messages.yaml b/checker/localizations_src/en/messages.yaml index 3d46146a..1699c807 100644 --- a/checker/localizations_src/en/messages.yaml +++ b/checker/localizations_src/en/messages.yaml @@ -246,12 +246,12 @@ response-body-discriminator-mapping-deleted: removed %s mapping keys from respon response-property-discriminator-mapping-deleted: removed %s discriminator mapping keys from %s response property for response status %s response-body-discriminator-mapping-changed: mapped value for key %s changed from %s to %s from the response discriminator for response status %s response-property-discriminator-mapping-changed: mapped value for discriminator key %s changed from %s to %s for %s response property for response status %s -request-body-discriminator-added: added request discriminator -request-property-discriminator-added: added discriminator to %s request property -request-body-discriminator-removed: removed request discriminator -request-property-discriminator-removed: removed discriminator from %s request property -request-body-discriminator-property-name-changed: request discriminator property name changed from %s to %s -request-property-discriminator-property-name-changed: request discriminator property name changed for %s request property from %s to %s +request-body-discriminator-added: added discriminator to media-type %s of request body +request-property-discriminator-added: added discriminator to property %s of media-type %s of request body +request-body-discriminator-removed: removed discriminator from media-type %s of request body +request-property-discriminator-removed: removed discriminator from property %s of media-type %s of request body +request-body-discriminator-property-name-changed: discriminator property name of media-type %s of request body changed from %s to %s +request-property-discriminator-property-name-changed: discriminator property name of request property %s of media-type %s changed from %s to %s request-body-discriminator-mapping-added: added %s mapping keys to request discriminator request-property-discriminator-mapping-added: added %s discriminator mapping keys to %s request property request-body-discriminator-mapping-deleted: removed %s mapping keys from request discriminator diff --git a/go.mod b/go.mod index 135aec61..42b052f1 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( cloud.google.com/go v0.115.1 github.com/TwiN/go-color v1.4.1 github.com/getkin/kin-openapi v0.127.0 + github.com/iancoleman/strcase v0.3.0 github.com/oasdiff/telemetry v0.1.2 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 diff --git a/go.sum b/go.sum index 26b9c806..696bef36 100644 --- a/go.sum +++ b/go.sum @@ -26,6 +26,8 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/yaml v0.3.1 h1:f0+ZpmhfBSS4MhG+4HYseMdJhoeeopbSKbq5Rpeelso= diff --git a/scripts/get_tested_ids.sh b/scripts/get_tested_ids.sh index b23f6698..69c1ed3a 100755 --- a/scripts/get_tested_ids.sh +++ b/scripts/get_tested_ids.sh @@ -2,8 +2,10 @@ if [[ $1 == "lines" ]]; then grep -nRE --exclude-dir=localizations,localizations_src "// (CL|BC): .*: .*-.*" checker/* | cut -d":" -f1,2,5 -elif [[ $1 == "ids" ]]; then - grep -nRE --exclude-dir=localizations,localizations_src '// (CL|BC): .*: .*-.*' checker/* | cut -d: -f5 | tr , '\n' | awk '{$1=$1};1' | sort -u elif [[ $1 == "diff" ]]; then diff --side-by-side <(grep -nRE --exclude-dir=localizations,localizations_src '// (CL|BC): .*: .*-.*' checker/* | cut -d: -f5 | tr , '\n' | awk '{$1=$1};1' | sort -u) <(cat checker/localizations_src/en/messages.yaml | sed '/# warnings/q' | cut -d":" -f1 | sort -n) +elif [[ $1 == "all" ]]; then + cat checker/localizations_src/en/messages.yaml | sed '/# warnings/q' | cut -d":" -f1 | sort -n +else + grep -nRE --exclude-dir=localizations,localizations_src '// (CL|BC): .*: .*-.*' checker/* | cut -d: -f5 | tr , '\n' | awk '{$1=$1};1' | sort -u fi From 23cfc004ab60469036bcb359eb3d6f4d405f7283 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 30 Aug 2024 16:31:25 +0300 Subject: [PATCH 14/26] add anyOf/oneOf/allOf --- checker/generator/checks.go | 47 +++++--------------------- checker/generator/data.go | 49 +++++++++++++++++++++++++++ checker/generator/messages.yaml | 60 ++++++++++++++++----------------- checker/generator/value_set.go | 38 ++++++++++++++++++--- 4 files changed, 122 insertions(+), 72 deletions(-) create mode 100644 checker/generator/data.go diff --git a/checker/generator/checks.go b/checker/generator/checks.go index 05ef3f24..56c21d3e 100644 --- a/checker/generator/checks.go +++ b/checker/generator/checks.go @@ -1,7 +1,6 @@ package generator import ( - "fmt" "os" "slices" "strings" @@ -16,43 +15,11 @@ func Generate() error { } defer out.Close() - // request - getSchemaValues([]string{"media-type", "request body"}, nil).generate(out) - getSchemaValues([]string{"property", "media-type", "request body"}, nil).generate(out) - getSchemaValues([]string{"request parameter"}, []bool{true}).generate(out) - - // response - getSchemaValues([]string{"media-type", "response"}, nil).generate(out) - getSchemaValues([]string{"property", "media-type", "response"}, nil).generate(out) - // getSchemaValues([]string{"request parameter"}, []bool{true}).generate(out) + getAll().generate(out) return nil } -func getSchemaValues(hierarchy []string, attributed []bool) valueSets { - return []valueSet{ - { - adjective: "value", - hierarchy: hierarchy, - attributed: attributed, - nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, - actions: []string{"set", "increase", "decrease"}, - }, - { - adjective: "", - hierarchy: hierarchy, - nouns: []string{"type/format"}, - actions: []string{"change", "generalize"}, - }, - { - adjective: "", - hierarchy: hierarchy, - nouns: []string{"anyOf", "oneOf", "allOf"}, - actions: []string{"add", "remove"}, - }, - } -} - func generateId(hierarchy []string, noun, action string) string { if before, _, found := strings.Cut(noun, "/"); found { noun = before @@ -66,10 +33,6 @@ func concat(list []string) string { return strings.Join(copy, "-") } -func generateMessage(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { - return standardizeSpaces(fmt.Sprintf("%s %s of %s was %s", noun, adjective, getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) -} - func getHierarchyMessage(hierarchy []string, atttibuted []bool) string { copy := slices.Clone(hierarchy) @@ -123,3 +86,11 @@ func conjugate(verb string) string { } return verb + "d" } + +func getPreposition(action string) string { + switch action { + case "add": + return "to" + } + return "from" +} diff --git a/checker/generator/data.go b/checker/generator/data.go new file mode 100644 index 00000000..143496df --- /dev/null +++ b/checker/generator/data.go @@ -0,0 +1,49 @@ +package generator + +import "slices" + +func getAll() ValueSets { + return slices.Concat( + getRequest(), + getResponse(), + ) +} + +func getRequest() ValueSets { + return slices.Concat( + getSchema([]string{"media-type", "request body"}, nil), + getSchema([]string{"property", "media-type", "request body"}, nil), + getSchema([]string{"request parameter"}, []bool{true}), + ) +} + +func getResponse() ValueSets { + return slices.Concat( + getSchema([]string{"media-type", "response"}, nil), + getSchema([]string{"property", "media-type", "response"}, nil), + ) +} + +func getSchema(hierarchy []string, attributed []bool) ValueSets { + return ValueSets{ + ValueSetA{ + adjective: "value", + hierarchy: hierarchy, + attributed: attributed, + nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, + actions: []string{"set", "increase", "decrease"}, + }, + ValueSetA{ + adjective: "", + hierarchy: hierarchy, + nouns: []string{"type/format"}, + actions: []string{"change", "generalize"}, + }, + ValueSetB{ + adjective: "", + hierarchy: hierarchy, + nouns: []string{"anyOf", "oneOf", "allOf"}, + actions: []string{"add", "remove"}, + }, + } +} diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index 81f46d93..bfd545f8 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -18,12 +18,12 @@ request-body-media-type-max-items-increased: maxItems value of media-type %s of request-body-media-type-max-items-decreased: maxItems value of media-type %s of request body was decreased from %s to %s request-body-media-type-type-changed: type/format of media-type %s of request body was changed from %s to %s request-body-media-type-type-generalized: type/format of media-type %s of request body was generalized from %s to %s -request-body-media-type-any-of-added: anyOf of media-type %s of request body was added from %s to %s -request-body-media-type-any-of-removed: anyOf of media-type %s of request body was removed from %s to %s -request-body-media-type-one-of-added: oneOf of media-type %s of request body was added from %s to %s -request-body-media-type-one-of-removed: oneOf of media-type %s of request body was removed from %s to %s -request-body-media-type-all-of-added: allOf of media-type %s of request body was added from %s to %s -request-body-media-type-all-of-removed: allOf of media-type %s of request body was removed from %s to %s +request-body-media-type-any-of-added: added anyOf to media-type %s of request body +request-body-media-type-any-of-removed: removed anyOf from media-type %s of request body +request-body-media-type-one-of-added: added oneOf to media-type %s of request body +request-body-media-type-one-of-removed: removed oneOf from media-type %s of request body +request-body-media-type-all-of-added: added allOf to media-type %s of request body +request-body-media-type-all-of-removed: removed allOf from media-type %s of request body request-body-media-type-property-max-set: max value of property %s of media-type %s of request body was set to %s request-body-media-type-property-max-increased: max value of property %s of media-type %s of request body was increased from %s to %s request-body-media-type-property-max-decreased: max value of property %s of media-type %s of request body was decreased from %s to %s @@ -44,12 +44,12 @@ request-body-media-type-property-max-items-increased: maxItems value of property request-body-media-type-property-max-items-decreased: maxItems value of property %s of media-type %s of request body was decreased from %s to %s request-body-media-type-property-type-changed: type/format of property %s of media-type %s of request body was changed from %s to %s request-body-media-type-property-type-generalized: type/format of property %s of media-type %s of request body was generalized from %s to %s -request-body-media-type-property-any-of-added: anyOf of property %s of media-type %s of request body was added from %s to %s -request-body-media-type-property-any-of-removed: anyOf of property %s of media-type %s of request body was removed from %s to %s -request-body-media-type-property-one-of-added: oneOf of property %s of media-type %s of request body was added from %s to %s -request-body-media-type-property-one-of-removed: oneOf of property %s of media-type %s of request body was removed from %s to %s -request-body-media-type-property-all-of-added: allOf of property %s of media-type %s of request body was added from %s to %s -request-body-media-type-property-all-of-removed: allOf of property %s of media-type %s of request body was removed from %s to %s +request-body-media-type-property-any-of-added: added anyOf to property %s of media-type %s of request body +request-body-media-type-property-any-of-removed: removed anyOf from property %s of media-type %s of request body +request-body-media-type-property-one-of-added: added oneOf to property %s of media-type %s of request body +request-body-media-type-property-one-of-removed: removed oneOf from property %s of media-type %s of request body +request-body-media-type-property-all-of-added: added allOf to property %s of media-type %s of request body +request-body-media-type-property-all-of-removed: removed allOf from property %s of media-type %s of request body request-parameter-max-set: max value of %s request parameter %s was set to %s request-parameter-max-increased: max value of %s request parameter %s was increased from %s to %s request-parameter-max-decreased: max value of %s request parameter %s was decreased from %s to %s @@ -70,12 +70,12 @@ request-parameter-max-items-increased: maxItems value of %s request parameter %s request-parameter-max-items-decreased: maxItems value of %s request parameter %s was decreased from %s to %s request-parameter-type-changed: type/format of request parameter %s was changed from %s to %s request-parameter-type-generalized: type/format of request parameter %s was generalized from %s to %s -request-parameter-any-of-added: anyOf of request parameter %s was added from %s to %s -request-parameter-any-of-removed: anyOf of request parameter %s was removed from %s to %s -request-parameter-one-of-added: oneOf of request parameter %s was added from %s to %s -request-parameter-one-of-removed: oneOf of request parameter %s was removed from %s to %s -request-parameter-all-of-added: allOf of request parameter %s was added from %s to %s -request-parameter-all-of-removed: allOf of request parameter %s was removed from %s to %s +request-parameter-any-of-added: added anyOf to request parameter %s +request-parameter-any-of-removed: removed anyOf from request parameter %s +request-parameter-one-of-added: added oneOf to request parameter %s +request-parameter-one-of-removed: removed oneOf from request parameter %s +request-parameter-all-of-added: added allOf to request parameter %s +request-parameter-all-of-removed: removed allOf from request parameter %s response-media-type-max-set: max value of media-type %s of response %s was set to %s response-media-type-max-increased: max value of media-type %s of response %s was increased from %s to %s response-media-type-max-decreased: max value of media-type %s of response %s was decreased from %s to %s @@ -96,12 +96,12 @@ response-media-type-max-items-increased: maxItems value of media-type %s of resp response-media-type-max-items-decreased: maxItems value of media-type %s of response %s was decreased from %s to %s response-media-type-type-changed: type/format of media-type %s of response %s was changed from %s to %s response-media-type-type-generalized: type/format of media-type %s of response %s was generalized from %s to %s -response-media-type-any-of-added: anyOf of media-type %s of response %s was added from %s to %s -response-media-type-any-of-removed: anyOf of media-type %s of response %s was removed from %s to %s -response-media-type-one-of-added: oneOf of media-type %s of response %s was added from %s to %s -response-media-type-one-of-removed: oneOf of media-type %s of response %s was removed from %s to %s -response-media-type-all-of-added: allOf of media-type %s of response %s was added from %s to %s -response-media-type-all-of-removed: allOf of media-type %s of response %s was removed from %s to %s +response-media-type-any-of-added: added anyOf to media-type %s of response %s +response-media-type-any-of-removed: removed anyOf from media-type %s of response %s +response-media-type-one-of-added: added oneOf to media-type %s of response %s +response-media-type-one-of-removed: removed oneOf from media-type %s of response %s +response-media-type-all-of-added: added allOf to media-type %s of response %s +response-media-type-all-of-removed: removed allOf from media-type %s of response %s response-media-type-property-max-set: max value of property %s of media-type %s of response %s was set to %s response-media-type-property-max-increased: max value of property %s of media-type %s of response %s was increased from %s to %s response-media-type-property-max-decreased: max value of property %s of media-type %s of response %s was decreased from %s to %s @@ -122,9 +122,9 @@ response-media-type-property-max-items-increased: maxItems value of property %s response-media-type-property-max-items-decreased: maxItems value of property %s of media-type %s of response %s was decreased from %s to %s response-media-type-property-type-changed: type/format of property %s of media-type %s of response %s was changed from %s to %s response-media-type-property-type-generalized: type/format of property %s of media-type %s of response %s was generalized from %s to %s -response-media-type-property-any-of-added: anyOf of property %s of media-type %s of response %s was added from %s to %s -response-media-type-property-any-of-removed: anyOf of property %s of media-type %s of response %s was removed from %s to %s -response-media-type-property-one-of-added: oneOf of property %s of media-type %s of response %s was added from %s to %s -response-media-type-property-one-of-removed: oneOf of property %s of media-type %s of response %s was removed from %s to %s -response-media-type-property-all-of-added: allOf of property %s of media-type %s of response %s was added from %s to %s -response-media-type-property-all-of-removed: allOf of property %s of media-type %s of response %s was removed from %s to %s +response-media-type-property-any-of-added: added anyOf to property %s of media-type %s of response %s +response-media-type-property-any-of-removed: removed anyOf from property %s of media-type %s of response %s +response-media-type-property-one-of-added: added oneOf to property %s of media-type %s of response %s +response-media-type-property-one-of-removed: removed oneOf from property %s of media-type %s of response %s +response-media-type-property-all-of-added: added allOf to property %s of media-type %s of response %s +response-media-type-property-all-of-removed: removed allOf from property %s of media-type %s of response %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index cc7fa8f0..741e3540 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -5,15 +5,41 @@ import ( "io" ) -type valueSets []valueSet +type ValueSets []ValueSet -func (vs valueSets) generate(out io.Writer) { +func (vs ValueSets) generate(out io.Writer) { for _, v := range vs { v.generate(out) } } -type valueSet struct { +type ValueSet interface { + generate(out io.Writer) +} + +type ValueSetA struct { + adjective string + hierarchy []string + attributed []bool + nouns []string + actions []string +} + +// ValueSetA messages start with the noun +func (v ValueSetA) generate(out io.Writer) { + generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { + return standardizeSpaces(fmt.Sprintf("%s %s of %s was %s", noun, adjective, getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) + } + + for _, noun := range v.nouns { + for _, action := range v.actions { + fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, v.attributed, noun, v.adjective, action))) + } + } +} + +// ValueSetB messages start with the action +type ValueSetB struct { adjective string hierarchy []string attributed []bool @@ -21,7 +47,11 @@ type valueSet struct { actions []string } -func (v valueSet) generate(out io.Writer) { +func (v ValueSetB) generate(out io.Writer) { + generateMessage := func(hierarchy []string, atttibuted []bool, noun, _, action string) string { + return standardizeSpaces(fmt.Sprintf("%s %s %s %s", conjugate(action), noun, getPreposition(action), getHierarchyMessage(hierarchy, atttibuted))) + } + for _, noun := range v.nouns { for _, action := range v.actions { fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, v.attributed, noun, v.adjective, action))) From 9d25bdbcf36295022209ef058dc79a0113003529 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 30 Aug 2024 16:58:14 +0300 Subject: [PATCH 15/26] fixed xOf --- checker/generator/data.go | 24 ++++++++-- checker/generator/messages.yaml | 85 +++++++++++++++++++++------------ checker/generator/value_set.go | 2 +- 3 files changed, 77 insertions(+), 34 deletions(-) diff --git a/checker/generator/data.go b/checker/generator/data.go index 143496df..e826fffa 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -34,15 +34,33 @@ func getSchema(hierarchy []string, attributed []bool) ValueSets { actions: []string{"set", "increase", "decrease"}, }, ValueSetA{ - adjective: "", hierarchy: hierarchy, nouns: []string{"type/format"}, actions: []string{"change", "generalize"}, }, + ValueSetA{ + hierarchy: hierarchy, + nouns: []string{"discriminator property name"}, + actions: []string{"change"}, + }, + ValueSetB{ + hierarchy: append([]string{"anyOf list"}, hierarchy...), + nouns: []string{"%s"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + hierarchy: append([]string{"oneOf list"}, hierarchy...), + nouns: []string{"%s"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + hierarchy: append([]string{"allOf list"}, hierarchy...), + nouns: []string{"%s"}, + actions: []string{"add", "remove"}, + }, ValueSetB{ - adjective: "", hierarchy: hierarchy, - nouns: []string{"anyOf", "oneOf", "allOf"}, + nouns: []string{"discriminator", "mapping keys"}, actions: []string{"add", "remove"}, }, } diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index bfd545f8..e99bf97f 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -18,12 +18,17 @@ request-body-media-type-max-items-increased: maxItems value of media-type %s of request-body-media-type-max-items-decreased: maxItems value of media-type %s of request body was decreased from %s to %s request-body-media-type-type-changed: type/format of media-type %s of request body was changed from %s to %s request-body-media-type-type-generalized: type/format of media-type %s of request body was generalized from %s to %s -request-body-media-type-any-of-added: added anyOf to media-type %s of request body -request-body-media-type-any-of-removed: removed anyOf from media-type %s of request body -request-body-media-type-one-of-added: added oneOf to media-type %s of request body -request-body-media-type-one-of-removed: removed oneOf from media-type %s of request body -request-body-media-type-all-of-added: added allOf to media-type %s of request body -request-body-media-type-all-of-removed: removed allOf from media-type %s of request body +request-body-media-type-discriminator-property-name-changed: discriminator property name of media-type %s of request body was changed from %s to %s +request-body-media-type-any-of-list-%s-added: added %s to anyOf list %s of media-type %s of request body +request-body-media-type-any-of-list-%s-removed: removed %s from anyOf list %s of media-type %s of request body +request-body-media-type-one-of-list-%s-added: added %s to oneOf list %s of media-type %s of request body +request-body-media-type-one-of-list-%s-removed: removed %s from oneOf list %s of media-type %s of request body +request-body-media-type-all-of-list-%s-added: added %s to allOf list %s of media-type %s of request body +request-body-media-type-all-of-list-%s-removed: removed %s from allOf list %s of media-type %s of request body +request-body-media-type-discriminator-added: added discriminator to media-type %s of request body +request-body-media-type-discriminator-removed: removed discriminator from media-type %s of request body +request-body-media-type-mapping-keys-added: added mapping keys to media-type %s of request body +request-body-media-type-mapping-keys-removed: removed mapping keys from media-type %s of request body request-body-media-type-property-max-set: max value of property %s of media-type %s of request body was set to %s request-body-media-type-property-max-increased: max value of property %s of media-type %s of request body was increased from %s to %s request-body-media-type-property-max-decreased: max value of property %s of media-type %s of request body was decreased from %s to %s @@ -44,12 +49,17 @@ request-body-media-type-property-max-items-increased: maxItems value of property request-body-media-type-property-max-items-decreased: maxItems value of property %s of media-type %s of request body was decreased from %s to %s request-body-media-type-property-type-changed: type/format of property %s of media-type %s of request body was changed from %s to %s request-body-media-type-property-type-generalized: type/format of property %s of media-type %s of request body was generalized from %s to %s -request-body-media-type-property-any-of-added: added anyOf to property %s of media-type %s of request body -request-body-media-type-property-any-of-removed: removed anyOf from property %s of media-type %s of request body -request-body-media-type-property-one-of-added: added oneOf to property %s of media-type %s of request body -request-body-media-type-property-one-of-removed: removed oneOf from property %s of media-type %s of request body -request-body-media-type-property-all-of-added: added allOf to property %s of media-type %s of request body -request-body-media-type-property-all-of-removed: removed allOf from property %s of media-type %s of request body +request-body-media-type-property-discriminator-property-name-changed: discriminator property name of property %s of media-type %s of request body was changed from %s to %s +request-body-media-type-property-any-of-list-%s-added: added %s to anyOf list %s of property %s of media-type %s of request body +request-body-media-type-property-any-of-list-%s-removed: removed %s from anyOf list %s of property %s of media-type %s of request body +request-body-media-type-property-one-of-list-%s-added: added %s to oneOf list %s of property %s of media-type %s of request body +request-body-media-type-property-one-of-list-%s-removed: removed %s from oneOf list %s of property %s of media-type %s of request body +request-body-media-type-property-all-of-list-%s-added: added %s to allOf list %s of property %s of media-type %s of request body +request-body-media-type-property-all-of-list-%s-removed: removed %s from allOf list %s of property %s of media-type %s of request body +request-body-media-type-property-discriminator-added: added discriminator to property %s of media-type %s of request body +request-body-media-type-property-discriminator-removed: removed discriminator from property %s of media-type %s of request body +request-body-media-type-property-mapping-keys-added: added mapping keys to property %s of media-type %s of request body +request-body-media-type-property-mapping-keys-removed: removed mapping keys from property %s of media-type %s of request body request-parameter-max-set: max value of %s request parameter %s was set to %s request-parameter-max-increased: max value of %s request parameter %s was increased from %s to %s request-parameter-max-decreased: max value of %s request parameter %s was decreased from %s to %s @@ -70,12 +80,17 @@ request-parameter-max-items-increased: maxItems value of %s request parameter %s request-parameter-max-items-decreased: maxItems value of %s request parameter %s was decreased from %s to %s request-parameter-type-changed: type/format of request parameter %s was changed from %s to %s request-parameter-type-generalized: type/format of request parameter %s was generalized from %s to %s -request-parameter-any-of-added: added anyOf to request parameter %s -request-parameter-any-of-removed: removed anyOf from request parameter %s -request-parameter-one-of-added: added oneOf to request parameter %s -request-parameter-one-of-removed: removed oneOf from request parameter %s -request-parameter-all-of-added: added allOf to request parameter %s -request-parameter-all-of-removed: removed allOf from request parameter %s +request-parameter-discriminator-property-name-changed: discriminator property name of request parameter %s was changed from %s to %s +request-parameter-any-of-list-%s-added: added %s to anyOf list %s of request parameter %s +request-parameter-any-of-list-%s-removed: removed %s from anyOf list %s of request parameter %s +request-parameter-one-of-list-%s-added: added %s to oneOf list %s of request parameter %s +request-parameter-one-of-list-%s-removed: removed %s from oneOf list %s of request parameter %s +request-parameter-all-of-list-%s-added: added %s to allOf list %s of request parameter %s +request-parameter-all-of-list-%s-removed: removed %s from allOf list %s of request parameter %s +request-parameter-discriminator-added: added discriminator to request parameter %s +request-parameter-discriminator-removed: removed discriminator from request parameter %s +request-parameter-mapping-keys-added: added mapping keys to request parameter %s +request-parameter-mapping-keys-removed: removed mapping keys from request parameter %s response-media-type-max-set: max value of media-type %s of response %s was set to %s response-media-type-max-increased: max value of media-type %s of response %s was increased from %s to %s response-media-type-max-decreased: max value of media-type %s of response %s was decreased from %s to %s @@ -96,12 +111,17 @@ response-media-type-max-items-increased: maxItems value of media-type %s of resp response-media-type-max-items-decreased: maxItems value of media-type %s of response %s was decreased from %s to %s response-media-type-type-changed: type/format of media-type %s of response %s was changed from %s to %s response-media-type-type-generalized: type/format of media-type %s of response %s was generalized from %s to %s -response-media-type-any-of-added: added anyOf to media-type %s of response %s -response-media-type-any-of-removed: removed anyOf from media-type %s of response %s -response-media-type-one-of-added: added oneOf to media-type %s of response %s -response-media-type-one-of-removed: removed oneOf from media-type %s of response %s -response-media-type-all-of-added: added allOf to media-type %s of response %s -response-media-type-all-of-removed: removed allOf from media-type %s of response %s +response-media-type-discriminator-property-name-changed: discriminator property name of media-type %s of response %s was changed from %s to %s +response-media-type-any-of-list-%s-added: added %s to anyOf list %s of media-type %s of response %s +response-media-type-any-of-list-%s-removed: removed %s from anyOf list %s of media-type %s of response %s +response-media-type-one-of-list-%s-added: added %s to oneOf list %s of media-type %s of response %s +response-media-type-one-of-list-%s-removed: removed %s from oneOf list %s of media-type %s of response %s +response-media-type-all-of-list-%s-added: added %s to allOf list %s of media-type %s of response %s +response-media-type-all-of-list-%s-removed: removed %s from allOf list %s of media-type %s of response %s +response-media-type-discriminator-added: added discriminator to media-type %s of response %s +response-media-type-discriminator-removed: removed discriminator from media-type %s of response %s +response-media-type-mapping-keys-added: added mapping keys to media-type %s of response %s +response-media-type-mapping-keys-removed: removed mapping keys from media-type %s of response %s response-media-type-property-max-set: max value of property %s of media-type %s of response %s was set to %s response-media-type-property-max-increased: max value of property %s of media-type %s of response %s was increased from %s to %s response-media-type-property-max-decreased: max value of property %s of media-type %s of response %s was decreased from %s to %s @@ -122,9 +142,14 @@ response-media-type-property-max-items-increased: maxItems value of property %s response-media-type-property-max-items-decreased: maxItems value of property %s of media-type %s of response %s was decreased from %s to %s response-media-type-property-type-changed: type/format of property %s of media-type %s of response %s was changed from %s to %s response-media-type-property-type-generalized: type/format of property %s of media-type %s of response %s was generalized from %s to %s -response-media-type-property-any-of-added: added anyOf to property %s of media-type %s of response %s -response-media-type-property-any-of-removed: removed anyOf from property %s of media-type %s of response %s -response-media-type-property-one-of-added: added oneOf to property %s of media-type %s of response %s -response-media-type-property-one-of-removed: removed oneOf from property %s of media-type %s of response %s -response-media-type-property-all-of-added: added allOf to property %s of media-type %s of response %s -response-media-type-property-all-of-removed: removed allOf from property %s of media-type %s of response %s +response-media-type-property-discriminator-property-name-changed: discriminator property name of property %s of media-type %s of response %s was changed from %s to %s +response-media-type-property-any-of-list-%s-added: added %s to anyOf list %s of property %s of media-type %s of response %s +response-media-type-property-any-of-list-%s-removed: removed %s from anyOf list %s of property %s of media-type %s of response %s +response-media-type-property-one-of-list-%s-added: added %s to oneOf list %s of property %s of media-type %s of response %s +response-media-type-property-one-of-list-%s-removed: removed %s from oneOf list %s of property %s of media-type %s of response %s +response-media-type-property-all-of-list-%s-added: added %s to allOf list %s of property %s of media-type %s of response %s +response-media-type-property-all-of-list-%s-removed: removed %s from allOf list %s of property %s of media-type %s of response %s +response-media-type-property-discriminator-added: added discriminator to property %s of media-type %s of response %s +response-media-type-property-discriminator-removed: removed discriminator from property %s of media-type %s of response %s +response-media-type-property-mapping-keys-added: added mapping keys to property %s of media-type %s of response %s +response-media-type-property-mapping-keys-removed: removed mapping keys from property %s of media-type %s of response %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index 741e3540..97ec96e2 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -17,6 +17,7 @@ type ValueSet interface { generate(out io.Writer) } +// ValueSetA messages start with the noun type ValueSetA struct { adjective string hierarchy []string @@ -25,7 +26,6 @@ type ValueSetA struct { actions []string } -// ValueSetA messages start with the noun func (v ValueSetA) generate(out io.Writer) { generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { return standardizeSpaces(fmt.Sprintf("%s %s of %s was %s", noun, adjective, getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) From a238c4bdf6fc9c05a4578bd68879a3495b57e6c7 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 30 Aug 2024 21:41:40 +0300 Subject: [PATCH 16/26] added patterns --- checker/generator/checks.go | 7 ++ checker/generator/data.go | 58 +++++++++++---- checker/generator/messages.yaml | 125 +++++++++++++++++++------------- checker/generator/value_set.go | 42 ++++++----- 4 files changed, 147 insertions(+), 85 deletions(-) diff --git a/checker/generator/checks.go b/checker/generator/checks.go index 56c21d3e..1650afb1 100644 --- a/checker/generator/checks.go +++ b/checker/generator/checks.go @@ -94,3 +94,10 @@ func getPreposition(action string) string { } return "from" } + +func addAttribute(noun, adjective string, adjectiveType AdjectiveType) string { + if adjectiveType == ATTRIBUTIVE { + return adjective + " " + noun + } + return noun + " " + adjective +} diff --git a/checker/generator/data.go b/checker/generator/data.go index e826fffa..d9c150d4 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -27,11 +27,12 @@ func getResponse() ValueSets { func getSchema(hierarchy []string, attributed []bool) ValueSets { return ValueSets{ ValueSetA{ - adjective: "value", - hierarchy: hierarchy, - attributed: attributed, - nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, - actions: []string{"set", "increase", "decrease"}, + adjective: "value", + adjectiveType: PREDICATIVE, + hierarchy: hierarchy, + attributed: attributed, + nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, + actions: []string{"set", "increase", "decrease"}, }, ValueSetA{ hierarchy: hierarchy, @@ -43,25 +44,50 @@ func getSchema(hierarchy []string, attributed []bool) ValueSets { nouns: []string{"discriminator property name"}, actions: []string{"change"}, }, + ValueSetA{ + hierarchy: hierarchy, + nouns: []string{"pattern"}, + actions: []string{"change"}, + }, ValueSetB{ - hierarchy: append([]string{"anyOf list"}, hierarchy...), - nouns: []string{"%s"}, - actions: []string{"add", "remove"}, + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: hierarchy, + nouns: []string{"pattern"}, + actions: []string{"add", "remove"}, }, ValueSetB{ - hierarchy: append([]string{"oneOf list"}, hierarchy...), - nouns: []string{"%s"}, + hierarchy: hierarchy, + nouns: []string{"default value"}, actions: []string{"add", "remove"}, }, ValueSetB{ - hierarchy: append([]string{"allOf list"}, hierarchy...), - nouns: []string{"%s"}, - actions: []string{"add", "remove"}, + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: append([]string{"anyOf list"}, hierarchy...), + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, }, ValueSetB{ - hierarchy: hierarchy, - nouns: []string{"discriminator", "mapping keys"}, - actions: []string{"add", "remove"}, + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: append([]string{"oneOf list"}, hierarchy...), + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: append([]string{"allOf list"}, hierarchy...), + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: hierarchy, + nouns: []string{"discriminator", "mapping keys"}, + actions: []string{"add", "remove"}, }, } } diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index e99bf97f..aefefe6f 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -19,16 +19,21 @@ request-body-media-type-max-items-decreased: maxItems value of media-type %s of request-body-media-type-type-changed: type/format of media-type %s of request body was changed from %s to %s request-body-media-type-type-generalized: type/format of media-type %s of request body was generalized from %s to %s request-body-media-type-discriminator-property-name-changed: discriminator property name of media-type %s of request body was changed from %s to %s -request-body-media-type-any-of-list-%s-added: added %s to anyOf list %s of media-type %s of request body -request-body-media-type-any-of-list-%s-removed: removed %s from anyOf list %s of media-type %s of request body -request-body-media-type-one-of-list-%s-added: added %s to oneOf list %s of media-type %s of request body -request-body-media-type-one-of-list-%s-removed: removed %s from oneOf list %s of media-type %s of request body -request-body-media-type-all-of-list-%s-added: added %s to allOf list %s of media-type %s of request body -request-body-media-type-all-of-list-%s-removed: removed %s from allOf list %s of media-type %s of request body -request-body-media-type-discriminator-added: added discriminator to media-type %s of request body -request-body-media-type-discriminator-removed: removed discriminator from media-type %s of request body -request-body-media-type-mapping-keys-added: added mapping keys to media-type %s of request body -request-body-media-type-mapping-keys-removed: removed mapping keys from media-type %s of request body +request-body-media-type-pattern-changed: pattern of media-type %s of request body was changed from %s to %s +request-body-media-type-pattern-added: added pattern %s to media-type %s of request body +request-body-media-type-pattern-removed: removed pattern %s from media-type %s of request body +request-body-media-type-default-value-added: added default value to media-type %s of request body +request-body-media-type-default-value-removed: removed default value from media-type %s of request body +request-body-media-type-any-of-list-schema-added: added schema %s to anyOf list %s of media-type %s of request body +request-body-media-type-any-of-list-schema-removed: removed schema %s from anyOf list %s of media-type %s of request body +request-body-media-type-one-of-list-schema-added: added schema %s to oneOf list %s of media-type %s of request body +request-body-media-type-one-of-list-schema-removed: removed schema %s from oneOf list %s of media-type %s of request body +request-body-media-type-all-of-list-schema-added: added schema %s to allOf list %s of media-type %s of request body +request-body-media-type-all-of-list-schema-removed: removed schema %s from allOf list %s of media-type %s of request body +request-body-media-type-discriminator-added: added discriminator %s to media-type %s of request body +request-body-media-type-discriminator-removed: removed discriminator %s from media-type %s of request body +request-body-media-type-mapping-keys-added: added mapping keys %s to media-type %s of request body +request-body-media-type-mapping-keys-removed: removed mapping keys %s from media-type %s of request body request-body-media-type-property-max-set: max value of property %s of media-type %s of request body was set to %s request-body-media-type-property-max-increased: max value of property %s of media-type %s of request body was increased from %s to %s request-body-media-type-property-max-decreased: max value of property %s of media-type %s of request body was decreased from %s to %s @@ -50,16 +55,21 @@ request-body-media-type-property-max-items-decreased: maxItems value of property request-body-media-type-property-type-changed: type/format of property %s of media-type %s of request body was changed from %s to %s request-body-media-type-property-type-generalized: type/format of property %s of media-type %s of request body was generalized from %s to %s request-body-media-type-property-discriminator-property-name-changed: discriminator property name of property %s of media-type %s of request body was changed from %s to %s -request-body-media-type-property-any-of-list-%s-added: added %s to anyOf list %s of property %s of media-type %s of request body -request-body-media-type-property-any-of-list-%s-removed: removed %s from anyOf list %s of property %s of media-type %s of request body -request-body-media-type-property-one-of-list-%s-added: added %s to oneOf list %s of property %s of media-type %s of request body -request-body-media-type-property-one-of-list-%s-removed: removed %s from oneOf list %s of property %s of media-type %s of request body -request-body-media-type-property-all-of-list-%s-added: added %s to allOf list %s of property %s of media-type %s of request body -request-body-media-type-property-all-of-list-%s-removed: removed %s from allOf list %s of property %s of media-type %s of request body -request-body-media-type-property-discriminator-added: added discriminator to property %s of media-type %s of request body -request-body-media-type-property-discriminator-removed: removed discriminator from property %s of media-type %s of request body -request-body-media-type-property-mapping-keys-added: added mapping keys to property %s of media-type %s of request body -request-body-media-type-property-mapping-keys-removed: removed mapping keys from property %s of media-type %s of request body +request-body-media-type-property-pattern-changed: pattern of property %s of media-type %s of request body was changed from %s to %s +request-body-media-type-property-pattern-added: added pattern %s to property %s of media-type %s of request body +request-body-media-type-property-pattern-removed: removed pattern %s from property %s of media-type %s of request body +request-body-media-type-property-default-value-added: added default value to property %s of media-type %s of request body +request-body-media-type-property-default-value-removed: removed default value from property %s of media-type %s of request body +request-body-media-type-property-any-of-list-schema-added: added schema %s to anyOf list %s of property %s of media-type %s of request body +request-body-media-type-property-any-of-list-schema-removed: removed schema %s from anyOf list %s of property %s of media-type %s of request body +request-body-media-type-property-one-of-list-schema-added: added schema %s to oneOf list %s of property %s of media-type %s of request body +request-body-media-type-property-one-of-list-schema-removed: removed schema %s from oneOf list %s of property %s of media-type %s of request body +request-body-media-type-property-all-of-list-schema-added: added schema %s to allOf list %s of property %s of media-type %s of request body +request-body-media-type-property-all-of-list-schema-removed: removed schema %s from allOf list %s of property %s of media-type %s of request body +request-body-media-type-property-discriminator-added: added discriminator %s to property %s of media-type %s of request body +request-body-media-type-property-discriminator-removed: removed discriminator %s from property %s of media-type %s of request body +request-body-media-type-property-mapping-keys-added: added mapping keys %s to property %s of media-type %s of request body +request-body-media-type-property-mapping-keys-removed: removed mapping keys %s from property %s of media-type %s of request body request-parameter-max-set: max value of %s request parameter %s was set to %s request-parameter-max-increased: max value of %s request parameter %s was increased from %s to %s request-parameter-max-decreased: max value of %s request parameter %s was decreased from %s to %s @@ -81,16 +91,21 @@ request-parameter-max-items-decreased: maxItems value of %s request parameter %s request-parameter-type-changed: type/format of request parameter %s was changed from %s to %s request-parameter-type-generalized: type/format of request parameter %s was generalized from %s to %s request-parameter-discriminator-property-name-changed: discriminator property name of request parameter %s was changed from %s to %s -request-parameter-any-of-list-%s-added: added %s to anyOf list %s of request parameter %s -request-parameter-any-of-list-%s-removed: removed %s from anyOf list %s of request parameter %s -request-parameter-one-of-list-%s-added: added %s to oneOf list %s of request parameter %s -request-parameter-one-of-list-%s-removed: removed %s from oneOf list %s of request parameter %s -request-parameter-all-of-list-%s-added: added %s to allOf list %s of request parameter %s -request-parameter-all-of-list-%s-removed: removed %s from allOf list %s of request parameter %s -request-parameter-discriminator-added: added discriminator to request parameter %s -request-parameter-discriminator-removed: removed discriminator from request parameter %s -request-parameter-mapping-keys-added: added mapping keys to request parameter %s -request-parameter-mapping-keys-removed: removed mapping keys from request parameter %s +request-parameter-pattern-changed: pattern of request parameter %s was changed from %s to %s +request-parameter-pattern-added: added pattern %s to request parameter %s +request-parameter-pattern-removed: removed pattern %s from request parameter %s +request-parameter-default-value-added: added default value to request parameter %s +request-parameter-default-value-removed: removed default value from request parameter %s +request-parameter-any-of-list-schema-added: added schema %s to anyOf list %s of request parameter %s +request-parameter-any-of-list-schema-removed: removed schema %s from anyOf list %s of request parameter %s +request-parameter-one-of-list-schema-added: added schema %s to oneOf list %s of request parameter %s +request-parameter-one-of-list-schema-removed: removed schema %s from oneOf list %s of request parameter %s +request-parameter-all-of-list-schema-added: added schema %s to allOf list %s of request parameter %s +request-parameter-all-of-list-schema-removed: removed schema %s from allOf list %s of request parameter %s +request-parameter-discriminator-added: added discriminator %s to request parameter %s +request-parameter-discriminator-removed: removed discriminator %s from request parameter %s +request-parameter-mapping-keys-added: added mapping keys %s to request parameter %s +request-parameter-mapping-keys-removed: removed mapping keys %s from request parameter %s response-media-type-max-set: max value of media-type %s of response %s was set to %s response-media-type-max-increased: max value of media-type %s of response %s was increased from %s to %s response-media-type-max-decreased: max value of media-type %s of response %s was decreased from %s to %s @@ -112,16 +127,21 @@ response-media-type-max-items-decreased: maxItems value of media-type %s of resp response-media-type-type-changed: type/format of media-type %s of response %s was changed from %s to %s response-media-type-type-generalized: type/format of media-type %s of response %s was generalized from %s to %s response-media-type-discriminator-property-name-changed: discriminator property name of media-type %s of response %s was changed from %s to %s -response-media-type-any-of-list-%s-added: added %s to anyOf list %s of media-type %s of response %s -response-media-type-any-of-list-%s-removed: removed %s from anyOf list %s of media-type %s of response %s -response-media-type-one-of-list-%s-added: added %s to oneOf list %s of media-type %s of response %s -response-media-type-one-of-list-%s-removed: removed %s from oneOf list %s of media-type %s of response %s -response-media-type-all-of-list-%s-added: added %s to allOf list %s of media-type %s of response %s -response-media-type-all-of-list-%s-removed: removed %s from allOf list %s of media-type %s of response %s -response-media-type-discriminator-added: added discriminator to media-type %s of response %s -response-media-type-discriminator-removed: removed discriminator from media-type %s of response %s -response-media-type-mapping-keys-added: added mapping keys to media-type %s of response %s -response-media-type-mapping-keys-removed: removed mapping keys from media-type %s of response %s +response-media-type-pattern-changed: pattern of media-type %s of response %s was changed from %s to %s +response-media-type-pattern-added: added pattern %s to media-type %s of response %s +response-media-type-pattern-removed: removed pattern %s from media-type %s of response %s +response-media-type-default-value-added: added default value to media-type %s of response %s +response-media-type-default-value-removed: removed default value from media-type %s of response %s +response-media-type-any-of-list-schema-added: added schema %s to anyOf list %s of media-type %s of response %s +response-media-type-any-of-list-schema-removed: removed schema %s from anyOf list %s of media-type %s of response %s +response-media-type-one-of-list-schema-added: added schema %s to oneOf list %s of media-type %s of response %s +response-media-type-one-of-list-schema-removed: removed schema %s from oneOf list %s of media-type %s of response %s +response-media-type-all-of-list-schema-added: added schema %s to allOf list %s of media-type %s of response %s +response-media-type-all-of-list-schema-removed: removed schema %s from allOf list %s of media-type %s of response %s +response-media-type-discriminator-added: added discriminator %s to media-type %s of response %s +response-media-type-discriminator-removed: removed discriminator %s from media-type %s of response %s +response-media-type-mapping-keys-added: added mapping keys %s to media-type %s of response %s +response-media-type-mapping-keys-removed: removed mapping keys %s from media-type %s of response %s response-media-type-property-max-set: max value of property %s of media-type %s of response %s was set to %s response-media-type-property-max-increased: max value of property %s of media-type %s of response %s was increased from %s to %s response-media-type-property-max-decreased: max value of property %s of media-type %s of response %s was decreased from %s to %s @@ -143,13 +163,18 @@ response-media-type-property-max-items-decreased: maxItems value of property %s response-media-type-property-type-changed: type/format of property %s of media-type %s of response %s was changed from %s to %s response-media-type-property-type-generalized: type/format of property %s of media-type %s of response %s was generalized from %s to %s response-media-type-property-discriminator-property-name-changed: discriminator property name of property %s of media-type %s of response %s was changed from %s to %s -response-media-type-property-any-of-list-%s-added: added %s to anyOf list %s of property %s of media-type %s of response %s -response-media-type-property-any-of-list-%s-removed: removed %s from anyOf list %s of property %s of media-type %s of response %s -response-media-type-property-one-of-list-%s-added: added %s to oneOf list %s of property %s of media-type %s of response %s -response-media-type-property-one-of-list-%s-removed: removed %s from oneOf list %s of property %s of media-type %s of response %s -response-media-type-property-all-of-list-%s-added: added %s to allOf list %s of property %s of media-type %s of response %s -response-media-type-property-all-of-list-%s-removed: removed %s from allOf list %s of property %s of media-type %s of response %s -response-media-type-property-discriminator-added: added discriminator to property %s of media-type %s of response %s -response-media-type-property-discriminator-removed: removed discriminator from property %s of media-type %s of response %s -response-media-type-property-mapping-keys-added: added mapping keys to property %s of media-type %s of response %s -response-media-type-property-mapping-keys-removed: removed mapping keys from property %s of media-type %s of response %s +response-media-type-property-pattern-changed: pattern of property %s of media-type %s of response %s was changed from %s to %s +response-media-type-property-pattern-added: added pattern %s to property %s of media-type %s of response %s +response-media-type-property-pattern-removed: removed pattern %s from property %s of media-type %s of response %s +response-media-type-property-default-value-added: added default value to property %s of media-type %s of response %s +response-media-type-property-default-value-removed: removed default value from property %s of media-type %s of response %s +response-media-type-property-any-of-list-schema-added: added schema %s to anyOf list %s of property %s of media-type %s of response %s +response-media-type-property-any-of-list-schema-removed: removed schema %s from anyOf list %s of property %s of media-type %s of response %s +response-media-type-property-one-of-list-schema-added: added schema %s to oneOf list %s of property %s of media-type %s of response %s +response-media-type-property-one-of-list-schema-removed: removed schema %s from oneOf list %s of property %s of media-type %s of response %s +response-media-type-property-all-of-list-schema-added: added schema %s to allOf list %s of property %s of media-type %s of response %s +response-media-type-property-all-of-list-schema-removed: removed schema %s from allOf list %s of property %s of media-type %s of response %s +response-media-type-property-discriminator-added: added discriminator %s to property %s of media-type %s of response %s +response-media-type-property-discriminator-removed: removed discriminator %s from property %s of media-type %s of response %s +response-media-type-property-mapping-keys-added: added mapping keys %s to property %s of media-type %s of response %s +response-media-type-property-mapping-keys-removed: removed mapping keys %s from property %s of media-type %s of response %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index 97ec96e2..79f9b65b 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -5,7 +5,7 @@ import ( "io" ) -type ValueSets []ValueSet +type ValueSets []IValueSet func (vs ValueSets) generate(out io.Writer) { for _, v := range vs { @@ -13,22 +13,32 @@ func (vs ValueSets) generate(out io.Writer) { } } -type ValueSet interface { +type IValueSet interface { generate(out io.Writer) } -// ValueSetA messages start with the noun -type ValueSetA struct { - adjective string - hierarchy []string - attributed []bool - nouns []string - actions []string +type AdjectiveType bool + +const ( + PREDICATIVE AdjectiveType = false // PREDICATIVE adjectives are added after the noun (default) + ATTRIBUTIVE AdjectiveType = true // ATTRIBUTIVE adjectives are added before the noun +) + +type ValueSet struct { + adjective string // adjective is added to the noun + adjectiveType AdjectiveType + hierarchy []string + attributed []bool // attributed levels in the hierarchy are preceded by a name (%s) + nouns []string + actions []string } +// ValueSetA messages start with the noun +type ValueSetA ValueSet + func (v ValueSetA) generate(out io.Writer) { generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { - return standardizeSpaces(fmt.Sprintf("%s %s of %s was %s", noun, adjective, getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) + return standardizeSpaces(fmt.Sprintf("%s of %s was %s", addAttribute(noun, adjective, v.adjectiveType), getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) } for _, noun := range v.nouns { @@ -39,17 +49,11 @@ func (v ValueSetA) generate(out io.Writer) { } // ValueSetB messages start with the action -type ValueSetB struct { - adjective string - hierarchy []string - attributed []bool - nouns []string - actions []string -} +type ValueSetB ValueSet func (v ValueSetB) generate(out io.Writer) { - generateMessage := func(hierarchy []string, atttibuted []bool, noun, _, action string) string { - return standardizeSpaces(fmt.Sprintf("%s %s %s %s", conjugate(action), noun, getPreposition(action), getHierarchyMessage(hierarchy, atttibuted))) + generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { + return standardizeSpaces(fmt.Sprintf("%s %s %s %s", conjugate(action), addAttribute(noun, adjective, v.adjectiveType), getPreposition(action), getHierarchyMessage(hierarchy, atttibuted))) } for _, noun := range v.nouns { From e1105981ecf8931e3609c17d57837370a35b30c8 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 30 Aug 2024 22:53:54 +0300 Subject: [PATCH 17/26] added response-status --- checker/generator/checks.go | 33 ++++++++++++++++++++++++++++++--- checker/generator/data.go | 29 +++++++++++++++++++++++------ checker/generator/messages.yaml | 4 ++++ checker/generator/value_set.go | 3 ++- 4 files changed, 59 insertions(+), 10 deletions(-) diff --git a/checker/generator/checks.go b/checker/generator/checks.go index 1650afb1..e098f5a8 100644 --- a/checker/generator/checks.go +++ b/checker/generator/checks.go @@ -20,19 +20,46 @@ func Generate() error { return nil } +func isEmpty(s string) bool { + return s == "" +} + +func filterStrings(list []string, f func(string) bool) []string { + var result []string + for _, s := range list { + if !f(s) { + result = append(result, s) + } + } + return result +} + func generateId(hierarchy []string, noun, action string) string { if before, _, found := strings.Cut(noun, "/"); found { noun = before } - return strcase.ToKebab(concat(hierarchy) + "-" + noun + "-" + conjugate(action)) + + return strcase.ToKebab(strings.Join(filterStrings([]string{concat(hierarchy), noun, conjugate(action)}, isEmpty), "-")) } func concat(list []string) string { + if list == nil { + return "" + } + copy := slices.Clone(list) slices.Reverse(copy) return strings.Join(copy, "-") } +func getHierarchyPostfix(action string, hierarchy []string, atttibuted []bool) string { + if hierarchy == nil { + return "" + } + + return getPreposition(action) + " " + getHierarchyMessage(hierarchy, atttibuted) +} + func getHierarchyMessage(hierarchy []string, atttibuted []bool) string { copy := slices.Clone(hierarchy) @@ -47,7 +74,7 @@ func getHierarchyMessage(hierarchy []string, atttibuted []bool) string { result := strings.Join(copy, " %s of ") - if !isTopLevel(hierarchy[len(hierarchy)-1]) { + if hierarchy != nil && !isTopLevel(hierarchy[len(hierarchy)-1]) { result += " %s" } @@ -55,7 +82,7 @@ func getHierarchyMessage(hierarchy []string, atttibuted []bool) string { } func isTopLevel(s string) bool { - return s == "request body" + return s == "request body" || s == "paths" } func standardizeSpaces(s string) string { diff --git a/checker/generator/data.go b/checker/generator/data.go index d9c150d4..b9c041ba 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -4,6 +4,7 @@ import "slices" func getAll() ValueSets { return slices.Concat( + getPaths(), getRequest(), getResponse(), ) @@ -11,20 +12,36 @@ func getAll() ValueSets { func getRequest() ValueSets { return slices.Concat( - getSchema([]string{"media-type", "request body"}, nil), - getSchema([]string{"property", "media-type", "request body"}, nil), - getSchema([]string{"request parameter"}, []bool{true}), + schemaValueSets([]string{"media-type", "request body"}, nil), + schemaValueSets([]string{"property", "media-type", "request body"}, nil), + schemaValueSets([]string{"request parameter"}, []bool{true}), ) } func getResponse() ValueSets { return slices.Concat( - getSchema([]string{"media-type", "response"}, nil), - getSchema([]string{"property", "media-type", "response"}, nil), + schemaValueSets([]string{"media-type", "response"}, nil), + schemaValueSets([]string{"property", "media-type", "response"}, nil), ) } -func getSchema(hierarchy []string, attributed []bool) ValueSets { +func getPaths() ValueSets { + return pathValueSets(nil, nil) +} + +func pathValueSets(hierarchy []string, attributed []bool) ValueSets { + return ValueSets{ + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: hierarchy, + nouns: []string{"success response status", "non-success response status"}, + actions: []string{"add", "remove"}, + }, + } +} + +func schemaValueSets(hierarchy []string, attributed []bool) ValueSets { return ValueSets{ ValueSetA{ adjective: "value", diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index aefefe6f..1d466be9 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -1,3 +1,7 @@ +success-response-status-added: added success response status %s +success-response-status-removed: removed success response status %s +non-success-response-status-added: added non-success response status %s +non-success-response-status-removed: removed non-success response status %s request-body-media-type-max-set: max value of media-type %s of request body was set to %s request-body-media-type-max-increased: max value of media-type %s of request body was increased from %s to %s request-body-media-type-max-decreased: max value of media-type %s of request body was decreased from %s to %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index 79f9b65b..5c55cfb9 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -3,6 +3,7 @@ package generator import ( "fmt" "io" + "strings" ) type ValueSets []IValueSet @@ -53,7 +54,7 @@ type ValueSetB ValueSet func (v ValueSetB) generate(out io.Writer) { generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { - return standardizeSpaces(fmt.Sprintf("%s %s %s %s", conjugate(action), addAttribute(noun, adjective, v.adjectiveType), getPreposition(action), getHierarchyMessage(hierarchy, atttibuted))) + return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(noun, adjective, v.adjectiveType), getHierarchyPostfix(action, hierarchy, atttibuted)}, " ")) } for _, noun := range v.nouns { From 0b2cee79f91dd1ce8d59ae1e805ac5feed0c5914 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Fri, 30 Aug 2024 23:59:30 +0300 Subject: [PATCH 18/26] fix hierarchy --- checker/generator/data.go | 154 +++++++++++++++----------------- checker/generator/messages.yaml | 68 +++++++------- checker/generator/value_set.go | 38 ++++++++ 3 files changed, 144 insertions(+), 116 deletions(-) diff --git a/checker/generator/data.go b/checker/generator/data.go index b9c041ba..fefd4562 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -12,99 +12,89 @@ func getAll() ValueSets { func getRequest() ValueSets { return slices.Concat( - schemaValueSets([]string{"media-type", "request body"}, nil), - schemaValueSets([]string{"property", "media-type", "request body"}, nil), - schemaValueSets([]string{"request parameter"}, []bool{true}), + NewValueSets([]string{"media-type", "request body"}, nil, schemaValueSets), + NewValueSets([]string{"property", "media-type", "request body"}, nil, schemaValueSets), + NewValueSets([]string{"request parameter"}, []bool{true}, schemaValueSets), ) } func getResponse() ValueSets { return slices.Concat( - schemaValueSets([]string{"media-type", "response"}, nil), - schemaValueSets([]string{"property", "media-type", "response"}, nil), + NewValueSets([]string{"media-type", "response"}, nil, schemaValueSets), + NewValueSets([]string{"property", "media-type", "response"}, nil, schemaValueSets), ) } func getPaths() ValueSets { - return pathValueSets(nil, nil) + return NewValueSets(nil, nil, pathsValueSets) } -func pathValueSets(hierarchy []string, attributed []bool) ValueSets { - return ValueSets{ - ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: hierarchy, - nouns: []string{"success response status", "non-success response status"}, - actions: []string{"add", "remove"}, - }, - } +var pathsValueSets = ValueSets{ + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + nouns: []string{"success response status", "non-success response status"}, + actions: []string{"add", "remove"}, + }, } -func schemaValueSets(hierarchy []string, attributed []bool) ValueSets { - return ValueSets{ - ValueSetA{ - adjective: "value", - adjectiveType: PREDICATIVE, - hierarchy: hierarchy, - attributed: attributed, - nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, - actions: []string{"set", "increase", "decrease"}, - }, - ValueSetA{ - hierarchy: hierarchy, - nouns: []string{"type/format"}, - actions: []string{"change", "generalize"}, - }, - ValueSetA{ - hierarchy: hierarchy, - nouns: []string{"discriminator property name"}, - actions: []string{"change"}, - }, - ValueSetA{ - hierarchy: hierarchy, - nouns: []string{"pattern"}, - actions: []string{"change"}, - }, - ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: hierarchy, - nouns: []string{"pattern"}, - actions: []string{"add", "remove"}, - }, - ValueSetB{ - hierarchy: hierarchy, - nouns: []string{"default value"}, - actions: []string{"add", "remove"}, - }, - ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: append([]string{"anyOf list"}, hierarchy...), - nouns: []string{"schema"}, - actions: []string{"add", "remove"}, - }, - ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: append([]string{"oneOf list"}, hierarchy...), - nouns: []string{"schema"}, - actions: []string{"add", "remove"}, - }, - ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: append([]string{"allOf list"}, hierarchy...), - nouns: []string{"schema"}, - actions: []string{"add", "remove"}, - }, - ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: hierarchy, - nouns: []string{"discriminator", "mapping keys"}, - actions: []string{"add", "remove"}, - }, - } +var schemaValueSets = ValueSets{ + ValueSetA{ + adjective: "value", + adjectiveType: PREDICATIVE, + nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, + actions: []string{"set", "increase", "decrease"}, + }, + ValueSetA{ + nouns: []string{"type/format"}, + actions: []string{"change", "generalize"}, + }, + ValueSetA{ + nouns: []string{"discriminator property name"}, + actions: []string{"change"}, + }, + ValueSetA{ + nouns: []string{"pattern"}, + actions: []string{"change"}, + }, + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + nouns: []string{"pattern"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + nouns: []string{"default value"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: []string{"anyOf list"}, + attributed: []bool{false}, + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: []string{"anyOf list"}, + attributed: []bool{false}, + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: []string{"anyOf list"}, + attributed: []bool{false}, + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + nouns: []string{"discriminator", "mapping keys"}, + actions: []string{"add", "remove"}, + }, } diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index 1d466be9..f7af70fa 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -30,10 +30,10 @@ request-body-media-type-default-value-added: added default value to media-type % request-body-media-type-default-value-removed: removed default value from media-type %s of request body request-body-media-type-any-of-list-schema-added: added schema %s to anyOf list %s of media-type %s of request body request-body-media-type-any-of-list-schema-removed: removed schema %s from anyOf list %s of media-type %s of request body -request-body-media-type-one-of-list-schema-added: added schema %s to oneOf list %s of media-type %s of request body -request-body-media-type-one-of-list-schema-removed: removed schema %s from oneOf list %s of media-type %s of request body -request-body-media-type-all-of-list-schema-added: added schema %s to allOf list %s of media-type %s of request body -request-body-media-type-all-of-list-schema-removed: removed schema %s from allOf list %s of media-type %s of request body +request-body-media-type-any-of-list-schema-added: added schema %s to anyOf list %s of media-type %s of request body +request-body-media-type-any-of-list-schema-removed: removed schema %s from anyOf list %s of media-type %s of request body +request-body-media-type-any-of-list-schema-added: added schema %s to anyOf list %s of media-type %s of request body +request-body-media-type-any-of-list-schema-removed: removed schema %s from anyOf list %s of media-type %s of request body request-body-media-type-discriminator-added: added discriminator %s to media-type %s of request body request-body-media-type-discriminator-removed: removed discriminator %s from media-type %s of request body request-body-media-type-mapping-keys-added: added mapping keys %s to media-type %s of request body @@ -66,10 +66,10 @@ request-body-media-type-property-default-value-added: added default value to pro request-body-media-type-property-default-value-removed: removed default value from property %s of media-type %s of request body request-body-media-type-property-any-of-list-schema-added: added schema %s to anyOf list %s of property %s of media-type %s of request body request-body-media-type-property-any-of-list-schema-removed: removed schema %s from anyOf list %s of property %s of media-type %s of request body -request-body-media-type-property-one-of-list-schema-added: added schema %s to oneOf list %s of property %s of media-type %s of request body -request-body-media-type-property-one-of-list-schema-removed: removed schema %s from oneOf list %s of property %s of media-type %s of request body -request-body-media-type-property-all-of-list-schema-added: added schema %s to allOf list %s of property %s of media-type %s of request body -request-body-media-type-property-all-of-list-schema-removed: removed schema %s from allOf list %s of property %s of media-type %s of request body +request-body-media-type-property-any-of-list-schema-added: added schema %s to anyOf list %s of property %s of media-type %s of request body +request-body-media-type-property-any-of-list-schema-removed: removed schema %s from anyOf list %s of property %s of media-type %s of request body +request-body-media-type-property-any-of-list-schema-added: added schema %s to anyOf list %s of property %s of media-type %s of request body +request-body-media-type-property-any-of-list-schema-removed: removed schema %s from anyOf list %s of property %s of media-type %s of request body request-body-media-type-property-discriminator-added: added discriminator %s to property %s of media-type %s of request body request-body-media-type-property-discriminator-removed: removed discriminator %s from property %s of media-type %s of request body request-body-media-type-property-mapping-keys-added: added mapping keys %s to property %s of media-type %s of request body @@ -92,24 +92,24 @@ request-parameter-min-items-decreased: minItems value of %s request parameter %s request-parameter-max-items-set: maxItems value of %s request parameter %s was set to %s request-parameter-max-items-increased: maxItems value of %s request parameter %s was increased from %s to %s request-parameter-max-items-decreased: maxItems value of %s request parameter %s was decreased from %s to %s -request-parameter-type-changed: type/format of request parameter %s was changed from %s to %s -request-parameter-type-generalized: type/format of request parameter %s was generalized from %s to %s -request-parameter-discriminator-property-name-changed: discriminator property name of request parameter %s was changed from %s to %s -request-parameter-pattern-changed: pattern of request parameter %s was changed from %s to %s -request-parameter-pattern-added: added pattern %s to request parameter %s -request-parameter-pattern-removed: removed pattern %s from request parameter %s -request-parameter-default-value-added: added default value to request parameter %s -request-parameter-default-value-removed: removed default value from request parameter %s -request-parameter-any-of-list-schema-added: added schema %s to anyOf list %s of request parameter %s -request-parameter-any-of-list-schema-removed: removed schema %s from anyOf list %s of request parameter %s -request-parameter-one-of-list-schema-added: added schema %s to oneOf list %s of request parameter %s -request-parameter-one-of-list-schema-removed: removed schema %s from oneOf list %s of request parameter %s -request-parameter-all-of-list-schema-added: added schema %s to allOf list %s of request parameter %s -request-parameter-all-of-list-schema-removed: removed schema %s from allOf list %s of request parameter %s -request-parameter-discriminator-added: added discriminator %s to request parameter %s -request-parameter-discriminator-removed: removed discriminator %s from request parameter %s -request-parameter-mapping-keys-added: added mapping keys %s to request parameter %s -request-parameter-mapping-keys-removed: removed mapping keys %s from request parameter %s +request-parameter-type-changed: type/format of %s request parameter %s was changed from %s to %s +request-parameter-type-generalized: type/format of %s request parameter %s was generalized from %s to %s +request-parameter-discriminator-property-name-changed: discriminator property name of %s request parameter %s was changed from %s to %s +request-parameter-pattern-changed: pattern of %s request parameter %s was changed from %s to %s +request-parameter-pattern-added: added pattern %s to %s request parameter %s +request-parameter-pattern-removed: removed pattern %s from %s request parameter %s +request-parameter-default-value-added: added default value to %s request parameter %s +request-parameter-default-value-removed: removed default value from %s request parameter %s +request-parameter-any-of-list-schema-added: added schema %s to anyOf list %s of %s request parameter %s +request-parameter-any-of-list-schema-removed: removed schema %s from anyOf list %s of %s request parameter %s +request-parameter-any-of-list-schema-added: added schema %s to anyOf list %s of %s request parameter %s +request-parameter-any-of-list-schema-removed: removed schema %s from anyOf list %s of %s request parameter %s +request-parameter-any-of-list-schema-added: added schema %s to anyOf list %s of %s request parameter %s +request-parameter-any-of-list-schema-removed: removed schema %s from anyOf list %s of %s request parameter %s +request-parameter-discriminator-added: added discriminator %s to %s request parameter %s +request-parameter-discriminator-removed: removed discriminator %s from %s request parameter %s +request-parameter-mapping-keys-added: added mapping keys %s to %s request parameter %s +request-parameter-mapping-keys-removed: removed mapping keys %s from %s request parameter %s response-media-type-max-set: max value of media-type %s of response %s was set to %s response-media-type-max-increased: max value of media-type %s of response %s was increased from %s to %s response-media-type-max-decreased: max value of media-type %s of response %s was decreased from %s to %s @@ -138,10 +138,10 @@ response-media-type-default-value-added: added default value to media-type %s of response-media-type-default-value-removed: removed default value from media-type %s of response %s response-media-type-any-of-list-schema-added: added schema %s to anyOf list %s of media-type %s of response %s response-media-type-any-of-list-schema-removed: removed schema %s from anyOf list %s of media-type %s of response %s -response-media-type-one-of-list-schema-added: added schema %s to oneOf list %s of media-type %s of response %s -response-media-type-one-of-list-schema-removed: removed schema %s from oneOf list %s of media-type %s of response %s -response-media-type-all-of-list-schema-added: added schema %s to allOf list %s of media-type %s of response %s -response-media-type-all-of-list-schema-removed: removed schema %s from allOf list %s of media-type %s of response %s +response-media-type-any-of-list-schema-added: added schema %s to anyOf list %s of media-type %s of response %s +response-media-type-any-of-list-schema-removed: removed schema %s from anyOf list %s of media-type %s of response %s +response-media-type-any-of-list-schema-added: added schema %s to anyOf list %s of media-type %s of response %s +response-media-type-any-of-list-schema-removed: removed schema %s from anyOf list %s of media-type %s of response %s response-media-type-discriminator-added: added discriminator %s to media-type %s of response %s response-media-type-discriminator-removed: removed discriminator %s from media-type %s of response %s response-media-type-mapping-keys-added: added mapping keys %s to media-type %s of response %s @@ -174,10 +174,10 @@ response-media-type-property-default-value-added: added default value to propert response-media-type-property-default-value-removed: removed default value from property %s of media-type %s of response %s response-media-type-property-any-of-list-schema-added: added schema %s to anyOf list %s of property %s of media-type %s of response %s response-media-type-property-any-of-list-schema-removed: removed schema %s from anyOf list %s of property %s of media-type %s of response %s -response-media-type-property-one-of-list-schema-added: added schema %s to oneOf list %s of property %s of media-type %s of response %s -response-media-type-property-one-of-list-schema-removed: removed schema %s from oneOf list %s of property %s of media-type %s of response %s -response-media-type-property-all-of-list-schema-added: added schema %s to allOf list %s of property %s of media-type %s of response %s -response-media-type-property-all-of-list-schema-removed: removed schema %s from allOf list %s of property %s of media-type %s of response %s +response-media-type-property-any-of-list-schema-added: added schema %s to anyOf list %s of property %s of media-type %s of response %s +response-media-type-property-any-of-list-schema-removed: removed schema %s from anyOf list %s of property %s of media-type %s of response %s +response-media-type-property-any-of-list-schema-added: added schema %s to anyOf list %s of property %s of media-type %s of response %s +response-media-type-property-any-of-list-schema-removed: removed schema %s from anyOf list %s of property %s of media-type %s of response %s response-media-type-property-discriminator-added: added discriminator %s to property %s of media-type %s of response %s response-media-type-property-discriminator-removed: removed discriminator %s from property %s of media-type %s of response %s response-media-type-property-mapping-keys-added: added mapping keys %s to property %s of media-type %s of response %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index 5c55cfb9..329758ba 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -8,6 +8,21 @@ import ( type ValueSets []IValueSet +func NewValueSets(hierarchy []string, attributed []bool, valueSets ValueSets) ValueSets { + + result := make(ValueSets, len(valueSets)) + + if attributed == nil { + attributed = make([]bool, len(hierarchy)) + } + + for i, vs := range valueSets { + result[i] = vs.setHierarchy(hierarchy, attributed) + } + + return result +} + func (vs ValueSets) generate(out io.Writer) { for _, v := range vs { v.generate(out) @@ -16,6 +31,7 @@ func (vs ValueSets) generate(out io.Writer) { type IValueSet interface { generate(out io.Writer) + setHierarchy(hierarchy []string, attributed []bool) IValueSet } type AdjectiveType bool @@ -37,6 +53,17 @@ type ValueSet struct { // ValueSetA messages start with the noun type ValueSetA ValueSet +func (v ValueSetA) setHierarchy(hierarchy []string, attributed []bool) IValueSet { + if len(hierarchy) == 0 { + return v + } + + v.hierarchy = append(v.hierarchy, hierarchy...) + v.attributed = append(v.attributed, attributed...) + + return v +} + func (v ValueSetA) generate(out io.Writer) { generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { return standardizeSpaces(fmt.Sprintf("%s of %s was %s", addAttribute(noun, adjective, v.adjectiveType), getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) @@ -52,6 +79,17 @@ func (v ValueSetA) generate(out io.Writer) { // ValueSetB messages start with the action type ValueSetB ValueSet +func (v ValueSetB) setHierarchy(hierarchy []string, attributed []bool) IValueSet { + if len(hierarchy) == 0 { + return v + } + + v.hierarchy = append(v.hierarchy, hierarchy...) + v.attributed = append(v.attributed, attributed...) + + return v +} + func (v ValueSetB) generate(out io.Writer) { generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(noun, adjective, v.adjectiveType), getHierarchyPostfix(action, hierarchy, atttibuted)}, " ")) From 430d29651a25c37f467f650a5a60971bba479f79 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 31 Aug 2024 00:06:47 +0300 Subject: [PATCH 19/26] reuse setHierarchy --- checker/generator/value_set.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index 329758ba..997bc4fc 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -50,10 +50,7 @@ type ValueSet struct { actions []string } -// ValueSetA messages start with the noun -type ValueSetA ValueSet - -func (v ValueSetA) setHierarchy(hierarchy []string, attributed []bool) IValueSet { +func (v ValueSet) setHierarchy(hierarchy []string, attributed []bool) ValueSet { if len(hierarchy) == 0 { return v } @@ -64,6 +61,13 @@ func (v ValueSetA) setHierarchy(hierarchy []string, attributed []bool) IValueSet return v } +// ValueSetA messages start with the noun +type ValueSetA ValueSet + +func (v ValueSetA) setHierarchy(hierarchy []string, attributed []bool) IValueSet { + return ValueSetA(ValueSet(v).setHierarchy(hierarchy, attributed)) +} + func (v ValueSetA) generate(out io.Writer) { generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { return standardizeSpaces(fmt.Sprintf("%s of %s was %s", addAttribute(noun, adjective, v.adjectiveType), getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) @@ -80,14 +84,7 @@ func (v ValueSetA) generate(out io.Writer) { type ValueSetB ValueSet func (v ValueSetB) setHierarchy(hierarchy []string, attributed []bool) IValueSet { - if len(hierarchy) == 0 { - return v - } - - v.hierarchy = append(v.hierarchy, hierarchy...) - v.attributed = append(v.attributed, attributed...) - - return v + return ValueSetB(ValueSet(v).setHierarchy(hierarchy, attributed)) } func (v ValueSetB) generate(out io.Writer) { From c97b1c369a96dd6c8293152ee80da1972e6ca944 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 31 Aug 2024 00:44:09 +0300 Subject: [PATCH 20/26] add security phase 1 --- checker/generator/checks.go | 5 +++- checker/generator/data.go | 41 +++++++++++++++++++++++++++++++++ checker/generator/messages.yaml | 16 +++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/checker/generator/checks.go b/checker/generator/checks.go index e098f5a8..4d8744dd 100644 --- a/checker/generator/checks.go +++ b/checker/generator/checks.go @@ -82,7 +82,8 @@ func getHierarchyMessage(hierarchy []string, atttibuted []bool) string { } func isTopLevel(s string) bool { - return s == "request body" || s == "paths" + return s == "request body" || + s == "paths" } func standardizeSpaces(s string) string { @@ -110,6 +111,8 @@ func conjugate(verb string) string { return "set" case "add": return "added" + case "become": + return "became" } return verb + "d" } diff --git a/checker/generator/data.go b/checker/generator/data.go index fefd4562..3505a8bb 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -7,6 +7,7 @@ func getAll() ValueSets { getPaths(), getRequest(), getResponse(), + getComponents(), ) } @@ -29,6 +30,33 @@ func getPaths() ValueSets { return NewValueSets(nil, nil, pathsValueSets) } +func getComponents() ValueSets { + return slices.Concat( + getSecurity(), + ) +} + +func getSecurity() ValueSets { + return NewValueSets(nil, nil, securityValueSets) +} + +var securityValueSets = ValueSets{ + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + nouns: []string{"endpoint scheme security"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: []string{"global security scheme"}, + attributed: []bool{false}, + nouns: []string{"security scope"}, + actions: []string{"add", "remove"}, + }, +} + var pathsValueSets = ValueSets{ ValueSetB{ adjective: "%s", @@ -36,6 +64,15 @@ var pathsValueSets = ValueSets{ nouns: []string{"success response status", "non-success response status"}, actions: []string{"add", "remove"}, }, + ValueSetB{ + adjective: "%s", + adjectiveType: PREDICATIVE, + hierarchy: []string{"endpoint security scheme"}, + attributed: []bool{false}, + nouns: []string{"security scope"}, + actions: []string{"add", "remove"}, + }, + // security scope %s was added to endpoint security scheme %s } var schemaValueSets = ValueSets{ @@ -57,6 +94,10 @@ var schemaValueSets = ValueSets{ nouns: []string{"pattern"}, actions: []string{"change"}, }, + ValueSetA{ + nouns: []string{"required property", "optional property"}, + actions: []string{"change"}, + }, ValueSetB{ adjective: "%s", adjectiveType: PREDICATIVE, diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index f7af70fa..d43c10a9 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -2,6 +2,8 @@ success-response-status-added: added success response status %s success-response-status-removed: removed success response status %s non-success-response-status-added: added non-success response status %s non-success-response-status-removed: removed non-success response status %s +endpoint-security-scheme-security-scope-added: added security scope %s to endpoint security scheme %s +endpoint-security-scheme-security-scope-removed: removed security scope %s from endpoint security scheme %s request-body-media-type-max-set: max value of media-type %s of request body was set to %s request-body-media-type-max-increased: max value of media-type %s of request body was increased from %s to %s request-body-media-type-max-decreased: max value of media-type %s of request body was decreased from %s to %s @@ -24,6 +26,8 @@ request-body-media-type-type-changed: type/format of media-type %s of request bo request-body-media-type-type-generalized: type/format of media-type %s of request body was generalized from %s to %s request-body-media-type-discriminator-property-name-changed: discriminator property name of media-type %s of request body was changed from %s to %s request-body-media-type-pattern-changed: pattern of media-type %s of request body was changed from %s to %s +request-body-media-type-required-property-changed: required property of media-type %s of request body was changed from %s to %s +request-body-media-type-optional-property-changed: optional property of media-type %s of request body was changed from %s to %s request-body-media-type-pattern-added: added pattern %s to media-type %s of request body request-body-media-type-pattern-removed: removed pattern %s from media-type %s of request body request-body-media-type-default-value-added: added default value to media-type %s of request body @@ -60,6 +64,8 @@ request-body-media-type-property-type-changed: type/format of property %s of med request-body-media-type-property-type-generalized: type/format of property %s of media-type %s of request body was generalized from %s to %s request-body-media-type-property-discriminator-property-name-changed: discriminator property name of property %s of media-type %s of request body was changed from %s to %s request-body-media-type-property-pattern-changed: pattern of property %s of media-type %s of request body was changed from %s to %s +request-body-media-type-property-required-property-changed: required property of property %s of media-type %s of request body was changed from %s to %s +request-body-media-type-property-optional-property-changed: optional property of property %s of media-type %s of request body was changed from %s to %s request-body-media-type-property-pattern-added: added pattern %s to property %s of media-type %s of request body request-body-media-type-property-pattern-removed: removed pattern %s from property %s of media-type %s of request body request-body-media-type-property-default-value-added: added default value to property %s of media-type %s of request body @@ -96,6 +102,8 @@ request-parameter-type-changed: type/format of %s request parameter %s was chang request-parameter-type-generalized: type/format of %s request parameter %s was generalized from %s to %s request-parameter-discriminator-property-name-changed: discriminator property name of %s request parameter %s was changed from %s to %s request-parameter-pattern-changed: pattern of %s request parameter %s was changed from %s to %s +request-parameter-required-property-changed: required property of %s request parameter %s was changed from %s to %s +request-parameter-optional-property-changed: optional property of %s request parameter %s was changed from %s to %s request-parameter-pattern-added: added pattern %s to %s request parameter %s request-parameter-pattern-removed: removed pattern %s from %s request parameter %s request-parameter-default-value-added: added default value to %s request parameter %s @@ -132,6 +140,8 @@ response-media-type-type-changed: type/format of media-type %s of response %s wa response-media-type-type-generalized: type/format of media-type %s of response %s was generalized from %s to %s response-media-type-discriminator-property-name-changed: discriminator property name of media-type %s of response %s was changed from %s to %s response-media-type-pattern-changed: pattern of media-type %s of response %s was changed from %s to %s +response-media-type-required-property-changed: required property of media-type %s of response %s was changed from %s to %s +response-media-type-optional-property-changed: optional property of media-type %s of response %s was changed from %s to %s response-media-type-pattern-added: added pattern %s to media-type %s of response %s response-media-type-pattern-removed: removed pattern %s from media-type %s of response %s response-media-type-default-value-added: added default value to media-type %s of response %s @@ -168,6 +178,8 @@ response-media-type-property-type-changed: type/format of property %s of media-t response-media-type-property-type-generalized: type/format of property %s of media-type %s of response %s was generalized from %s to %s response-media-type-property-discriminator-property-name-changed: discriminator property name of property %s of media-type %s of response %s was changed from %s to %s response-media-type-property-pattern-changed: pattern of property %s of media-type %s of response %s was changed from %s to %s +response-media-type-property-required-property-changed: required property of property %s of media-type %s of response %s was changed from %s to %s +response-media-type-property-optional-property-changed: optional property of property %s of media-type %s of response %s was changed from %s to %s response-media-type-property-pattern-added: added pattern %s to property %s of media-type %s of response %s response-media-type-property-pattern-removed: removed pattern %s from property %s of media-type %s of response %s response-media-type-property-default-value-added: added default value to property %s of media-type %s of response %s @@ -182,3 +194,7 @@ response-media-type-property-discriminator-added: added discriminator %s to prop response-media-type-property-discriminator-removed: removed discriminator %s from property %s of media-type %s of response %s response-media-type-property-mapping-keys-added: added mapping keys %s to property %s of media-type %s of response %s response-media-type-property-mapping-keys-removed: removed mapping keys %s from property %s of media-type %s of response %s +endpoint-scheme-security-added: added endpoint scheme security %s +endpoint-scheme-security-removed: removed endpoint scheme security %s +global-security-scheme-security-scope-added: added security scope %s to global security scheme %s +global-security-scheme-security-scope-removed: removed security scope %s from global security scheme %s From 1d3733daac89c0271ae9945fe44598623ab9ba6d Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 31 Aug 2024 22:11:51 +0300 Subject: [PATCH 21/26] required/optional request-body --- checker/generator/checks.go | 4 ++-- checker/generator/data.go | 9 ++++++++- checker/generator/messages.yaml | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/checker/generator/checks.go b/checker/generator/checks.go index 4d8744dd..be3418fb 100644 --- a/checker/generator/checks.go +++ b/checker/generator/checks.go @@ -43,7 +43,7 @@ func generateId(hierarchy []string, noun, action string) string { } func concat(list []string) string { - if list == nil { + if len(list) == 0 { return "" } @@ -53,7 +53,7 @@ func concat(list []string) string { } func getHierarchyPostfix(action string, hierarchy []string, atttibuted []bool) string { - if hierarchy == nil { + if len(hierarchy) == 0 { return "" } diff --git a/checker/generator/data.go b/checker/generator/data.go index 3505a8bb..ba6076f6 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -16,6 +16,7 @@ func getRequest() ValueSets { NewValueSets([]string{"media-type", "request body"}, nil, schemaValueSets), NewValueSets([]string{"property", "media-type", "request body"}, nil, schemaValueSets), NewValueSets([]string{"request parameter"}, []bool{true}, schemaValueSets), + NewValueSets(nil, nil, operationValueSets), ) } @@ -72,7 +73,13 @@ var pathsValueSets = ValueSets{ nouns: []string{"security scope"}, actions: []string{"add", "remove"}, }, - // security scope %s was added to endpoint security scheme %s +} + +var operationValueSets = ValueSets{ + ValueSetB{ + nouns: []string{"required request body", "optional request body"}, + actions: []string{"add", "remove"}, + }, } var schemaValueSets = ValueSets{ diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index d43c10a9..2bcd4b5b 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -118,6 +118,10 @@ request-parameter-discriminator-added: added discriminator %s to %s request para request-parameter-discriminator-removed: removed discriminator %s from %s request parameter %s request-parameter-mapping-keys-added: added mapping keys %s to %s request parameter %s request-parameter-mapping-keys-removed: removed mapping keys %s from %s request parameter %s +required-request-body-added: added required request body +required-request-body-removed: removed required request body +optional-request-body-added: added optional request body +optional-request-body-removed: removed optional request body response-media-type-max-set: max value of media-type %s of response %s was set to %s response-media-type-max-increased: max value of media-type %s of response %s was increased from %s to %s response-media-type-max-decreased: max value of media-type %s of response %s was decreased from %s to %s From f310c61643df90ab88e5ce52899076b1cd7fda2d Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 5 Sep 2024 13:49:11 +0300 Subject: [PATCH 22/26] request-parameter added/removed --- checker/generator/checks.go | 7 +-- checker/generator/data.go | 96 ++++++++++++++++----------------- checker/generator/messages.yaml | 2 + checker/generator/value_set.go | 33 +++++------- 4 files changed, 64 insertions(+), 74 deletions(-) diff --git a/checker/generator/checks.go b/checker/generator/checks.go index be3418fb..cacfbefb 100644 --- a/checker/generator/checks.go +++ b/checker/generator/checks.go @@ -125,9 +125,6 @@ func getPreposition(action string) string { return "from" } -func addAttribute(noun, adjective string, adjectiveType AdjectiveType) string { - if adjectiveType == ATTRIBUTIVE { - return adjective + " " + noun - } - return noun + " " + adjective +func addAttribute(noun, attributiveAdjective, predicativeAdjective string) string { + return strings.Join([]string{attributiveAdjective + " " + noun + " " + predicativeAdjective}, " ") } diff --git a/checker/generator/data.go b/checker/generator/data.go index ba6076f6..dad5e8b1 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -43,35 +43,31 @@ func getSecurity() ValueSets { var securityValueSets = ValueSets{ ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - nouns: []string{"endpoint scheme security"}, - actions: []string{"add", "remove"}, + predicativeAdjective: "%s", + nouns: []string{"endpoint scheme security"}, + actions: []string{"add", "remove"}, }, ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: []string{"global security scheme"}, - attributed: []bool{false}, - nouns: []string{"security scope"}, - actions: []string{"add", "remove"}, + predicativeAdjective: "%s", + hierarchy: []string{"global security scheme"}, + attributed: []bool{false}, + nouns: []string{"security scope"}, + actions: []string{"add", "remove"}, }, } var pathsValueSets = ValueSets{ ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - nouns: []string{"success response status", "non-success response status"}, - actions: []string{"add", "remove"}, + predicativeAdjective: "%s", + nouns: []string{"success response status", "non-success response status"}, + actions: []string{"add", "remove"}, }, ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: []string{"endpoint security scheme"}, - attributed: []bool{false}, - nouns: []string{"security scope"}, - actions: []string{"add", "remove"}, + predicativeAdjective: "%s", + hierarchy: []string{"endpoint security scheme"}, + attributed: []bool{false}, + nouns: []string{"security scope"}, + actions: []string{"add", "remove"}, }, } @@ -80,14 +76,19 @@ var operationValueSets = ValueSets{ nouns: []string{"required request body", "optional request body"}, actions: []string{"add", "remove"}, }, + ValueSetB{ + predicativeAdjective: "%s", + attributiveAdjective: "%s", + nouns: []string{"request parameter"}, + actions: []string{"add", "remove"}, + }, } var schemaValueSets = ValueSets{ ValueSetA{ - adjective: "value", - adjectiveType: PREDICATIVE, - nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, - actions: []string{"set", "increase", "decrease"}, + predicativeAdjective: "value", + nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, + actions: []string{"set", "increase", "decrease"}, }, ValueSetA{ nouns: []string{"type/format"}, @@ -106,43 +107,38 @@ var schemaValueSets = ValueSets{ actions: []string{"change"}, }, ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - nouns: []string{"pattern"}, - actions: []string{"add", "remove"}, + predicativeAdjective: "%s", + nouns: []string{"pattern"}, + actions: []string{"add", "remove"}, }, ValueSetB{ nouns: []string{"default value"}, actions: []string{"add", "remove"}, }, ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: []string{"anyOf list"}, - attributed: []bool{false}, - nouns: []string{"schema"}, - actions: []string{"add", "remove"}, + predicativeAdjective: "%s", + hierarchy: []string{"anyOf list"}, + attributed: []bool{false}, + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, }, ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: []string{"anyOf list"}, - attributed: []bool{false}, - nouns: []string{"schema"}, - actions: []string{"add", "remove"}, + predicativeAdjective: "%s", + hierarchy: []string{"anyOf list"}, + attributed: []bool{false}, + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, }, ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - hierarchy: []string{"anyOf list"}, - attributed: []bool{false}, - nouns: []string{"schema"}, - actions: []string{"add", "remove"}, + predicativeAdjective: "%s", + hierarchy: []string{"anyOf list"}, + attributed: []bool{false}, + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, }, ValueSetB{ - adjective: "%s", - adjectiveType: PREDICATIVE, - nouns: []string{"discriminator", "mapping keys"}, - actions: []string{"add", "remove"}, + predicativeAdjective: "%s", + nouns: []string{"discriminator", "mapping keys"}, + actions: []string{"add", "remove"}, }, } diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index 2bcd4b5b..b67bf5a5 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -122,6 +122,8 @@ required-request-body-added: added required request body required-request-body-removed: removed required request body optional-request-body-added: added optional request body optional-request-body-removed: removed optional request body +request-parameter-added: added %s request parameter %s +request-parameter-removed: removed %s request parameter %s response-media-type-max-set: max value of media-type %s of response %s was set to %s response-media-type-max-increased: max value of media-type %s of response %s was increased from %s to %s response-media-type-max-decreased: max value of media-type %s of response %s was decreased from %s to %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index 997bc4fc..f6c5a289 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -8,6 +8,8 @@ import ( type ValueSets []IValueSet +// NewValueSets creates a new ValueSets object +// attributed is a list of booleans that indicates if the level in the hierarchy should be preceded by a %s func NewValueSets(hierarchy []string, attributed []bool, valueSets ValueSets) ValueSets { result := make(ValueSets, len(valueSets)) @@ -34,20 +36,13 @@ type IValueSet interface { setHierarchy(hierarchy []string, attributed []bool) IValueSet } -type AdjectiveType bool - -const ( - PREDICATIVE AdjectiveType = false // PREDICATIVE adjectives are added after the noun (default) - ATTRIBUTIVE AdjectiveType = true // ATTRIBUTIVE adjectives are added before the noun -) - type ValueSet struct { - adjective string // adjective is added to the noun - adjectiveType AdjectiveType - hierarchy []string - attributed []bool // attributed levels in the hierarchy are preceded by a name (%s) - nouns []string - actions []string + attributiveAdjective string // attributive adjectives are added before the noun + predicativeAdjective string // predicative adjectives are added after the noun + hierarchy []string + attributed []bool // attributed levels in the hierarchy are preceded by a name (%s) + nouns []string + actions []string } func (v ValueSet) setHierarchy(hierarchy []string, attributed []bool) ValueSet { @@ -69,13 +64,13 @@ func (v ValueSetA) setHierarchy(hierarchy []string, attributed []bool) IValueSet } func (v ValueSetA) generate(out io.Writer) { - generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { - return standardizeSpaces(fmt.Sprintf("%s of %s was %s", addAttribute(noun, adjective, v.adjectiveType), getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) + generateMessage := func(hierarchy []string, atttibuted []bool, noun, attributiveAdjective, predicativeAdjective, action string) string { + return standardizeSpaces(fmt.Sprintf("%s of %s was %s", addAttribute(noun, attributiveAdjective, predicativeAdjective), getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) } for _, noun := range v.nouns { for _, action := range v.actions { - fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, v.attributed, noun, v.adjective, action))) + fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, v.attributed, noun, v.attributiveAdjective, v.predicativeAdjective, action))) } } } @@ -88,13 +83,13 @@ func (v ValueSetB) setHierarchy(hierarchy []string, attributed []bool) IValueSet } func (v ValueSetB) generate(out io.Writer) { - generateMessage := func(hierarchy []string, atttibuted []bool, noun, adjective, action string) string { - return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(noun, adjective, v.adjectiveType), getHierarchyPostfix(action, hierarchy, atttibuted)}, " ")) + generateMessage := func(hierarchy []string, atttibuted []bool, noun, attributiveAdjective, predicativeAdjective, action string) string { + return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(noun, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy, atttibuted)}, " ")) } for _, noun := range v.nouns { for _, action := range v.actions { - fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, v.attributed, noun, v.adjective, action))) + fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, v.attributed, noun, v.attributiveAdjective, v.predicativeAdjective, action))) } } } From 8ba7ec9c82c28346bd739b3e6072fd33d14d5e07 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 5 Sep 2024 23:46:15 +0300 Subject: [PATCH 23/26] add endpoints --- checker/generator/data.go | 31 ++++++++++++++++++++++++++++--- checker/generator/messages.yaml | 10 ++++++++++ checker/generator/value_set.go | 11 +++++++++-- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/checker/generator/data.go b/checker/generator/data.go index dad5e8b1..0c23b512 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -5,6 +5,7 @@ import "slices" func getAll() ValueSets { return slices.Concat( getPaths(), + getEndpoints(), getRequest(), getResponse(), getComponents(), @@ -28,7 +29,11 @@ func getResponse() ValueSets { } func getPaths() ValueSets { - return NewValueSets(nil, nil, pathsValueSets) + return NewValueSets(nil, nil, pathValueSets) +} + +func getEndpoints() ValueSets { + return NewValueSets(nil, nil, endpointValueSets) } func getComponents() ValueSets { @@ -56,7 +61,18 @@ var securityValueSets = ValueSets{ }, } -var pathsValueSets = ValueSets{ +var pathValueSets = ValueSets{ + ValueSetB{ + nouns: []string{"endpoint"}, + actions: []string{"add", "remove", "deprecate", "reactivate"}, + }, +} + +var endpointValueSets = ValueSets{ + ValueSetA{ + nouns: []string{"stability"}, + actions: []string{"decrease"}, + }, ValueSetB{ predicativeAdjective: "%s", nouns: []string{"success response status", "non-success response status"}, @@ -100,7 +116,7 @@ var schemaValueSets = ValueSets{ }, ValueSetA{ nouns: []string{"pattern"}, - actions: []string{"change"}, + actions: []string{"change", "generalize"}, }, ValueSetA{ nouns: []string{"required property", "optional property"}, @@ -142,3 +158,12 @@ var schemaValueSets = ValueSets{ actions: []string{"add", "remove"}, }, } + +/* +missing: +api-deprecated-sunset-parse +api-path-sunset-parse +api-invalid-stability-level +api-deprecated-sunset-missing +api-sunset-date-too-small +*/ diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index b67bf5a5..5393808d 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -1,3 +1,8 @@ +endpoint-added: added endpoint +endpoint-removed: removed endpoint +endpoint-deprecated: deprecated endpoint +endpoint-reactivated: reactivated endpoint +stability-decreased: stability was decreased from %s to %s success-response-status-added: added success response status %s success-response-status-removed: removed success response status %s non-success-response-status-added: added non-success response status %s @@ -26,6 +31,7 @@ request-body-media-type-type-changed: type/format of media-type %s of request bo request-body-media-type-type-generalized: type/format of media-type %s of request body was generalized from %s to %s request-body-media-type-discriminator-property-name-changed: discriminator property name of media-type %s of request body was changed from %s to %s request-body-media-type-pattern-changed: pattern of media-type %s of request body was changed from %s to %s +request-body-media-type-pattern-generalized: pattern of media-type %s of request body was generalized from %s to %s request-body-media-type-required-property-changed: required property of media-type %s of request body was changed from %s to %s request-body-media-type-optional-property-changed: optional property of media-type %s of request body was changed from %s to %s request-body-media-type-pattern-added: added pattern %s to media-type %s of request body @@ -64,6 +70,7 @@ request-body-media-type-property-type-changed: type/format of property %s of med request-body-media-type-property-type-generalized: type/format of property %s of media-type %s of request body was generalized from %s to %s request-body-media-type-property-discriminator-property-name-changed: discriminator property name of property %s of media-type %s of request body was changed from %s to %s request-body-media-type-property-pattern-changed: pattern of property %s of media-type %s of request body was changed from %s to %s +request-body-media-type-property-pattern-generalized: pattern of property %s of media-type %s of request body was generalized from %s to %s request-body-media-type-property-required-property-changed: required property of property %s of media-type %s of request body was changed from %s to %s request-body-media-type-property-optional-property-changed: optional property of property %s of media-type %s of request body was changed from %s to %s request-body-media-type-property-pattern-added: added pattern %s to property %s of media-type %s of request body @@ -102,6 +109,7 @@ request-parameter-type-changed: type/format of %s request parameter %s was chang request-parameter-type-generalized: type/format of %s request parameter %s was generalized from %s to %s request-parameter-discriminator-property-name-changed: discriminator property name of %s request parameter %s was changed from %s to %s request-parameter-pattern-changed: pattern of %s request parameter %s was changed from %s to %s +request-parameter-pattern-generalized: pattern of %s request parameter %s was generalized from %s to %s request-parameter-required-property-changed: required property of %s request parameter %s was changed from %s to %s request-parameter-optional-property-changed: optional property of %s request parameter %s was changed from %s to %s request-parameter-pattern-added: added pattern %s to %s request parameter %s @@ -146,6 +154,7 @@ response-media-type-type-changed: type/format of media-type %s of response %s wa response-media-type-type-generalized: type/format of media-type %s of response %s was generalized from %s to %s response-media-type-discriminator-property-name-changed: discriminator property name of media-type %s of response %s was changed from %s to %s response-media-type-pattern-changed: pattern of media-type %s of response %s was changed from %s to %s +response-media-type-pattern-generalized: pattern of media-type %s of response %s was generalized from %s to %s response-media-type-required-property-changed: required property of media-type %s of response %s was changed from %s to %s response-media-type-optional-property-changed: optional property of media-type %s of response %s was changed from %s to %s response-media-type-pattern-added: added pattern %s to media-type %s of response %s @@ -184,6 +193,7 @@ response-media-type-property-type-changed: type/format of property %s of media-t response-media-type-property-type-generalized: type/format of property %s of media-type %s of response %s was generalized from %s to %s response-media-type-property-discriminator-property-name-changed: discriminator property name of property %s of media-type %s of response %s was changed from %s to %s response-media-type-property-pattern-changed: pattern of property %s of media-type %s of response %s was changed from %s to %s +response-media-type-property-pattern-generalized: pattern of property %s of media-type %s of response %s was generalized from %s to %s response-media-type-property-required-property-changed: required property of property %s of media-type %s of response %s was changed from %s to %s response-media-type-property-optional-property-changed: optional property of property %s of media-type %s of response %s was changed from %s to %s response-media-type-property-pattern-added: added pattern %s to property %s of media-type %s of response %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index f6c5a289..5212b3c9 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -65,12 +65,19 @@ func (v ValueSetA) setHierarchy(hierarchy []string, attributed []bool) IValueSet func (v ValueSetA) generate(out io.Writer) { generateMessage := func(hierarchy []string, atttibuted []bool, noun, attributiveAdjective, predicativeAdjective, action string) string { - return standardizeSpaces(fmt.Sprintf("%s of %s was %s", addAttribute(noun, attributiveAdjective, predicativeAdjective), getHierarchyMessage(hierarchy, atttibuted), getActionMessage(action))) + prefix := addAttribute(noun, attributiveAdjective, predicativeAdjective) + if hierarchyMessage := getHierarchyMessage(hierarchy, atttibuted); hierarchyMessage != "" { + prefix += " of " + hierarchyMessage + } + + return standardizeSpaces(fmt.Sprintf("%s was %s", prefix, getActionMessage(action))) } for _, noun := range v.nouns { for _, action := range v.actions { - fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, v.attributed, noun, v.attributiveAdjective, v.predicativeAdjective, action))) + id := generateId(v.hierarchy, noun, action) + message := generateMessage(v.hierarchy, v.attributed, noun, v.attributiveAdjective, v.predicativeAdjective, action) + fmt.Fprintln(out, fmt.Sprintf("%s: %s", id, message)) } } } From 4147fde7fa03945c68f1e8c9c3b91d37367617a7 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 7 Sep 2024 14:29:26 +0300 Subject: [PATCH 24/26] eliminate attributed --- checker/generator/checks.go | 19 +++++++-------- checker/generator/data.go | 41 +++++++++++---------------------- checker/generator/messages.yaml | 2 +- checker/generator/value_set.go | 35 +++++++++++----------------- 4 files changed, 39 insertions(+), 58 deletions(-) diff --git a/checker/generator/checks.go b/checker/generator/checks.go index cacfbefb..fe9a24b7 100644 --- a/checker/generator/checks.go +++ b/checker/generator/checks.go @@ -52,26 +52,23 @@ func concat(list []string) string { return strings.Join(copy, "-") } -func getHierarchyPostfix(action string, hierarchy []string, atttibuted []bool) string { +func getHierarchyPostfix(action string, hierarchy []string) string { if len(hierarchy) == 0 { return "" } - return getPreposition(action) + " " + getHierarchyMessage(hierarchy, atttibuted) + return getPreposition(action) + " " + getHierarchyMessage(hierarchy) } -func getHierarchyMessage(hierarchy []string, atttibuted []bool) string { +func getHierarchyMessage(hierarchy []string) string { copy := slices.Clone(hierarchy) - if atttibuted != nil { - for i, s := range hierarchy { - if atttibuted[i] { - copy[i] = "%s " + s - } + for i, s := range hierarchy { + if isAtttibuted(s) { + copy[i] = "%s " + s } } - result := strings.Join(copy, " %s of ") if hierarchy != nil && !isTopLevel(hierarchy[len(hierarchy)-1]) { @@ -86,6 +83,10 @@ func isTopLevel(s string) bool { s == "paths" } +func isAtttibuted(s string) bool { + return s == "request parameter" +} + func standardizeSpaces(s string) string { return strings.Join(strings.Fields(s), " ") } diff --git a/checker/generator/data.go b/checker/generator/data.go index 0c23b512..33757432 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -4,7 +4,6 @@ import "slices" func getAll() ValueSets { return slices.Concat( - getPaths(), getEndpoints(), getRequest(), getResponse(), @@ -14,26 +13,22 @@ func getAll() ValueSets { func getRequest() ValueSets { return slices.Concat( - NewValueSets([]string{"media-type", "request body"}, nil, schemaValueSets), - NewValueSets([]string{"property", "media-type", "request body"}, nil, schemaValueSets), - NewValueSets([]string{"request parameter"}, []bool{true}, schemaValueSets), - NewValueSets(nil, nil, operationValueSets), + NewValueSets([]string{"media-type", "request body"}, schemaValueSets), + NewValueSets([]string{"property", "media-type", "request body"}, schemaValueSets), + NewValueSets([]string{"request parameter"}, schemaValueSets), + NewValueSets(nil, operationValueSets), ) } func getResponse() ValueSets { return slices.Concat( - NewValueSets([]string{"media-type", "response"}, nil, schemaValueSets), - NewValueSets([]string{"property", "media-type", "response"}, nil, schemaValueSets), + NewValueSets([]string{"media-type", "response"}, schemaValueSets), + NewValueSets([]string{"property", "media-type", "response"}, schemaValueSets), ) } -func getPaths() ValueSets { - return NewValueSets(nil, nil, pathValueSets) -} - func getEndpoints() ValueSets { - return NewValueSets(nil, nil, endpointValueSets) + return NewValueSets(nil, endpointValueSets) } func getComponents() ValueSets { @@ -43,7 +38,7 @@ func getComponents() ValueSets { } func getSecurity() ValueSets { - return NewValueSets(nil, nil, securityValueSets) + return NewValueSets(nil, securityValueSets) } var securityValueSets = ValueSets{ @@ -55,33 +50,28 @@ var securityValueSets = ValueSets{ ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"global security scheme"}, - attributed: []bool{false}, nouns: []string{"security scope"}, actions: []string{"add", "remove"}, }, } -var pathValueSets = ValueSets{ - ValueSetB{ - nouns: []string{"endpoint"}, - actions: []string{"add", "remove", "deprecate", "reactivate"}, - }, -} - var endpointValueSets = ValueSets{ ValueSetA{ - nouns: []string{"stability"}, + nouns: []string{"stability"}, // /Paths/PathItem/Operation actions: []string{"decrease"}, }, + ValueSetB{ + nouns: []string{"endpoint"}, // /Paths/PathItem + actions: []string{"add", "remove", "deprecate", "reactivate"}, + }, ValueSetB{ predicativeAdjective: "%s", - nouns: []string{"success response status", "non-success response status"}, + nouns: []string{"success response status", "non-success response status"}, // /Paths/PathItem/Operation/Responses/Response/content/media-type/ actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"endpoint security scheme"}, - attributed: []bool{false}, nouns: []string{"security scope"}, actions: []string{"add", "remove"}, }, @@ -134,21 +124,18 @@ var schemaValueSets = ValueSets{ ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"anyOf list"}, - attributed: []bool{false}, nouns: []string{"schema"}, actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"anyOf list"}, - attributed: []bool{false}, nouns: []string{"schema"}, actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"anyOf list"}, - attributed: []bool{false}, nouns: []string{"schema"}, actions: []string{"add", "remove"}, }, diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index 5393808d..d47f1fa7 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -1,8 +1,8 @@ +stability-decreased: stability was decreased from %s to %s endpoint-added: added endpoint endpoint-removed: removed endpoint endpoint-deprecated: deprecated endpoint endpoint-reactivated: reactivated endpoint -stability-decreased: stability was decreased from %s to %s success-response-status-added: added success response status %s success-response-status-removed: removed success response status %s non-success-response-status-added: added non-success response status %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index 5212b3c9..de7a96f4 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -9,17 +9,12 @@ import ( type ValueSets []IValueSet // NewValueSets creates a new ValueSets object -// attributed is a list of booleans that indicates if the level in the hierarchy should be preceded by a %s -func NewValueSets(hierarchy []string, attributed []bool, valueSets ValueSets) ValueSets { +func NewValueSets(hierarchy []string, valueSets ValueSets) ValueSets { result := make(ValueSets, len(valueSets)) - if attributed == nil { - attributed = make([]bool, len(hierarchy)) - } - for i, vs := range valueSets { - result[i] = vs.setHierarchy(hierarchy, attributed) + result[i] = vs.setHierarchy(hierarchy) } return result @@ -33,25 +28,23 @@ func (vs ValueSets) generate(out io.Writer) { type IValueSet interface { generate(out io.Writer) - setHierarchy(hierarchy []string, attributed []bool) IValueSet + setHierarchy(hierarchy []string) IValueSet } type ValueSet struct { attributiveAdjective string // attributive adjectives are added before the noun predicativeAdjective string // predicative adjectives are added after the noun hierarchy []string - attributed []bool // attributed levels in the hierarchy are preceded by a name (%s) nouns []string actions []string } -func (v ValueSet) setHierarchy(hierarchy []string, attributed []bool) ValueSet { +func (v ValueSet) setHierarchy(hierarchy []string) ValueSet { if len(hierarchy) == 0 { return v } v.hierarchy = append(v.hierarchy, hierarchy...) - v.attributed = append(v.attributed, attributed...) return v } @@ -59,14 +52,14 @@ func (v ValueSet) setHierarchy(hierarchy []string, attributed []bool) ValueSet { // ValueSetA messages start with the noun type ValueSetA ValueSet -func (v ValueSetA) setHierarchy(hierarchy []string, attributed []bool) IValueSet { - return ValueSetA(ValueSet(v).setHierarchy(hierarchy, attributed)) +func (v ValueSetA) setHierarchy(hierarchy []string) IValueSet { + return ValueSetA(ValueSet(v).setHierarchy(hierarchy)) } func (v ValueSetA) generate(out io.Writer) { - generateMessage := func(hierarchy []string, atttibuted []bool, noun, attributiveAdjective, predicativeAdjective, action string) string { + generateMessage := func(hierarchy []string, noun, attributiveAdjective, predicativeAdjective, action string) string { prefix := addAttribute(noun, attributiveAdjective, predicativeAdjective) - if hierarchyMessage := getHierarchyMessage(hierarchy, atttibuted); hierarchyMessage != "" { + if hierarchyMessage := getHierarchyMessage(hierarchy); hierarchyMessage != "" { prefix += " of " + hierarchyMessage } @@ -76,7 +69,7 @@ func (v ValueSetA) generate(out io.Writer) { for _, noun := range v.nouns { for _, action := range v.actions { id := generateId(v.hierarchy, noun, action) - message := generateMessage(v.hierarchy, v.attributed, noun, v.attributiveAdjective, v.predicativeAdjective, action) + message := generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action) fmt.Fprintln(out, fmt.Sprintf("%s: %s", id, message)) } } @@ -85,18 +78,18 @@ func (v ValueSetA) generate(out io.Writer) { // ValueSetB messages start with the action type ValueSetB ValueSet -func (v ValueSetB) setHierarchy(hierarchy []string, attributed []bool) IValueSet { - return ValueSetB(ValueSet(v).setHierarchy(hierarchy, attributed)) +func (v ValueSetB) setHierarchy(hierarchy []string) IValueSet { + return ValueSetB(ValueSet(v).setHierarchy(hierarchy)) } func (v ValueSetB) generate(out io.Writer) { - generateMessage := func(hierarchy []string, atttibuted []bool, noun, attributiveAdjective, predicativeAdjective, action string) string { - return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(noun, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy, atttibuted)}, " ")) + generateMessage := func(hierarchy []string, noun, attributiveAdjective, predicativeAdjective, action string) string { + return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(noun, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy)}, " ")) } for _, noun := range v.nouns { for _, action := range v.actions { - fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, v.attributed, noun, v.attributiveAdjective, v.predicativeAdjective, action))) + fmt.Fprintln(out, fmt.Sprintf("%s: %s", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action))) } } } From 407ad519442e1ffcc06daaa1ea29b83d3a9f8eb6 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 7 Sep 2024 15:08:37 +0300 Subject: [PATCH 25/26] added without deprecation --- checker/generator/data.go | 5 +++++ checker/generator/{checks.go => generator.go} | 20 +++++++++++++------ checker/generator/messages.yaml | 4 ++++ checker/generator/value_set.go | 7 ++++--- 4 files changed, 27 insertions(+), 9 deletions(-) rename checker/generator/{checks.go => generator.go} (90%) diff --git a/checker/generator/data.go b/checker/generator/data.go index 33757432..013a3583 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -60,6 +60,11 @@ var endpointValueSets = ValueSets{ nouns: []string{"stability"}, // /Paths/PathItem/Operation actions: []string{"decrease"}, }, + ValueSetA{ + nouns: []string{"api path", "api"}, + actions: []string{"add", "remove"}, + adverb: "without deprecation", + }, ValueSetB{ nouns: []string{"endpoint"}, // /Paths/PathItem actions: []string{"add", "remove", "deprecate", "reactivate"}, diff --git a/checker/generator/checks.go b/checker/generator/generator.go similarity index 90% rename from checker/generator/checks.go rename to checker/generator/generator.go index fe9a24b7..3831d168 100644 --- a/checker/generator/checks.go +++ b/checker/generator/generator.go @@ -92,18 +92,26 @@ func standardizeSpaces(s string) string { } func getActionMessage(action string) string { - if isUnary(action) { - return conjugate(action) + " to %s" + switch getArity(action) { + case 0: + return "" + case 1: + return " to %s" + case 2: + return " from %s to %s" + default: + return "" } - return conjugate(action) + " from %s to %s" } -func isUnary(action string) bool { +func getArity(action string) int { switch action { + case "add", "remove": + return 0 case "set": - return true + return 1 } - return false + return 2 } func conjugate(verb string) string { diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index d47f1fa7..834c5952 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -1,4 +1,8 @@ stability-decreased: stability was decreased from %s to %s +api-path-added: api path was added without deprecation +api-path-removed: api path was removed without deprecation +api-added: api was added without deprecation +api-removed: api was removed without deprecation endpoint-added: added endpoint endpoint-removed: removed endpoint endpoint-deprecated: deprecated endpoint diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index de7a96f4..c740037c 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -37,6 +37,7 @@ type ValueSet struct { hierarchy []string nouns []string actions []string + adverb string } func (v ValueSet) setHierarchy(hierarchy []string) ValueSet { @@ -57,19 +58,19 @@ func (v ValueSetA) setHierarchy(hierarchy []string) IValueSet { } func (v ValueSetA) generate(out io.Writer) { - generateMessage := func(hierarchy []string, noun, attributiveAdjective, predicativeAdjective, action string) string { + generateMessage := func(hierarchy []string, noun, attributiveAdjective, predicativeAdjective, action, adverb string) string { prefix := addAttribute(noun, attributiveAdjective, predicativeAdjective) if hierarchyMessage := getHierarchyMessage(hierarchy); hierarchyMessage != "" { prefix += " of " + hierarchyMessage } - return standardizeSpaces(fmt.Sprintf("%s was %s", prefix, getActionMessage(action))) + return standardizeSpaces(fmt.Sprintf("%s was %s %s %s", prefix, conjugate(action), getActionMessage(action), adverb)) } for _, noun := range v.nouns { for _, action := range v.actions { id := generateId(v.hierarchy, noun, action) - message := generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action) + message := generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action, v.adverb) fmt.Fprintln(out, fmt.Sprintf("%s: %s", id, message)) } } From 7a89f4775d9f743ca120f7c2640415685d0765bc Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 7 Sep 2024 16:05:17 +0300 Subject: [PATCH 26/26] operation-id and tag --- checker/generator/data.go | 13 +++++++++++-- checker/generator/messages.yaml | 9 +++++++-- checker/generator/value_set.go | 13 ++++++++++--- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/checker/generator/data.go b/checker/generator/data.go index 013a3583..f1601879 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -62,8 +62,8 @@ var endpointValueSets = ValueSets{ }, ValueSetA{ nouns: []string{"api path", "api"}, - actions: []string{"add", "remove"}, - adverb: "without deprecation", + actions: []string{"remove"}, + adverb: []string{"without deprecation", "before sunset"}, }, ValueSetB{ nouns: []string{"endpoint"}, // /Paths/PathItem @@ -74,6 +74,15 @@ var endpointValueSets = ValueSets{ nouns: []string{"success response status", "non-success response status"}, // /Paths/PathItem/Operation/Responses/Response/content/media-type/ actions: []string{"add", "remove"}, }, + ValueSetA{ + nouns: []string{"operation id"}, + actions: []string{"change"}, + }, + ValueSetB{ + predicativeAdjective: "%s", + nouns: []string{"operation id", "tag"}, + actions: []string{"add", "remove"}, + }, ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"endpoint security scheme"}, diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index 834c5952..79612083 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -1,8 +1,8 @@ stability-decreased: stability was decreased from %s to %s -api-path-added: api path was added without deprecation api-path-removed: api path was removed without deprecation -api-added: api was added without deprecation +api-path-removed: api path was removed before sunset api-removed: api was removed without deprecation +api-removed: api was removed before sunset endpoint-added: added endpoint endpoint-removed: removed endpoint endpoint-deprecated: deprecated endpoint @@ -11,6 +11,11 @@ success-response-status-added: added success response status %s success-response-status-removed: removed success response status %s non-success-response-status-added: added non-success response status %s non-success-response-status-removed: removed non-success response status %s +operation-id-changed: operation id was changed from %s to %s +operation-id-added: added operation id %s +operation-id-removed: removed operation id %s +tag-added: added tag %s +tag-removed: removed tag %s endpoint-security-scheme-security-scope-added: added security scope %s to endpoint security scheme %s endpoint-security-scheme-security-scope-removed: removed security scope %s from endpoint security scheme %s request-body-media-type-max-set: max value of media-type %s of request body was set to %s diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index c740037c..c9b34a63 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -37,7 +37,7 @@ type ValueSet struct { hierarchy []string nouns []string actions []string - adverb string + adverb []string } func (v ValueSet) setHierarchy(hierarchy []string) ValueSet { @@ -70,8 +70,15 @@ func (v ValueSetA) generate(out io.Writer) { for _, noun := range v.nouns { for _, action := range v.actions { id := generateId(v.hierarchy, noun, action) - message := generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action, v.adverb) - fmt.Fprintln(out, fmt.Sprintf("%s: %s", id, message)) + + adverbs := v.adverb + if v.adverb == nil { + adverbs = []string{""} + } + for _, adverb := range adverbs { + message := generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action, adverb) + fmt.Fprintln(out, fmt.Sprintf("%s: %s", id, message)) + } } } }