From 7d9a5293ab3f8767f6d48e42e325715bb4960cf8 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Wed, 5 Jun 2024 09:56:18 +0300 Subject: [PATCH] check new required props for default value (#551) --- checker/check_breaking_property_test.go | 16 ++ ...check_request_property_required_updated.go | 141 +++++++----------- ..._request_property_required_updated_test.go | 24 +++ checker/check_request_property_updated.go | 37 +++-- .../check_request_property_updated_test.go | 22 +++ checker/localizations/localizations.go | 12 +- checker/localizations_src/en/messages.yaml | 8 +- checker/localizations_src/ru/messages.yaml | 2 + checker/rules.go | 2 + .../request_property_added_with_default.yaml | 25 ++++ data/required-properties/items3.yaml | 23 +++ docs/BREAKING-CHANGES-EXAMPLES.md | 11 +- 12 files changed, 218 insertions(+), 105 deletions(-) create mode 100644 data/checker/request_property_added_with_default.yaml create mode 100644 data/required-properties/items3.yaml diff --git a/checker/check_breaking_property_test.go b/checker/check_breaking_property_test.go index a295525d..4d8e8d59 100644 --- a/checker/check_breaking_property_test.go +++ b/checker/check_breaking_property_test.go @@ -591,6 +591,7 @@ 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()) } // BC: changing an existing property in request body items to required is breaking @@ -607,6 +608,21 @@ 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()) +} + +// BC: changing an existing property in request body items to required with a default value is not breaking +func TestBreaking_ItemsWithDefault(t *testing.T) { + s1, err := open(getReqPropFile("items1.yaml")) + require.NoError(t, err) + + s2, err := open(getReqPropFile("items3.yaml")) + require.NoError(t, err) + + d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) + require.NoError(t, err) + errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm) + require.Empty(t, errs) } // BC: changing an existing property in request body anyOf to required is breaking diff --git a/checker/check_request_property_required_updated.go b/checker/check_request_property_required_updated.go index bd4b0323..cdb063b4 100644 --- a/checker/check_request_property_required_updated.go +++ b/checker/check_request_property_required_updated.go @@ -6,8 +6,9 @@ import ( ) const ( - RequestPropertyBecameRequiredId = "request-property-became-required" - RequestPropertyBecameOptionalId = "request-property-became-optional" + RequestPropertyBecameRequiredId = "request-property-became-required" + RequestPropertyBecameRequiredWithDefaultId = "request-property-became-required-with-default" + RequestPropertyBecameOptionalId = "request-property-became-optional" ) func RequestPropertyRequiredUpdatedCheck(diffReport *diff.Diff, operationsSources *diff.OperationsSourcesMap, config *Config) Changes { @@ -33,92 +34,38 @@ func RequestPropertyRequiredUpdatedCheck(diffReport *diff.Diff, operationsSource continue } - if mediaTypeDiff.SchemaDiff.RequiredDiff != nil { - for _, changedRequiredPropertyName := range mediaTypeDiff.SchemaDiff.RequiredDiff.Added { - if mediaTypeDiff.SchemaDiff.Base.Properties[changedRequiredPropertyName] == nil { - // it is a new property, checked by the new-required-request-property check - continue - } - if mediaTypeDiff.SchemaDiff.Revision.Properties[changedRequiredPropertyName] == nil { - // property was removed, checked by request-property-removed - continue - } - if mediaTypeDiff.SchemaDiff.Revision.Properties[changedRequiredPropertyName].Value.ReadOnly { - continue - } - result = append(result, ApiChange{ - Id: RequestPropertyBecameRequiredId, - Level: ERR, - Args: []any{changedRequiredPropertyName}, - Operation: operation, - OperationId: operationItem.Revision.OperationID, - Path: path, - Source: load.NewSource(source), - }) - } - for _, changedRequiredPropertyName := range mediaTypeDiff.SchemaDiff.RequiredDiff.Deleted { - if mediaTypeDiff.SchemaDiff.Base.Properties[changedRequiredPropertyName] == nil { - // it is a new property, checked by the new-required-request-property check - continue - } - if mediaTypeDiff.SchemaDiff.Revision.Properties[changedRequiredPropertyName] == nil { - // property was removed, checked by request-property-removed - continue - } - if mediaTypeDiff.SchemaDiff.Revision.Properties[changedRequiredPropertyName].Value.ReadOnly { - continue - } - result = append(result, ApiChange{ - Id: RequestPropertyBecameOptionalId, - Level: INFO, - Args: []any{changedRequiredPropertyName}, - Operation: operation, - OperationId: operationItem.Revision.OperationID, - Path: path, - Source: load.NewSource(source), - }) - } - } - - CheckModifiedPropertiesDiff( - mediaTypeDiff.SchemaDiff, - func(propertyPath string, propertyName string, propertyDiff *diff.SchemaDiff, parent *diff.SchemaDiff) { - requiredDiff := propertyDiff.RequiredDiff - if requiredDiff == nil { - return - } - for _, changedRequiredPropertyName := range requiredDiff.Added { - if propertyDiff.Revision.Properties[changedRequiredPropertyName] == nil { - continue - } - if propertyDiff.Revision.Properties[changedRequiredPropertyName].Value.ReadOnly { - continue - } - if propertyDiff.Base.Properties[changedRequiredPropertyName] == nil { - // it is a new property, checked by the new-required-request-property check + processRequestPropertyRequiredDiff := func(schemaDiff *diff.SchemaDiff, propertyPath string, propertyName string) { + if schemaDiff.RequiredDiff != nil { + for _, changedRequiredPropertyName := range schemaDiff.RequiredDiff.Added { + if !changedRequiredPropertyRelevant(schemaDiff, changedRequiredPropertyName) { continue } - result = append(result, ApiChange{ - Id: RequestPropertyBecameRequiredId, - Level: ERR, - Args: []any{propertyFullName(propertyPath, propertyFullName(propertyName, changedRequiredPropertyName))}, - Operation: operation, - OperationId: operationItem.Revision.OperationID, - Path: path, - Source: load.NewSource(source), - }) - } - - for _, changedRequiredPropertyName := range requiredDiff.Deleted { - if propertyDiff.Revision.Properties[changedRequiredPropertyName] == nil { - continue + if schemaDiff.Revision.Properties[changedRequiredPropertyName].Value.Default == nil { + result = append(result, ApiChange{ + Id: RequestPropertyBecameRequiredId, + Level: ERR, + Args: []any{propertyFullName(propertyPath, propertyFullName(propertyName, changedRequiredPropertyName))}, + Operation: operation, + OperationId: operationItem.Revision.OperationID, + Path: path, + Source: load.NewSource(source), + }) + } else { + // property has a default value, so making it required is not a breaking change + result = append(result, ApiChange{ + Id: RequestPropertyBecameRequiredWithDefaultId, + Level: INFO, + Args: []any{propertyFullName(propertyPath, propertyFullName(propertyName, changedRequiredPropertyName))}, + Operation: operation, + OperationId: operationItem.Revision.OperationID, + Path: path, + Source: load.NewSource(source), + }) } - if propertyDiff.Revision.Properties[changedRequiredPropertyName].Value.ReadOnly { - continue - } - if propertyDiff.Base.Properties[changedRequiredPropertyName] == nil { - // it is a new property, checked by the new-required-request-property check + } + for _, changedRequiredPropertyName := range schemaDiff.RequiredDiff.Deleted { + if !changedRequiredPropertyRelevant(schemaDiff, changedRequiredPropertyName) { continue } @@ -132,9 +79,35 @@ func RequestPropertyRequiredUpdatedCheck(diffReport *diff.Diff, operationsSource Source: load.NewSource(source), }) } + } + } + + processRequestPropertyRequiredDiff(mediaTypeDiff.SchemaDiff, "", "") + + CheckModifiedPropertiesDiff( + mediaTypeDiff.SchemaDiff, + func(propertyPath string, propertyName string, propertyDiff *diff.SchemaDiff, _ *diff.SchemaDiff) { + processRequestPropertyRequiredDiff(propertyDiff, propertyPath, propertyName) }) } } } return result } + +func changedRequiredPropertyRelevant(schemaDiff *diff.SchemaDiff, changedRequiredPropertyName string) bool { + if schemaDiff.Base.Properties[changedRequiredPropertyName] == nil { + // it is a new property, checked by the new-required-request-property check + return false + } + if schemaDiff.Revision.Properties[changedRequiredPropertyName] == nil { + // property was removed, checked by request-property-removed + return false + } + if schemaDiff.Revision.Properties[changedRequiredPropertyName].Value.ReadOnly { + // property is read-only, not relevant in requests + return false + } + + return true +} diff --git a/checker/check_request_property_required_updated_test.go b/checker/check_request_property_required_updated_test.go index 7ab69fc4..72d121f6 100644 --- a/checker/check_request_property_required_updated_test.go +++ b/checker/check_request_property_required_updated_test.go @@ -54,3 +54,27 @@ func TestRequestPropertyMarkedOptional(t *testing.T) { OperationId: "addProduct", }, errs[0]) } + +// CL: making request property required, while also giving it a default value +func TestRequestPropertyWithDefaultMarkedRequired(t *testing.T) { + s1, err := open("../data/checker/request_property_became_required_base.yaml") + require.NoError(t, err) + s2, err := open("../data/checker/request_property_became_required_base.yaml") + require.NoError(t, err) + + s1.Spec.Paths.Value("/products").Post.RequestBody.Value.Content["application/json"].Schema.Value.Required = []string{""} + s2.Spec.Paths.Value("/products").Post.RequestBody.Value.Content["application/json"].Schema.Value.Properties["name"].Value.Default = "default" + d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) + require.NoError(t, err) + errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.RequestPropertyRequiredUpdatedCheck), d, osm, checker.INFO) + require.Len(t, errs, 1) + require.Equal(t, checker.ApiChange{ + Id: checker.RequestPropertyBecameRequiredWithDefaultId, + Args: []any{"name"}, + Level: checker.INFO, + Operation: "POST", + Path: "/products", + Source: load.NewSource("../data/checker/request_property_became_required_base.yaml"), + OperationId: "addProduct", + }, errs[0]) +} diff --git a/checker/check_request_property_updated.go b/checker/check_request_property_updated.go index 82e8ce33..42ad52b0 100644 --- a/checker/check_request_property_updated.go +++ b/checker/check_request_property_updated.go @@ -8,9 +8,10 @@ import ( ) const ( - RequestPropertyRemovedId = "request-property-removed" - NewRequiredRequestPropertyId = "new-required-request-property" - NewOptionalRequestPropertyId = "new-optional-request-property" + RequestPropertyRemovedId = "request-property-removed" + NewRequiredRequestPropertyId = "new-required-request-property" + NewRequiredRequestPropertyWithDefaultId = "new-required-request-property-with-default" + NewOptionalRequestPropertyId = "new-optional-request-property" ) func RequestPropertyUpdatedCheck(diffReport *diff.Diff, operationsSources *diff.OperationsSourcesMap, config *Config) Changes { @@ -57,15 +58,27 @@ func RequestPropertyUpdatedCheck(diffReport *diff.Diff, operationsSources *diff. propName := propertyFullName(propertyPath, propertyName) if slices.Contains(parent.Revision.Required, propertyName) { - result = append(result, ApiChange{ - Id: NewRequiredRequestPropertyId, - Level: ERR, - Args: []any{propName}, - Operation: operation, - OperationId: operationItem.Revision.OperationID, - Path: path, - Source: load.NewSource(source), - }) + if propertyItem.Default == nil { + result = append(result, ApiChange{ + Id: NewRequiredRequestPropertyId, + Level: ERR, + Args: []any{propName}, + Operation: operation, + OperationId: operationItem.Revision.OperationID, + Path: path, + Source: load.NewSource(source), + }) + } else { + result = append(result, ApiChange{ + Id: NewRequiredRequestPropertyWithDefaultId, + Level: INFO, + Args: []any{propName}, + Operation: operation, + OperationId: operationItem.Revision.OperationID, + Path: path, + Source: load.NewSource(source), + }) + } } else { result = append(result, ApiChange{ Id: NewOptionalRequestPropertyId, diff --git a/checker/check_request_property_updated_test.go b/checker/check_request_property_updated_test.go index 58785d58..d5f42b3e 100644 --- a/checker/check_request_property_updated_test.go +++ b/checker/check_request_property_updated_test.go @@ -106,3 +106,25 @@ func TestRequiredRequestPropertyRemoved(t *testing.T) { OperationId: "addProduct", }, errs[0]) } + +// CL: adding a new required request property with a default value +func TestRequiredRequestPropertyAddedWithDefault(t *testing.T) { + s1, err := open("../data/checker/request_property_added_base.yaml") + require.NoError(t, err) + s2, err := open("../data/checker/request_property_added_with_default.yaml") + require.NoError(t, err) + + d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2) + require.NoError(t, err) + errs := checker.CheckBackwardCompatibilityUntilLevel(singleCheckConfig(checker.RequestPropertyUpdatedCheck), d, osm, checker.INFO) + require.Len(t, errs, 1) + require.Equal(t, checker.ApiChange{ + Id: checker.NewRequiredRequestPropertyWithDefaultId, + Args: []any{"description"}, + Level: checker.INFO, + Operation: "POST", + Path: "/products", + Source: load.NewSource("../data/checker/request_property_added_with_default.yaml"), + OperationId: "addProduct", + }, errs[0]) +} diff --git a/checker/localizations/localizations.go b/checker/localizations/localizations.go index d601bdd3..a28c543a 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-04-24 22:39:25.948724 +0300 IDT m=+0.007644159 +// 2024-06-03 23:34:58.291782 +0300 IDT m=+0.004838008 package localizations @@ -95,6 +95,8 @@ var localizations = map[string]string{ "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-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-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-description": "optional response header deleted", "en.messages.parsing-error-description": "invalid stability level", @@ -276,12 +278,14 @@ var localizations = map[string]string{ "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-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-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-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-description": "request property default-value changed", + "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-description": "request property default-value unset", + "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", @@ -571,6 +575,7 @@ var localizations = map[string]string{ "ru.messages.new-required-request-header-property": "в заголовке запроса %s добавлено новое обязательное поле %s", "ru.messages.new-required-request-parameter": "добавлен новый обязательный %s параметр зароса %s", "ru.messages.new-required-request-property": "добавлено новое обязательное поле запроса %s", + "ru.messages.new-required-request-property-with-default": "добавлено новое обязательное поле запроса %s со значением по умолчанию", "ru.messages.optional-response-header-removed": "удалён ранее необязательный заголовок ответа %s для ответа со статусом %s", "ru.messages.pattern-changed-warn-comment": "Это предупреждение, потому что сложно автоматически проанализировать, является ли новый шаблон надмножеством предыдущего шаблона (например, изменен с '[0-9]+' на '[0-9]*').", "ru.messages.request-body-added-optional": "добавлено необязательное тело запроса", @@ -666,6 +671,7 @@ var localizations = map[string]string{ "ru.messages.request-property-became-nullable": "свойство запроса %s стало обнуляемым", "ru.messages.request-property-became-optional": "поле запроса %s стало необязательным", "ru.messages.request-property-became-required": "поле запроса %s стало обязательным", + "ru.messages.request-property-became-required-with-default": "свойство запроса %s стало обязательным со значением по умолчанию", "ru.messages.request-property-default-value-added": "добавлено значение по умолчанию %s для свойства запроса %s", "ru.messages.request-property-default-value-changed": "значение по умолчанию для свойства запроса %s изменено с %s на %s", "ru.messages.request-property-default-value-removed": "удалено значение по умолчанию %s для свойства запроса %s", diff --git a/checker/localizations_src/en/messages.yaml b/checker/localizations_src/en/messages.yaml index 4f90f4de..5a2ce9ca 100644 --- a/checker/localizations_src/en/messages.yaml +++ b/checker/localizations_src/en/messages.yaml @@ -30,6 +30,7 @@ api-sunset-date-changed-too-small: api sunset date changed to earlier date from 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 request-body-became-required: request body became required @@ -72,6 +73,7 @@ request-parameter-min-set-comment: This is a warning because sometimes it is req request-parameter-type-changed: for the %s request parameter %s, the type/format was changed 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 @@ -308,6 +310,7 @@ new-required-request-default-parameter-to-existing-path-description: required re new-required-request-header-property-description: new required request header new-required-request-parameter-description: required request parameter added to endpoint new-required-request-property-description: required property added to request +new-required-request-property-with-default-description: required property with default value added to request optional-response-header-removed-description: optional response header deleted parsing-error-description: invalid stability level request-body-all-of-added-description: sub-schema added to allOf in request body @@ -392,9 +395,10 @@ request-property-became-not-nullable-description: request property became not nu request-property-became-nullable-description: request property became nullable request-property-became-optional-description: request property became optional request-property-became-required-description: request property became required +request-property-became-required-with-default-description: request property with a default value became required request-property-default-value-added-description: request property default value set -request-property-default-value-changed-description: request property default-value changed -request-property-default-value-removed-description: request property default-value unset +request-property-default-value-changed-description: request property default value changed +request-property-default-value-removed-description: request property default value unset request-property-discriminator-added-description: request property discriminator added request-property-discriminator-mapping-added-description: request property discriminator mapping added request-property-discriminator-mapping-changed-description: request property discriminator mapping changed diff --git a/checker/localizations_src/ru/messages.yaml b/checker/localizations_src/ru/messages.yaml index 3164e8a8..66c9d888 100644 --- a/checker/localizations_src/ru/messages.yaml +++ b/checker/localizations_src/ru/messages.yaml @@ -30,6 +30,7 @@ api-sunset-date-changed-too-small: дата sunset у API изменена на new-required-request-parameter: добавлен новый обязательный %s параметр зароса %s new-optional-request-parameter: добавлен новый необязательный %s параметр зароса %s new-required-request-property: добавлено новое обязательное поле запроса %s +new-required-request-property-with-default: добавлено новое обязательное поле запроса %s со значением по умолчанию new-optional-request-property: добавлено новое необязательное поле запроса %s new-required-request-header-property: в заголовке запроса %s добавлено новое обязательное поле %s request-body-became-required: тело запроса стало обязательным @@ -72,6 +73,7 @@ request-parameter-min-set-comment: Это предупреждение, пото request-parameter-type-changed: в %s параметре запроса %s, type/format изменился с %s/%s на %s/%s new-request-path-parameter: добален новый path параметр запроса %s request-property-became-required: поле запроса %s стало обязательным +request-property-became-required-with-default: свойство запроса %s стало обязательным со значением по умолчанию request-property-became-optional: поле запроса %s стало необязательным request-property-became-not-nullable: свойство запроса %s стало недействительным request-property-became-nullable: свойство запроса %s стало обнуляемым diff --git a/checker/rules.go b/checker/rules.go index 1ca46fb2..007bb1df 100644 --- a/checker/rules.go +++ b/checker/rules.go @@ -218,6 +218,7 @@ func GetAllRules() []BackwardCompatibilityRule { newBackwardCompatibilityRule(RequestPropertyPatternChangedId, WARN, true, RequestPropertyPatternUpdatedCheck), // RequestPropertyRequiredUpdatedCheck newBackwardCompatibilityRule(RequestPropertyBecameRequiredId, ERR, true, RequestPropertyRequiredUpdatedCheck), + newBackwardCompatibilityRule(RequestPropertyBecameRequiredWithDefaultId, INFO, true, RequestPropertyRequiredUpdatedCheck), newBackwardCompatibilityRule(RequestPropertyBecameOptionalId, INFO, true, RequestPropertyRequiredUpdatedCheck), // RequestPropertyTypeChangedCheck newBackwardCompatibilityRule(RequestBodyTypeChangedId, ERR, true, RequestPropertyTypeChangedCheck), @@ -225,6 +226,7 @@ func GetAllRules() []BackwardCompatibilityRule { // RequestPropertyUpdatedCheck newBackwardCompatibilityRule(RequestPropertyRemovedId, WARN, true, RequestPropertyUpdatedCheck), newBackwardCompatibilityRule(NewRequiredRequestPropertyId, ERR, true, RequestPropertyUpdatedCheck), + newBackwardCompatibilityRule(NewRequiredRequestPropertyWithDefaultId, INFO, true, RequestPropertyUpdatedCheck), newBackwardCompatibilityRule(NewOptionalRequestPropertyId, INFO, true, RequestPropertyUpdatedCheck), // RequestPropertyWriteOnlyReadOnlyCheck newBackwardCompatibilityRule(RequestOptionalPropertyBecameNonWriteOnlyCheckId, INFO, true, RequestPropertyWriteOnlyReadOnlyCheck), diff --git a/data/checker/request_property_added_with_default.yaml b/data/checker/request_property_added_with_default.yaml new file mode 100644 index 00000000..d6fd2c72 --- /dev/null +++ b/data/checker/request_property_added_with_default.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.0 +info: + title: Sample API + version: 1.0.0 +paths: + /products: + post: + operationId: addProduct + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: + type: string + default: "default description" + required: + - name + - description + responses: + '200': + description: OK diff --git a/data/required-properties/items3.yaml b/data/required-properties/items3.yaml new file mode 100644 index 00000000..e4de1da8 --- /dev/null +++ b/data/required-properties/items3.yaml @@ -0,0 +1,23 @@ +openapi: 3.0.1 +info: + title: Swagger API + version: v1 +paths: + /test: + post: + requestBody: + content: + application/json: + schema: + type: array + items: + type: object + required: + - id + properties: + id: + type: string + default: '1' + responses: + '200': + description: Success diff --git a/docs/BREAKING-CHANGES-EXAMPLES.md b/docs/BREAKING-CHANGES-EXAMPLES.md index e00d4b99..6a4eca0b 100644 --- a/docs/BREAKING-CHANGES-EXAMPLES.md +++ b/docs/BREAKING-CHANGES-EXAMPLES.md @@ -12,18 +12,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#L644) +[changing a response property to optional under AllOf, AnyOf or OneOf is breaking](../checker/check_breaking_property_test.go?plain=1#L660) [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#L612) -[changing an existing property in request body items to required is breaking](../checker/check_breaking_property_test.go?plain=1#L596) +[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 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#L628) +[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 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) @@ -99,6 +99,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#L176) +[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 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) @@ -156,6 +157,7 @@ These examples are automatically generated from unit tests. [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 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) @@ -272,6 +274,7 @@ These examples are automatically generated from unit tests. [increasing minimum value of request property](../checker/check_request_property_min_updated_test.go?plain=1#L12) [increasing request body maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L64) [increasing request property maximum value](../checker/check_request_property_max_updated_test.go?plain=1#L38) +[making request property required, while also giving it a default value](../checker/check_request_property_required_updated_test.go?plain=1#L58) [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_deprecation_test.go?plain=1#L335)