From 29cc0cc06beb46b8c5eef796c34a6fd78c876447 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 7 Sep 2024 16:09:49 +0300 Subject: [PATCH 01/28] add generator package --- checker/generator/checks_test.go | 12 ++ checker/generator/data.go | 170 +++++++++++++++++++++++ checker/generator/doc.go | 4 + checker/generator/generator.go | 139 +++++++++++++++++++ checker/generator/messages.yaml | 225 +++++++++++++++++++++++++++++++ checker/generator/value_set.go | 103 ++++++++++++++ go.mod | 1 + go.sum | 2 + 8 files changed, 656 insertions(+) create mode 100644 checker/generator/checks_test.go create mode 100644 checker/generator/data.go create mode 100644 checker/generator/doc.go create mode 100644 checker/generator/generator.go create mode 100644 checker/generator/messages.yaml create mode 100644 checker/generator/value_set.go 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/data.go b/checker/generator/data.go new file mode 100644 index 00000000..f1601879 --- /dev/null +++ b/checker/generator/data.go @@ -0,0 +1,170 @@ +package generator + +import "slices" + +func getAll() ValueSets { + return slices.Concat( + getEndpoints(), + getRequest(), + getResponse(), + getComponents(), + ) +} + +func getRequest() ValueSets { + return slices.Concat( + 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"}, schemaValueSets), + NewValueSets([]string{"property", "media-type", "response"}, schemaValueSets), + ) +} + +func getEndpoints() ValueSets { + return NewValueSets(nil, endpointValueSets) +} + +func getComponents() ValueSets { + return slices.Concat( + getSecurity(), + ) +} + +func getSecurity() ValueSets { + return NewValueSets(nil, securityValueSets) +} + +var securityValueSets = ValueSets{ + ValueSetB{ + predicativeAdjective: "%s", + nouns: []string{"endpoint scheme security"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + predicativeAdjective: "%s", + hierarchy: []string{"global security scheme"}, + nouns: []string{"security scope"}, + actions: []string{"add", "remove"}, + }, +} + +var endpointValueSets = ValueSets{ + ValueSetA{ + nouns: []string{"stability"}, // /Paths/PathItem/Operation + actions: []string{"decrease"}, + }, + ValueSetA{ + nouns: []string{"api path", "api"}, + actions: []string{"remove"}, + adverb: []string{"without deprecation", "before sunset"}, + }, + ValueSetB{ + nouns: []string{"endpoint"}, // /Paths/PathItem + actions: []string{"add", "remove", "deprecate", "reactivate"}, + }, + ValueSetB{ + predicativeAdjective: "%s", + 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"}, + nouns: []string{"security scope"}, + actions: []string{"add", "remove"}, + }, +} + +var operationValueSets = ValueSets{ + ValueSetB{ + 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{ + predicativeAdjective: "value", + 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", "generalize"}, + }, + ValueSetA{ + nouns: []string{"required property", "optional property"}, + actions: []string{"change"}, + }, + ValueSetB{ + predicativeAdjective: "%s", + nouns: []string{"pattern"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + nouns: []string{"default value"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + predicativeAdjective: "%s", + hierarchy: []string{"anyOf list"}, + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + predicativeAdjective: "%s", + hierarchy: []string{"anyOf list"}, + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + predicativeAdjective: "%s", + hierarchy: []string{"anyOf list"}, + nouns: []string{"schema"}, + actions: []string{"add", "remove"}, + }, + ValueSetB{ + predicativeAdjective: "%s", + nouns: []string{"discriminator", "mapping keys"}, + 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/doc.go b/checker/generator/doc.go new file mode 100644 index 00000000..9071d153 --- /dev/null +++ b/checker/generator/doc.go @@ -0,0 +1,4 @@ +/* +Package generator generates the messages for the checker package. +*/ +package generator diff --git a/checker/generator/generator.go b/checker/generator/generator.go new file mode 100644 index 00000000..3831d168 --- /dev/null +++ b/checker/generator/generator.go @@ -0,0 +1,139 @@ +package generator + +import ( + "os" + "slices" + "strings" + + "github.com/iancoleman/strcase" +) + +func Generate() error { + out, err := os.Create("messages.yaml") + if err != nil { + return err + } + defer out.Close() + + getAll().generate(out) + + 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(strings.Join(filterStrings([]string{concat(hierarchy), noun, conjugate(action)}, isEmpty), "-")) +} + +func concat(list []string) string { + if len(list) == 0 { + return "" + } + + copy := slices.Clone(list) + slices.Reverse(copy) + return strings.Join(copy, "-") +} + +func getHierarchyPostfix(action string, hierarchy []string) string { + if len(hierarchy) == 0 { + return "" + } + + return getPreposition(action) + " " + getHierarchyMessage(hierarchy) +} + +func getHierarchyMessage(hierarchy []string) string { + + copy := slices.Clone(hierarchy) + + 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]) { + result += " %s" + } + + return result +} + +func isTopLevel(s string) bool { + return s == "request body" || + s == "paths" +} + +func isAtttibuted(s string) bool { + return s == "request parameter" +} + +func standardizeSpaces(s string) string { + return strings.Join(strings.Fields(s), " ") +} + +func getActionMessage(action string) string { + switch getArity(action) { + case 0: + return "" + case 1: + return " to %s" + case 2: + return " from %s to %s" + default: + return "" + } +} + +func getArity(action string) int { + switch action { + case "add", "remove": + return 0 + case "set": + return 1 + } + return 2 +} + +func conjugate(verb string) string { + switch verb { + case "set": + return "set" + case "add": + return "added" + case "become": + return "became" + } + return verb + "d" +} + +func getPreposition(action string) string { + switch action { + case "add": + return "to" + } + return "from" +} + +func addAttribute(noun, attributiveAdjective, predicativeAdjective string) string { + return strings.Join([]string{attributiveAdjective + " " + noun + " " + predicativeAdjective}, " ") +} diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml new file mode 100644 index 00000000..79612083 --- /dev/null +++ b/checker/generator/messages.yaml @@ -0,0 +1,225 @@ +stability-decreased: stability was decreased from %s to %s +api-path-removed: api path was removed 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 +endpoint-reactivated: reactivated endpoint +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 +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-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 +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-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 +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 +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-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 +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-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 +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 +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 %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-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 +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 +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 +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-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 +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-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 +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 +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-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 +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-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 +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 diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go new file mode 100644 index 00000000..c9b34a63 --- /dev/null +++ b/checker/generator/value_set.go @@ -0,0 +1,103 @@ +package generator + +import ( + "fmt" + "io" + "strings" +) + +type ValueSets []IValueSet + +// NewValueSets creates a new ValueSets object +func NewValueSets(hierarchy []string, valueSets ValueSets) ValueSets { + + result := make(ValueSets, len(valueSets)) + + for i, vs := range valueSets { + result[i] = vs.setHierarchy(hierarchy) + } + + return result +} + +func (vs ValueSets) generate(out io.Writer) { + for _, v := range vs { + v.generate(out) + } +} + +type IValueSet interface { + generate(out io.Writer) + 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 + nouns []string + actions []string + adverb []string +} + +func (v ValueSet) setHierarchy(hierarchy []string) ValueSet { + if len(hierarchy) == 0 { + return v + } + + v.hierarchy = append(v.hierarchy, hierarchy...) + + return v +} + +// ValueSetA messages start with the noun +type ValueSetA ValueSet + +func (v ValueSetA) setHierarchy(hierarchy []string) IValueSet { + return ValueSetA(ValueSet(v).setHierarchy(hierarchy)) +} + +func (v ValueSetA) generate(out io.Writer) { + 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 %s %s", prefix, conjugate(action), getActionMessage(action), adverb)) + } + + for _, noun := range v.nouns { + for _, action := range v.actions { + id := generateId(v.hierarchy, noun, action) + + 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)) + } + } + } +} + +// ValueSetB messages start with the action +type ValueSetB ValueSet + +func (v ValueSetB) setHierarchy(hierarchy []string) IValueSet { + return ValueSetB(ValueSet(v).setHierarchy(hierarchy)) +} + +func (v ValueSetB) generate(out io.Writer) { + 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, noun, v.attributiveAdjective, v.predicativeAdjective, action))) + } + } +} diff --git a/go.mod b/go.mod index 135aec61..6047a603 100644 --- a/go.mod +++ b/go.mod @@ -44,6 +44,7 @@ require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect + github.com/iancoleman/strcase v0.3.0 github.com/invopop/yaml v0.3.1 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect 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= From 77a27707ef86e3630d9010d2ad0d25ccddb2dc1b Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 7 Sep 2024 16:15:56 +0300 Subject: [PATCH 02/28] stop using fmt.Fprintln --- checker/generator/value_set.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index c9b34a63..bb780235 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -77,7 +77,7 @@ func (v ValueSetA) generate(out io.Writer) { } for _, adverb := range adverbs { message := generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action, adverb) - fmt.Fprintln(out, fmt.Sprintf("%s: %s", id, message)) + fmt.Fprintf(out, "%s: %s\n", id, message) } } } @@ -97,7 +97,7 @@ func (v ValueSetB) 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, noun, v.attributiveAdjective, v.predicativeAdjective, action))) + fmt.Fprintf(out, "%s: %s\n", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action)) } } } From d2de625169783c0996dfe7cf7d7fb3aa1849b501 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 7 Sep 2024 16:17:25 +0300 Subject: [PATCH 03/28] remove "become" --- checker/generator/generator.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/checker/generator/generator.go b/checker/generator/generator.go index 3831d168..7bb97933 100644 --- a/checker/generator/generator.go +++ b/checker/generator/generator.go @@ -120,8 +120,6 @@ func conjugate(verb string) string { return "set" case "add": return "added" - case "become": - return "became" } return verb + "d" } From 6f0de066dcb12321f3fb81752c1d1361b764c15d Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 7 Sep 2024 23:31:40 +0300 Subject: [PATCH 04/28] top level is request body only --- checker/generator/generator.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/checker/generator/generator.go b/checker/generator/generator.go index 7bb97933..d606a6ce 100644 --- a/checker/generator/generator.go +++ b/checker/generator/generator.go @@ -79,8 +79,7 @@ func getHierarchyMessage(hierarchy []string) string { } func isTopLevel(s string) bool { - return s == "request body" || - s == "paths" + return s == "request body" } func isAtttibuted(s string) bool { From 09876b7ae012608f6abba1d9d75c2b6706255e34 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 7 Sep 2024 23:38:14 +0300 Subject: [PATCH 05/28] noun -> object --- checker/generator/data.go | 44 +++++++++++++++++----------------- checker/generator/generator.go | 12 +++++----- checker/generator/value_set.go | 14 +++++------ 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/checker/generator/data.go b/checker/generator/data.go index f1601879..c72c871a 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -44,62 +44,62 @@ func getSecurity() ValueSets { var securityValueSets = ValueSets{ ValueSetB{ predicativeAdjective: "%s", - nouns: []string{"endpoint scheme security"}, + objects: []string{"endpoint scheme security"}, actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"global security scheme"}, - nouns: []string{"security scope"}, + objects: []string{"security scope"}, actions: []string{"add", "remove"}, }, } var endpointValueSets = ValueSets{ ValueSetA{ - nouns: []string{"stability"}, // /Paths/PathItem/Operation + objects: []string{"stability"}, // /Paths/PathItem/Operation actions: []string{"decrease"}, }, ValueSetA{ - nouns: []string{"api path", "api"}, + objects: []string{"api path", "api"}, actions: []string{"remove"}, adverb: []string{"without deprecation", "before sunset"}, }, ValueSetB{ - nouns: []string{"endpoint"}, // /Paths/PathItem + objects: []string{"endpoint"}, // /Paths/PathItem actions: []string{"add", "remove", "deprecate", "reactivate"}, }, ValueSetB{ predicativeAdjective: "%s", - nouns: []string{"success response status", "non-success response status"}, // /Paths/PathItem/Operation/Responses/Response/content/media-type/ + objects: []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"}, + objects: []string{"operation id"}, actions: []string{"change"}, }, ValueSetB{ predicativeAdjective: "%s", - nouns: []string{"operation id", "tag"}, + objects: []string{"operation id", "tag"}, actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"endpoint security scheme"}, - nouns: []string{"security scope"}, + objects: []string{"security scope"}, actions: []string{"add", "remove"}, }, } var operationValueSets = ValueSets{ ValueSetB{ - nouns: []string{"required request body", "optional request body"}, + objects: []string{"required request body", "optional request body"}, actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", attributiveAdjective: "%s", - nouns: []string{"request parameter"}, + objects: []string{"request parameter"}, actions: []string{"add", "remove"}, }, } @@ -107,55 +107,55 @@ var operationValueSets = ValueSets{ var schemaValueSets = ValueSets{ ValueSetA{ predicativeAdjective: "value", - nouns: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, + objects: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, actions: []string{"set", "increase", "decrease"}, }, ValueSetA{ - nouns: []string{"type/format"}, + objects: []string{"type/format"}, actions: []string{"change", "generalize"}, }, ValueSetA{ - nouns: []string{"discriminator property name"}, + objects: []string{"discriminator property name"}, actions: []string{"change"}, }, ValueSetA{ - nouns: []string{"pattern"}, + objects: []string{"pattern"}, actions: []string{"change", "generalize"}, }, ValueSetA{ - nouns: []string{"required property", "optional property"}, + objects: []string{"required property", "optional property"}, actions: []string{"change"}, }, ValueSetB{ predicativeAdjective: "%s", - nouns: []string{"pattern"}, + objects: []string{"pattern"}, actions: []string{"add", "remove"}, }, ValueSetB{ - nouns: []string{"default value"}, + objects: []string{"default value"}, actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"anyOf list"}, - nouns: []string{"schema"}, + objects: []string{"schema"}, actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"anyOf list"}, - nouns: []string{"schema"}, + objects: []string{"schema"}, actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", hierarchy: []string{"anyOf list"}, - nouns: []string{"schema"}, + objects: []string{"schema"}, actions: []string{"add", "remove"}, }, ValueSetB{ predicativeAdjective: "%s", - nouns: []string{"discriminator", "mapping keys"}, + objects: []string{"discriminator", "mapping keys"}, actions: []string{"add", "remove"}, }, } diff --git a/checker/generator/generator.go b/checker/generator/generator.go index d606a6ce..2933bb82 100644 --- a/checker/generator/generator.go +++ b/checker/generator/generator.go @@ -34,12 +34,12 @@ func filterStrings(list []string, f func(string) bool) []string { return result } -func generateId(hierarchy []string, noun, action string) string { - if before, _, found := strings.Cut(noun, "/"); found { - noun = before +func generateId(hierarchy []string, object, action string) string { + if prefix, _, found := strings.Cut(object, "/"); found { + object = prefix } - return strcase.ToKebab(strings.Join(filterStrings([]string{concat(hierarchy), noun, conjugate(action)}, isEmpty), "-")) + return strcase.ToKebab(strings.Join(filterStrings([]string{concat(hierarchy), object, conjugate(action)}, isEmpty), "-")) } func concat(list []string) string { @@ -131,6 +131,6 @@ func getPreposition(action string) string { return "from" } -func addAttribute(noun, attributiveAdjective, predicativeAdjective string) string { - return strings.Join([]string{attributiveAdjective + " " + noun + " " + predicativeAdjective}, " ") +func addAttribute(object, attributiveAdjective, predicativeAdjective string) string { + return strings.Join([]string{attributiveAdjective + " " + object + " " + predicativeAdjective}, " ") } diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index bb780235..a5731e6e 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -35,7 +35,7 @@ type ValueSet struct { attributiveAdjective string // attributive adjectives are added before the noun predicativeAdjective string // predicative adjectives are added after the noun hierarchy []string - nouns []string + objects []string actions []string adverb []string } @@ -58,8 +58,8 @@ func (v ValueSetA) setHierarchy(hierarchy []string) IValueSet { } func (v ValueSetA) generate(out io.Writer) { - generateMessage := func(hierarchy []string, noun, attributiveAdjective, predicativeAdjective, action, adverb string) string { - prefix := addAttribute(noun, attributiveAdjective, predicativeAdjective) + generateMessage := func(hierarchy []string, object, attributiveAdjective, predicativeAdjective, action, adverb string) string { + prefix := addAttribute(object, attributiveAdjective, predicativeAdjective) if hierarchyMessage := getHierarchyMessage(hierarchy); hierarchyMessage != "" { prefix += " of " + hierarchyMessage } @@ -67,16 +67,16 @@ func (v ValueSetA) generate(out io.Writer) { return standardizeSpaces(fmt.Sprintf("%s was %s %s %s", prefix, conjugate(action), getActionMessage(action), adverb)) } - for _, noun := range v.nouns { + for _, object := range v.objects { for _, action := range v.actions { - id := generateId(v.hierarchy, noun, action) + id := generateId(v.hierarchy, object, action) adverbs := v.adverb if v.adverb == nil { adverbs = []string{""} } for _, adverb := range adverbs { - message := generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action, adverb) + message := generateMessage(v.hierarchy, object, v.attributiveAdjective, v.predicativeAdjective, action, adverb) fmt.Fprintf(out, "%s: %s\n", id, message) } } @@ -95,7 +95,7 @@ func (v ValueSetB) generate(out io.Writer) { return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(noun, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy)}, " ")) } - for _, noun := range v.nouns { + for _, noun := range v.objects { for _, action := range v.actions { fmt.Fprintf(out, "%s: %s\n", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action)) } From cd1ba93f9743503e186217ddbd779a81c452d323 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sat, 7 Sep 2024 23:46:10 +0300 Subject: [PATCH 06/28] improve readability --- checker/generator/value_set.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index a5731e6e..3027e32c 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -32,8 +32,8 @@ type IValueSet interface { } type ValueSet struct { - attributiveAdjective string // attributive adjectives are added before the noun - predicativeAdjective string // predicative adjectives are added after the noun + attributiveAdjective string // attributive adjectives are added before the object + predicativeAdjective string // predicative adjectives are added after the object hierarchy []string objects []string actions []string @@ -41,16 +41,15 @@ type ValueSet struct { } func (v ValueSet) setHierarchy(hierarchy []string) ValueSet { - if len(hierarchy) == 0 { - return v + if len(hierarchy) > 0 { + v.hierarchy = append(v.hierarchy, hierarchy...) } - v.hierarchy = append(v.hierarchy, hierarchy...) - return v } -// ValueSetA messages start with the noun +// ValueSetA messages start with the object +// for example: "api was removed without deprecation" type ValueSetA ValueSet func (v ValueSetA) setHierarchy(hierarchy []string) IValueSet { @@ -84,6 +83,7 @@ func (v ValueSetA) generate(out io.Writer) { } // ValueSetB messages start with the action +// for example: "removed %s request parameter %s" type ValueSetB ValueSet func (v ValueSetB) setHierarchy(hierarchy []string) IValueSet { @@ -91,13 +91,13 @@ func (v ValueSetB) setHierarchy(hierarchy []string) IValueSet { } func (v ValueSetB) generate(out io.Writer) { - generateMessage := func(hierarchy []string, noun, attributiveAdjective, predicativeAdjective, action string) string { - return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(noun, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy)}, " ")) + generateMessage := func(hierarchy []string, object, attributiveAdjective, predicativeAdjective, action string) string { + return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(object, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy)}, " ")) } - for _, noun := range v.objects { + for _, object := range v.objects { for _, action := range v.actions { - fmt.Fprintf(out, "%s: %s\n", generateId(v.hierarchy, noun, action), generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action)) + fmt.Fprintf(out, "%s: %s\n", generateId(v.hierarchy, object, action), generateMessage(v.hierarchy, object, v.attributiveAdjective, v.predicativeAdjective, action)) } } } From b42c0b2e5abd745da59da50e59a4fe70d58f762e Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 9 Sep 2024 23:51:39 +0300 Subject: [PATCH 07/28] generate messages from yaml --- checker/generator/checks_test.go | 6 +- checker/generator/data.go | 130 +++++++++++++++---------------- checker/generator/generator.go | 15 +++- checker/generator/tree.go | 86 ++++++++++++++++++++ checker/generator/tree.yaml | 60 ++++++++++++++ checker/generator/value_set.go | 34 ++++---- 6 files changed, 247 insertions(+), 84 deletions(-) create mode 100644 checker/generator/tree.go create mode 100644 checker/generator/tree.yaml diff --git a/checker/generator/checks_test.go b/checker/generator/checks_test.go index 877cb293..9df97b40 100644 --- a/checker/generator/checks_test.go +++ b/checker/generator/checks_test.go @@ -8,5 +8,9 @@ import ( ) func TestGenerator(t *testing.T) { - require.NoError(t, generator.Generate()) + require.NoError(t, generator.Generate(generator.GetAll)) +} + +func TestTreeGenerator(t *testing.T) { + require.NoError(t, generator.Generate(generator.GetTree)) } diff --git a/checker/generator/data.go b/checker/generator/data.go index c72c871a..e98392bc 100644 --- a/checker/generator/data.go +++ b/checker/generator/data.go @@ -2,13 +2,13 @@ package generator import "slices" -func getAll() ValueSets { +func GetAll() (MessageGenerator, error) { return slices.Concat( getEndpoints(), getRequest(), getResponse(), getComponents(), - ) + ), nil } func getRequest() ValueSets { @@ -43,120 +43,120 @@ func getSecurity() ValueSets { var securityValueSets = ValueSets{ ValueSetB{ - predicativeAdjective: "%s", - objects: []string{"endpoint scheme security"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Names: []string{"endpoint scheme security"}, + Actions: []string{"add", "remove"}, }, ValueSetB{ - predicativeAdjective: "%s", - hierarchy: []string{"global security scheme"}, - objects: []string{"security scope"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Hierarchy: []string{"global security scheme"}, + Names: []string{"security scope"}, + Actions: []string{"add", "remove"}, }, } var endpointValueSets = ValueSets{ ValueSetA{ - objects: []string{"stability"}, // /Paths/PathItem/Operation - actions: []string{"decrease"}, + Names: []string{"stability"}, // /Paths/PathItem/Operation + Actions: []string{"decrease"}, }, ValueSetA{ - objects: []string{"api path", "api"}, - actions: []string{"remove"}, - adverb: []string{"without deprecation", "before sunset"}, + Names: []string{"api path", "api"}, + Actions: []string{"remove"}, + Adverbs: []string{"without deprecation", "before sunset"}, }, ValueSetB{ - objects: []string{"endpoint"}, // /Paths/PathItem - actions: []string{"add", "remove", "deprecate", "reactivate"}, + Names: []string{"endpoint"}, // /Paths/PathItem + Actions: []string{"add", "remove", "deprecate", "reactivate"}, }, ValueSetB{ - predicativeAdjective: "%s", - objects: []string{"success response status", "non-success response status"}, // /Paths/PathItem/Operation/Responses/Response/content/media-type/ - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Names: []string{"success response status", "non-success response status"}, // /Paths/PathItem/Operation/Responses/Response/content/media-type/ + Actions: []string{"add", "remove"}, }, ValueSetA{ - objects: []string{"operation id"}, - actions: []string{"change"}, + Names: []string{"operation id"}, + Actions: []string{"change"}, }, ValueSetB{ - predicativeAdjective: "%s", - objects: []string{"operation id", "tag"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Names: []string{"operation id", "tag"}, + Actions: []string{"add", "remove"}, }, ValueSetB{ - predicativeAdjective: "%s", - hierarchy: []string{"endpoint security scheme"}, - objects: []string{"security scope"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Hierarchy: []string{"endpoint security scheme"}, + Names: []string{"security scope"}, + Actions: []string{"add", "remove"}, }, } var operationValueSets = ValueSets{ ValueSetB{ - objects: []string{"required request body", "optional request body"}, - actions: []string{"add", "remove"}, + Names: []string{"required request body", "optional request body"}, + Actions: []string{"add", "remove"}, }, ValueSetB{ - predicativeAdjective: "%s", - attributiveAdjective: "%s", - objects: []string{"request parameter"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + AttributiveAdjective: "%s", + Names: []string{"request parameter"}, + Actions: []string{"add", "remove"}, }, } var schemaValueSets = ValueSets{ ValueSetA{ - predicativeAdjective: "value", - objects: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, - actions: []string{"set", "increase", "decrease"}, + PredicativeAdjective: "value", + Names: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, + Actions: []string{"set", "increase", "decrease"}, }, ValueSetA{ - objects: []string{"type/format"}, - actions: []string{"change", "generalize"}, + Names: []string{"type/format"}, + Actions: []string{"change", "generalize"}, }, ValueSetA{ - objects: []string{"discriminator property name"}, - actions: []string{"change"}, + Names: []string{"discriminator property name"}, + Actions: []string{"change"}, }, ValueSetA{ - objects: []string{"pattern"}, - actions: []string{"change", "generalize"}, + Names: []string{"pattern"}, + Actions: []string{"change", "generalize"}, }, ValueSetA{ - objects: []string{"required property", "optional property"}, - actions: []string{"change"}, + Names: []string{"required property", "optional property"}, + Actions: []string{"change"}, }, ValueSetB{ - predicativeAdjective: "%s", - objects: []string{"pattern"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Names: []string{"pattern"}, + Actions: []string{"add", "remove"}, }, ValueSetB{ - objects: []string{"default value"}, - actions: []string{"add", "remove"}, + Names: []string{"default value"}, + Actions: []string{"add", "remove"}, }, ValueSetB{ - predicativeAdjective: "%s", - hierarchy: []string{"anyOf list"}, - objects: []string{"schema"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Hierarchy: []string{"anyOf list"}, + Names: []string{"schema"}, + Actions: []string{"add", "remove"}, }, ValueSetB{ - predicativeAdjective: "%s", - hierarchy: []string{"anyOf list"}, - objects: []string{"schema"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Hierarchy: []string{"anyOf list"}, + Names: []string{"schema"}, + Actions: []string{"add", "remove"}, }, ValueSetB{ - predicativeAdjective: "%s", - hierarchy: []string{"anyOf list"}, - objects: []string{"schema"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Hierarchy: []string{"anyOf list"}, + Names: []string{"schema"}, + Actions: []string{"add", "remove"}, }, ValueSetB{ - predicativeAdjective: "%s", - objects: []string{"discriminator", "mapping keys"}, - actions: []string{"add", "remove"}, + PredicativeAdjective: "%s", + Names: []string{"discriminator", "mapping keys"}, + Actions: []string{"add", "remove"}, }, } diff --git a/checker/generator/generator.go b/checker/generator/generator.go index 2933bb82..a4d1ae42 100644 --- a/checker/generator/generator.go +++ b/checker/generator/generator.go @@ -1,6 +1,7 @@ package generator import ( + "io" "os" "slices" "strings" @@ -8,15 +9,25 @@ import ( "github.com/iancoleman/strcase" ) -func Generate() error { +type MessageGenerator interface { + generate(out io.Writer) +} + +type Getter func() (MessageGenerator, error) + +func Generate(getter Getter) error { out, err := os.Create("messages.yaml") if err != nil { return err } defer out.Close() - getAll().generate(out) + data, err := getter() + if err != nil { + return err + } + data.generate(out) return nil } diff --git a/checker/generator/tree.go b/checker/generator/tree.go new file mode 100644 index 00000000..f1e94b5c --- /dev/null +++ b/checker/generator/tree.go @@ -0,0 +1,86 @@ +package generator + +import ( + "fmt" + "io" + "os" + + "gopkg.in/yaml.v3" +) + +type ChangeMap map[string]Changes + +type Changes struct { + ExcludeFromHierarchy bool `yaml:"excludeFromHierarchy"` + Actions map[string]Objects `yaml:"actions"` + NextLevel ChangeMap `yaml:"nextLevel"` +} + +type Objects []*Object + +type Object struct { + Hierarchy []string `yaml:"hierarchy"` + Object string `yaml:"object"` + Adverbs []string `yaml:"adverbs"` + StartWith string `yaml:"startWith"` + PredicativeAdjective string `yaml:"predicativeAdjective"` + AttributiveAdjective string `yaml:"attributiveAdjective"` +} + +func GetTree() (MessageGenerator, error) { + yamlFile, err := os.ReadFile("tree.yaml") + if err != nil { + return nil, fmt.Errorf("yamlFile.Get err #%v ", err) + } + + var changeMap ChangeMap + err = yaml.Unmarshal(yamlFile, &changeMap) + if err != nil { + return nil, fmt.Errorf("unmarshal: %v", err) + } + + return changeMap, nil +} + +func (changeMap ChangeMap) generate(out io.Writer) { + fillHierarchy(changeMap, nil) + + for _, change := range changeMap { + for action, objects := range change.Actions { + for _, object := range objects { + getValueSet(object, action).generate(out) + } + } + change.NextLevel.generate(out) + } +} + +func fillHierarchy(changeMap ChangeMap, hierarchy []string) { + for container, change := range changeMap { + if !change.ExcludeFromHierarchy { + hierarchy = append([]string{container}, hierarchy...) + } + for _, objects := range change.Actions { + for _, object := range objects { + object.Hierarchy = hierarchy + } + } + fillHierarchy(change.NextLevel, hierarchy) + } +} + +func getValueSet(object *Object, action string) IValueSet { + valueSet := ValueSet{ + AttributiveAdjective: object.AttributiveAdjective, + PredicativeAdjective: object.PredicativeAdjective, + Hierarchy: object.Hierarchy, + Names: []string{object.Object}, + Actions: []string{action}, + Adverbs: object.Adverbs, + } + + if object.StartWith == "object" { + return ValueSetA(valueSet) + } + return ValueSetB(valueSet) +} diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml new file mode 100644 index 00000000..c62e5092 --- /dev/null +++ b/checker/generator/tree.yaml @@ -0,0 +1,60 @@ +paths: + excludeFromHierarchy: true + actions: + remove: + - object: path + adverbs: + - without deprecation + - before sunset + startWith: object + nextLevel: + operations: + excludeFromHierarchy: true + actions: + remove: + - object: endpoint + adverbs: + - without deprecation + - before sunset + startWith: object + - object: endpoint + startWith: action + add: + - object: endpoint + startWith: action + deprecate: + - object: endpoint + startWith: action + reactivate: + - object: endpoint + startWith: action + nextLevel: + endpoint: + excludeFromHierarchy: true + actions: + change: + - object: operation id + startWith: object + decrease: + - object: stability + startWith: object + nextLevel: + responses: + excludeFromHierarchy: true + actions: + add: + - object: success response + predicativeAdjective: "status %s" + startWith: action + - object: non-success response + predicativeAdjective: "status %s" + startWith: action + remove: + - object: success response + predicativeAdjective: "status %s" + startWith: action + - object: non-success response + predicativeAdjective: "status %s" + startWith: action + + diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index 3027e32c..e3dacae8 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -31,18 +31,20 @@ type IValueSet interface { setHierarchy(hierarchy []string) IValueSet } +type ValueSetList []ValueSet + type ValueSet struct { - attributiveAdjective string // attributive adjectives are added before the object - predicativeAdjective string // predicative adjectives are added after the object - hierarchy []string - objects []string - actions []string - adverb []string + AttributiveAdjective string // attributive adjectives are added before the object + PredicativeAdjective string // predicative adjectives are added after the object + Hierarchy []string + Names []string + Actions []string + Adverbs []string } func (v ValueSet) setHierarchy(hierarchy []string) ValueSet { if len(hierarchy) > 0 { - v.hierarchy = append(v.hierarchy, hierarchy...) + v.Hierarchy = append(v.Hierarchy, hierarchy...) } return v @@ -66,16 +68,16 @@ func (v ValueSetA) generate(out io.Writer) { return standardizeSpaces(fmt.Sprintf("%s was %s %s %s", prefix, conjugate(action), getActionMessage(action), adverb)) } - for _, object := range v.objects { - for _, action := range v.actions { - id := generateId(v.hierarchy, object, action) + for _, object := range v.Names { + for _, action := range v.Actions { + id := generateId(v.Hierarchy, object, action) - adverbs := v.adverb - if v.adverb == nil { + adverbs := v.Adverbs + if v.Adverbs == nil { adverbs = []string{""} } for _, adverb := range adverbs { - message := generateMessage(v.hierarchy, object, v.attributiveAdjective, v.predicativeAdjective, action, adverb) + message := generateMessage(v.Hierarchy, object, v.AttributiveAdjective, v.PredicativeAdjective, action, adverb) fmt.Fprintf(out, "%s: %s\n", id, message) } } @@ -95,9 +97,9 @@ func (v ValueSetB) generate(out io.Writer) { return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(object, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy)}, " ")) } - for _, object := range v.objects { - for _, action := range v.actions { - fmt.Fprintf(out, "%s: %s\n", generateId(v.hierarchy, object, action), generateMessage(v.hierarchy, object, v.attributiveAdjective, v.predicativeAdjective, action)) + for _, object := range v.Names { + for _, action := range v.Actions { + fmt.Fprintf(out, "%s: %s\n", generateId(v.Hierarchy, object, action), generateMessage(v.Hierarchy, object, v.AttributiveAdjective, v.PredicativeAdjective, action)) } } } From f6d9ac65e9f8f8e84aaa9ba1f45ce61af6dcd672 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 10 Sep 2024 17:43:42 +0300 Subject: [PATCH 08/28] combined add/remove --- checker/generator/tree.go | 10 +++++++++- checker/generator/tree.yaml | 16 ++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/checker/generator/tree.go b/checker/generator/tree.go index f1e94b5c..e9dc7153 100644 --- a/checker/generator/tree.go +++ b/checker/generator/tree.go @@ -4,6 +4,7 @@ import ( "fmt" "io" "os" + "strings" "gopkg.in/yaml.v3" ) @@ -75,7 +76,7 @@ func getValueSet(object *Object, action string) IValueSet { PredicativeAdjective: object.PredicativeAdjective, Hierarchy: object.Hierarchy, Names: []string{object.Object}, - Actions: []string{action}, + Actions: parseAction(action), Adverbs: object.Adverbs, } @@ -84,3 +85,10 @@ func getValueSet(object *Object, action string) IValueSet { } return ValueSetB(valueSet) } + +func parseAction(action string) []string { + if before, after, found := strings.Cut(action, "/"); found { + return []string{before, after} + } + return []string{action} +} diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index c62e5092..71e2b13e 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -2,7 +2,7 @@ paths: excludeFromHierarchy: true actions: remove: - - object: path + - object: api path adverbs: - without deprecation - before sunset @@ -35,6 +35,10 @@ paths: change: - object: operation id startWith: object + add/remove: + - object: operation id + predicativeAdjective: "%s" + startWith: action decrease: - object: stability startWith: object @@ -42,14 +46,7 @@ paths: responses: excludeFromHierarchy: true actions: - add: - - object: success response - predicativeAdjective: "status %s" - startWith: action - - object: non-success response - predicativeAdjective: "status %s" - startWith: action - remove: + add/remove: - object: success response predicativeAdjective: "status %s" startWith: action @@ -57,4 +54,3 @@ paths: predicativeAdjective: "status %s" startWith: action - From 68bba4a0c26a9bcdd3d0a25d58cc02319d33479a Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 10 Sep 2024 17:49:00 +0300 Subject: [PATCH 09/28] allow multiple objects --- checker/generator/tree.go | 4 ++-- checker/generator/tree.yaml | 35 ++++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/checker/generator/tree.go b/checker/generator/tree.go index e9dc7153..4e3a648c 100644 --- a/checker/generator/tree.go +++ b/checker/generator/tree.go @@ -21,7 +21,7 @@ type Objects []*Object type Object struct { Hierarchy []string `yaml:"hierarchy"` - Object string `yaml:"object"` + Objects []string `yaml:"objects"` Adverbs []string `yaml:"adverbs"` StartWith string `yaml:"startWith"` PredicativeAdjective string `yaml:"predicativeAdjective"` @@ -75,7 +75,7 @@ func getValueSet(object *Object, action string) IValueSet { AttributiveAdjective: object.AttributiveAdjective, PredicativeAdjective: object.PredicativeAdjective, Hierarchy: object.Hierarchy, - Names: []string{object.Object}, + Names: object.Objects, Actions: parseAction(action), Adverbs: object.Adverbs, } diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index 71e2b13e..1439881a 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -2,7 +2,8 @@ paths: excludeFromHierarchy: true actions: remove: - - object: api path + - objects: + - api path adverbs: - without deprecation - before sunset @@ -12,45 +13,53 @@ paths: excludeFromHierarchy: true actions: remove: - - object: endpoint + - objects: + - endpoint adverbs: - without deprecation - before sunset startWith: object - - object: endpoint + - objects: + - endpoint startWith: action add: - - object: endpoint + - objects: + - endpoint startWith: action deprecate: - - object: endpoint + - objects: + - endpoint startWith: action reactivate: - - object: endpoint + - objects: + - endpoint startWith: action nextLevel: endpoint: excludeFromHierarchy: true actions: change: - - object: operation id + - objects: + - operation id startWith: object add/remove: - - object: operation id + - objects: + - operation id + - tag predicativeAdjective: "%s" startWith: action decrease: - - object: stability + - objects: + - stability startWith: object nextLevel: responses: excludeFromHierarchy: true actions: add/remove: - - object: success response - predicativeAdjective: "status %s" - startWith: action - - object: non-success response + - objects: + - success response + - non-success response predicativeAdjective: "status %s" startWith: action From 17d7fb187e5aab6971910a3d435f79d2e537d5fc Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 10 Sep 2024 18:07:59 +0300 Subject: [PATCH 10/28] fix hierarchy --- checker/generator/tree.go | 13 ++++++---- checker/generator/tree.yaml | 48 +++++++++++++++---------------------- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/checker/generator/tree.go b/checker/generator/tree.go index 4e3a648c..0edb5ca1 100644 --- a/checker/generator/tree.go +++ b/checker/generator/tree.go @@ -58,18 +58,23 @@ func (changeMap ChangeMap) generate(out io.Writer) { func fillHierarchy(changeMap ChangeMap, hierarchy []string) { for container, change := range changeMap { - if !change.ExcludeFromHierarchy { - hierarchy = append([]string{container}, hierarchy...) - } + containerHierarchy := getContainerHierarchy(container, change, hierarchy) for _, objects := range change.Actions { for _, object := range objects { - object.Hierarchy = hierarchy + object.Hierarchy = containerHierarchy } } fillHierarchy(change.NextLevel, hierarchy) } } +func getContainerHierarchy(container string, change Changes, hierarchy []string) []string { + if change.ExcludeFromHierarchy { + return hierarchy + } + return append([]string{container}, hierarchy...) +} + func getValueSet(object *Object, action string) IValueSet { valueSet := ValueSet{ AttributiveAdjective: object.AttributiveAdjective, diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index 1439881a..5b766891 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -2,64 +2,54 @@ paths: excludeFromHierarchy: true actions: remove: - - objects: - - api path - adverbs: - - without deprecation - - before sunset + - objects: [api path] + adverbs: [without deprecation, before sunset] startWith: object nextLevel: operations: excludeFromHierarchy: true actions: remove: - - objects: - - endpoint - adverbs: - - without deprecation - - before sunset + - objects: [endpoint] + adverbs: [without deprecation, before sunset] startWith: object - - objects: - - endpoint + - objects: [endpoint] startWith: action add: - - objects: - - endpoint + - objects: [endpoint] startWith: action deprecate: - - objects: - - endpoint + - objects: [endpoint] startWith: action reactivate: - - objects: - - endpoint + - objects: [endpoint] startWith: action nextLevel: endpoint: excludeFromHierarchy: true actions: change: - - objects: - - operation id + - objects: [operation id] startWith: object add/remove: - - objects: - - operation id - - tag + - objects: [operation id, tag] predicativeAdjective: "%s" startWith: action decrease: - - objects: - - stability + - objects: [stability] startWith: object nextLevel: + endpoint security scheme: + actions: + add/remove: + - objects: [security scope] + predicativeAdjective: "%s" + startWith: action responses: excludeFromHierarchy: true actions: add/remove: - - objects: - - success response - - non-success response - predicativeAdjective: "status %s" + - objects: [success response status, non-success response status] + predicativeAdjective: "%s" startWith: action From 5ecf0679e622974745b5d6ee5350e9a60f146fb5 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 10 Sep 2024 18:47:06 +0300 Subject: [PATCH 11/28] fix hierarchy --- checker/generator/tree.go | 12 ++++++------ checker/generator/tree.yaml | 11 +++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/checker/generator/tree.go b/checker/generator/tree.go index 0edb5ca1..76ec4bd9 100644 --- a/checker/generator/tree.go +++ b/checker/generator/tree.go @@ -45,14 +45,17 @@ func GetTree() (MessageGenerator, error) { func (changeMap ChangeMap) generate(out io.Writer) { fillHierarchy(changeMap, nil) + generateRecursive(changeMap, out) +} +func generateRecursive(changeMap ChangeMap, out io.Writer) { for _, change := range changeMap { for action, objects := range change.Actions { for _, object := range objects { getValueSet(object, action).generate(out) } } - change.NextLevel.generate(out) + generateRecursive(change.NextLevel, out) } } @@ -64,7 +67,7 @@ func fillHierarchy(changeMap ChangeMap, hierarchy []string) { object.Hierarchy = containerHierarchy } } - fillHierarchy(change.NextLevel, hierarchy) + fillHierarchy(change.NextLevel, containerHierarchy) } } @@ -92,8 +95,5 @@ func getValueSet(object *Object, action string) IValueSet { } func parseAction(action string) []string { - if before, after, found := strings.Cut(action, "/"); found { - return []string{before, after} - } - return []string{action} + return strings.Split(action, "/") } diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index 5b766891..7a4195d6 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -52,4 +52,15 @@ paths: - objects: [success response status, non-success response status] predicativeAdjective: "%s" startWith: action + request body: + nextLevel: + media type: + nextLevel: + schema: + excludeFromHierarchy: true + actions: + set/increase/decrease: + - objects: [max, maxLength, min, minLength, minItems, maxItems] + predicativeAdjective: value + startWith: object From 407654857bb073570c0579c016badd42ec72881e Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 10 Sep 2024 18:47:25 +0300 Subject: [PATCH 12/28] add schema --- checker/generator/tree.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index 7a4195d6..d7f200aa 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -63,4 +63,9 @@ paths: - objects: [max, maxLength, min, minLength, minItems, maxItems] predicativeAdjective: value startWith: object - + change/generalize: + - objects: [type/format, pattern] + startWith: object + change: + - objects: [discriminator property name, required property, optional property] + startWith: object From 14694ea582382a5bf331a63bb776e4d4554e01cb Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Tue, 10 Sep 2024 23:02:38 +0300 Subject: [PATCH 13/28] extend schema --- checker/generator/tree.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index d7f200aa..a256d461 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -69,3 +69,32 @@ paths: change: - objects: [discriminator property name, required property, optional property] startWith: object + add/remove: + - objects: [pattern] + startWith: action + predicativeAdjective: "%s" + - objects: [default value] + startWith: action + - objects: [discriminator, mapping keys] + startWith: action + predicativeAdjective: "%s" + nextLevel: + anyOf list: + actions: + add/remove: + - objects: [schema] + startWith: action + predicativeAdjective: "%s" + oneOf list: + actions: + add/remove: + - objects: [schema] + startWith: action + predicativeAdjective: "%s" + allOf list: + actions: + add/remove: + - objects: [schema] + startWith: action + predicativeAdjective: "%s" + From 13b45cf83d8483c19b5264afa872b4e9060037ff Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Wed, 11 Sep 2024 19:26:12 +0300 Subject: [PATCH 14/28] references --- checker/generator/tree.go | 30 ++++-- checker/generator/tree.yaml | 204 ++++++++++++++++++------------------ 2 files changed, 126 insertions(+), 108 deletions(-) diff --git a/checker/generator/tree.go b/checker/generator/tree.go index 76ec4bd9..6b0424f8 100644 --- a/checker/generator/tree.go +++ b/checker/generator/tree.go @@ -9,12 +9,16 @@ import ( "gopkg.in/yaml.v3" ) -type ChangeMap map[string]Changes +type ChangeMap struct { + Changes map[string]Changes `yaml:"changes"` + Components map[string]Changes `yaml:"components"` +} type Changes struct { + Ref string `yaml:"$ref"` ExcludeFromHierarchy bool `yaml:"excludeFromHierarchy"` Actions map[string]Objects `yaml:"actions"` - NextLevel ChangeMap `yaml:"nextLevel"` + NextLevel map[string]Changes `yaml:"nextLevel"` } type Objects []*Object @@ -44,12 +48,22 @@ func GetTree() (MessageGenerator, error) { } func (changeMap ChangeMap) generate(out io.Writer) { - fillHierarchy(changeMap, nil) - generateRecursive(changeMap, out) + resolveRefs(changeMap.Changes, changeMap.Components) + fillHierarchy(changeMap.Changes, nil) + generateRecursive(changeMap.Changes, out) +} + +func resolveRefs(changes map[string]Changes, components map[string]Changes) { + for _, change := range changes { + if change.Ref != "" { + changes[change.Ref] = components[change.Ref] + } + resolveRefs(change.NextLevel, components) + } } -func generateRecursive(changeMap ChangeMap, out io.Writer) { - for _, change := range changeMap { +func generateRecursive(changes map[string]Changes, out io.Writer) { + for _, change := range changes { for action, objects := range change.Actions { for _, object := range objects { getValueSet(object, action).generate(out) @@ -59,8 +73,8 @@ func generateRecursive(changeMap ChangeMap, out io.Writer) { } } -func fillHierarchy(changeMap ChangeMap, hierarchy []string) { - for container, change := range changeMap { +func fillHierarchy(changes map[string]Changes, hierarchy []string) { + for container, change := range changes { containerHierarchy := getContainerHierarchy(container, change, hierarchy) for _, objects := range change.Actions { for _, object := range objects { diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index a256d461..1fd4651b 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -1,100 +1,104 @@ -paths: - excludeFromHierarchy: true - actions: - remove: - - objects: [api path] - adverbs: [without deprecation, before sunset] - startWith: object - nextLevel: - operations: - excludeFromHierarchy: true - actions: - remove: - - objects: [endpoint] - adverbs: [without deprecation, before sunset] - startWith: object - - objects: [endpoint] - startWith: action - add: - - objects: [endpoint] - startWith: action - deprecate: - - objects: [endpoint] - startWith: action - reactivate: - - objects: [endpoint] - startWith: action - nextLevel: - endpoint: - excludeFromHierarchy: true - actions: - change: - - objects: [operation id] - startWith: object - add/remove: - - objects: [operation id, tag] - predicativeAdjective: "%s" - startWith: action - decrease: - - objects: [stability] - startWith: object - nextLevel: - endpoint security scheme: - actions: - add/remove: - - objects: [security scope] - predicativeAdjective: "%s" - startWith: action - responses: - excludeFromHierarchy: true - actions: - add/remove: - - objects: [success response status, non-success response status] - predicativeAdjective: "%s" - startWith: action - request body: - nextLevel: - media type: - nextLevel: - schema: - excludeFromHierarchy: true - actions: - set/increase/decrease: - - objects: [max, maxLength, min, minLength, minItems, maxItems] - predicativeAdjective: value - startWith: object - change/generalize: - - objects: [type/format, pattern] - startWith: object - change: - - objects: [discriminator property name, required property, optional property] - startWith: object - add/remove: - - objects: [pattern] - startWith: action - predicativeAdjective: "%s" - - objects: [default value] - startWith: action - - objects: [discriminator, mapping keys] - startWith: action - predicativeAdjective: "%s" - nextLevel: - anyOf list: - actions: - add/remove: - - objects: [schema] - startWith: action - predicativeAdjective: "%s" - oneOf list: - actions: - add/remove: - - objects: [schema] - startWith: action - predicativeAdjective: "%s" - allOf list: - actions: - add/remove: - - objects: [schema] - startWith: action - predicativeAdjective: "%s" - +changes: + paths: + excludeFromHierarchy: true + actions: + remove: + - objects: [api path] + adverbs: [without deprecation, before sunset] + startWith: object + nextLevel: + operations: + excludeFromHierarchy: true + actions: + remove: + - objects: [endpoint] + adverbs: [without deprecation, before sunset] + startWith: object + - objects: [endpoint] + startWith: action + add: + - objects: [endpoint] + startWith: action + deprecate: + - objects: [endpoint] + startWith: action + reactivate: + - objects: [endpoint] + startWith: action + nextLevel: + endpoint: + excludeFromHierarchy: true + actions: + change: + - objects: [operation id] + startWith: object + add/remove: + - objects: [operation id, tag] + predicativeAdjective: "%s" + startWith: action + decrease: + - objects: [stability] + startWith: object + nextLevel: + endpoint security scheme: + actions: + add/remove: + - objects: [security scope] + predicativeAdjective: "%s" + startWith: action + responses: + excludeFromHierarchy: true + actions: + add/remove: + - objects: [success response status, non-success response status] + predicativeAdjective: "%s" + startWith: action + request body: + nextLevel: + media type: + nextLevel: + schema: + $ref: 'schema' +components: + schema: + excludeFromHierarchy: true + actions: + set/increase/decrease: + - objects: [max, maxLength, min, minLength, minItems, maxItems] + predicativeAdjective: value + startWith: object + change/generalize: + - objects: [type/format, pattern] + startWith: object + change: + - objects: [discriminator property name, required property, optional property] + startWith: object + add/remove: + - objects: [pattern] + startWith: action + predicativeAdjective: "%s" + - objects: [default value] + startWith: action + - objects: [discriminator, mapping keys] + startWith: action + predicativeAdjective: "%s" + nextLevel: + anyOf list: + actions: + add/remove: + - objects: [schema] + startWith: action + predicativeAdjective: "%s" + oneOf list: + actions: + add/remove: + - objects: [schema] + startWith: action + predicativeAdjective: "%s" + allOf list: + actions: + add/remove: + - objects: [schema] + startWith: action + predicativeAdjective: "%s" + From d1480e673fb1529732c7c5584131a544985f0775 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 12 Sep 2024 22:40:53 +0300 Subject: [PATCH 15/28] add properties --- .../{checks_test.go => generator_test.go} | 2 +- checker/generator/tree.go | 60 ++++++++++--------- checker/generator/tree.yaml | 50 +++++++++++++++- 3 files changed, 82 insertions(+), 30 deletions(-) rename checker/generator/{checks_test.go => generator_test.go} (78%) diff --git a/checker/generator/checks_test.go b/checker/generator/generator_test.go similarity index 78% rename from checker/generator/checks_test.go rename to checker/generator/generator_test.go index 9df97b40..8bdc5d23 100644 --- a/checker/generator/checks_test.go +++ b/checker/generator/generator_test.go @@ -12,5 +12,5 @@ func TestGenerator(t *testing.T) { } func TestTreeGenerator(t *testing.T) { - require.NoError(t, generator.Generate(generator.GetTree)) + require.NoError(t, generator.Generate(generator.GetTree("tree.yaml"))) } diff --git a/checker/generator/tree.go b/checker/generator/tree.go index 6b0424f8..09c63da5 100644 --- a/checker/generator/tree.go +++ b/checker/generator/tree.go @@ -9,16 +9,18 @@ import ( "gopkg.in/yaml.v3" ) -type ChangeMap struct { - Changes map[string]Changes `yaml:"changes"` - Components map[string]Changes `yaml:"components"` +type ChangeTree struct { + Changes ChangeMap `yaml:"changes"` + Components ChangeMap `yaml:"components"` } +type ChangeMap map[string]*Changes + type Changes struct { - Ref string `yaml:"$ref"` - ExcludeFromHierarchy bool `yaml:"excludeFromHierarchy"` - Actions map[string]Objects `yaml:"actions"` - NextLevel map[string]Changes `yaml:"nextLevel"` + Ref string `yaml:"$ref"` + ExcludeFromHierarchy bool `yaml:"excludeFromHierarchy"` + Actions map[string]*Objects `yaml:"actions"` + NextLevel ChangeMap `yaml:"nextLevel"` } type Objects []*Object @@ -32,40 +34,42 @@ type Object struct { AttributiveAdjective string `yaml:"attributiveAdjective"` } -func GetTree() (MessageGenerator, error) { - yamlFile, err := os.ReadFile("tree.yaml") - if err != nil { - return nil, fmt.Errorf("yamlFile.Get err #%v ", err) - } +func GetTree(file string) func() (MessageGenerator, error) { + return func() (MessageGenerator, error) { + yamlFile, err := os.ReadFile(file) + if err != nil { + return nil, fmt.Errorf("yamlFile.Get err #%v ", err) + } - var changeMap ChangeMap - err = yaml.Unmarshal(yamlFile, &changeMap) - if err != nil { - return nil, fmt.Errorf("unmarshal: %v", err) - } + var changeMap ChangeTree + err = yaml.Unmarshal(yamlFile, &changeMap) + if err != nil { + return nil, fmt.Errorf("unmarshal: %v", err) + } - return changeMap, nil + return changeMap, nil + } } -func (changeMap ChangeMap) generate(out io.Writer) { +func (changeMap ChangeTree) generate(out io.Writer) { resolveRefs(changeMap.Changes, changeMap.Components) fillHierarchy(changeMap.Changes, nil) generateRecursive(changeMap.Changes, out) } -func resolveRefs(changes map[string]Changes, components map[string]Changes) { - for _, change := range changes { +func resolveRefs(changes ChangeMap, components ChangeMap) { + for container, change := range changes { if change.Ref != "" { - changes[change.Ref] = components[change.Ref] + changes[container] = components[change.Ref] } - resolveRefs(change.NextLevel, components) + resolveRefs(changes[container].NextLevel, components) } } -func generateRecursive(changes map[string]Changes, out io.Writer) { +func generateRecursive(changes ChangeMap, out io.Writer) { for _, change := range changes { for action, objects := range change.Actions { - for _, object := range objects { + for _, object := range *objects { getValueSet(object, action).generate(out) } } @@ -73,11 +77,11 @@ func generateRecursive(changes map[string]Changes, out io.Writer) { } } -func fillHierarchy(changes map[string]Changes, hierarchy []string) { +func fillHierarchy(changes ChangeMap, hierarchy []string) { for container, change := range changes { containerHierarchy := getContainerHierarchy(container, change, hierarchy) for _, objects := range change.Actions { - for _, object := range objects { + for _, object := range *objects { object.Hierarchy = containerHierarchy } } @@ -85,7 +89,7 @@ func fillHierarchy(changes map[string]Changes, hierarchy []string) { } } -func getContainerHierarchy(container string, change Changes, hierarchy []string) []string { +func getContainerHierarchy(container string, change *Changes, hierarchy []string) []string { if change.ExcludeFromHierarchy { return hierarchy } diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index 1fd4651b..f9de4309 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -53,6 +53,10 @@ changes: - objects: [success response status, non-success response status] predicativeAdjective: "%s" startWith: action + request parameter: + nextLevel: + schema: + $ref: 'schema' request body: nextLevel: media type: @@ -101,4 +105,48 @@ components: - objects: [schema] startWith: action predicativeAdjective: "%s" - + properties: + excludeFromHierarchy: true + nextLevel: + property: + $ref: 'schemaLeaf' + schemaLeaf: + actions: + set/increase/decrease: + - objects: [max, maxLength, min, minLength, minItems, maxItems] + predicativeAdjective: value + startWith: object + change/generalize: + - objects: [type/format, pattern] + startWith: object + change: + - objects: [discriminator property name, required property, optional property] + startWith: object + add/remove: + - objects: [pattern] + startWith: action + predicativeAdjective: "%s" + - objects: [default value] + startWith: action + - objects: [discriminator, mapping keys] + startWith: action + predicativeAdjective: "%s" + nextLevel: + anyOf list: + actions: + add/remove: + - objects: [schema] + startWith: action + predicativeAdjective: "%s" + oneOf list: + actions: + add/remove: + - objects: [schema] + startWith: action + predicativeAdjective: "%s" + allOf list: + actions: + add/remove: + - objects: [schema] + startWith: action + predicativeAdjective: "%s" From eb51652919bb4288b8bf66fa77d6e7da1af460ae Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 12 Sep 2024 23:21:16 +0300 Subject: [PATCH 16/28] rm messages.yaml --- checker/generator/messages.yaml | 225 -------------------------------- 1 file changed, 225 deletions(-) delete mode 100644 checker/generator/messages.yaml diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml deleted file mode 100644 index 79612083..00000000 --- a/checker/generator/messages.yaml +++ /dev/null @@ -1,225 +0,0 @@ -stability-decreased: stability was decreased from %s to %s -api-path-removed: api path was removed 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 -endpoint-reactivated: reactivated endpoint -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 -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-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 -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-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 -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 -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-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 -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-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 -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 -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 %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-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 -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 -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 -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-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 -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-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 -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 -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-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 -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-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 -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 701a57c508a447e96c89170b1f441a7644b8e351 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Thu, 12 Sep 2024 23:33:28 +0300 Subject: [PATCH 17/28] update doc --- checker/generator/doc.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/checker/generator/doc.go b/checker/generator/doc.go index 9071d153..8a508ac5 100644 --- a/checker/generator/doc.go +++ b/checker/generator/doc.go @@ -1,4 +1,11 @@ /* -Package generator generates the messages for the checker package. +Package generator generates the breaking-changes and changelog messages for the checker package. +The output, messages.yaml can be used by the checker package instead of the hardcoded messages under localizations_src. +Advatages over manuallly writing the messages: +- The generated ids and messages are consistent according to the logic in the generator. +- The generator can be easily extended to support more messages. +Additional work needed before using the generator: +- Check that all messages are covered by the generator. +- Decide what to do with Russian messages. */ package generator From b236aa03af6c6aec1756cb3161a4368c9061e39f Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sun, 15 Sep 2024 12:48:44 +0300 Subject: [PATCH 18/28] check number of results --- checker/generator/generator.go | 9 +------- checker/generator/generator_test.go | 34 +++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/checker/generator/generator.go b/checker/generator/generator.go index a4d1ae42..f32e552c 100644 --- a/checker/generator/generator.go +++ b/checker/generator/generator.go @@ -2,7 +2,6 @@ package generator import ( "io" - "os" "slices" "strings" @@ -15,13 +14,7 @@ type MessageGenerator interface { type Getter func() (MessageGenerator, error) -func Generate(getter Getter) error { - out, err := os.Create("messages.yaml") - if err != nil { - return err - } - defer out.Close() - +func Generate(getter Getter, out io.Writer) error { data, err := getter() if err != nil { return err diff --git a/checker/generator/generator_test.go b/checker/generator/generator_test.go index 8bdc5d23..eabb7b28 100644 --- a/checker/generator/generator_test.go +++ b/checker/generator/generator_test.go @@ -1,6 +1,9 @@ package generator_test import ( + "bytes" + "io" + "os" "testing" "github.com/stretchr/testify/require" @@ -8,9 +11,36 @@ import ( ) func TestGenerator(t *testing.T) { - require.NoError(t, generator.Generate(generator.GetAll)) + out, err := os.Create("messages.yaml") + require.NoError(t, err) + defer out.Close() + + require.NoError(t, generator.Generate(generator.GetAll, out)) } func TestTreeGenerator(t *testing.T) { - require.NoError(t, generator.Generate(generator.GetTree("tree.yaml"))) + var out bytes.Buffer + require.NoError(t, generator.Generate(generator.GetTree("tree.yaml"), &out)) + count, err := lineCounter(&out) + require.NoError(t, err) + require.Equal(t, 176, count) +} + +func lineCounter(r io.Reader) (int, error) { + buf := make([]byte, 32*1024) + count := 0 + lineSep := []byte{'\n'} + + for { + c, err := r.Read(buf) + count += bytes.Count(buf[:c], lineSep) + + switch { + case err == io.EOF: + return count, nil + + case err != nil: + return count, err + } + } } From e2387b3431721cb1cc1bdb35c4e67ec1dffbfe14 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sun, 15 Sep 2024 12:49:11 +0300 Subject: [PATCH 19/28] complete endpoint --- checker/generator/tree.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index f9de4309..08d779b9 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -36,6 +36,12 @@ changes: - objects: [operation id, tag] predicativeAdjective: "%s" startWith: action + - objects: [required request body, optional request body] + startWith: action + predicativeAdjective: "%s" + attributiveAdjective: "%s" + - objects: [request parameter] + startWith: action decrease: - objects: [stability] startWith: object From 05b27758e3f62b44f546100c3d6d252e59c09f23 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sun, 15 Sep 2024 12:54:19 +0300 Subject: [PATCH 20/28] add response --- checker/generator/generator_test.go | 2 +- checker/generator/tree.yaml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/checker/generator/generator_test.go b/checker/generator/generator_test.go index eabb7b28..2d336d76 100644 --- a/checker/generator/generator_test.go +++ b/checker/generator/generator_test.go @@ -23,7 +23,7 @@ func TestTreeGenerator(t *testing.T) { require.NoError(t, generator.Generate(generator.GetTree("tree.yaml"), &out)) count, err := lineCounter(&out) require.NoError(t, err) - require.Equal(t, 176, count) + require.Equal(t, 260, count) } func lineCounter(r io.Reader) (int, error) { diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index 08d779b9..7e37f56a 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -59,6 +59,13 @@ changes: - objects: [success response status, non-success response status] predicativeAdjective: "%s" startWith: action + nextLevel: + response: + nextLevel: + media-type: + nextLevel: + schema: + $ref: 'schema' request parameter: nextLevel: schema: From f46f75584b4687bbd6607e007d3e1deaa59787f6 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Sun, 15 Sep 2024 15:10:43 +0300 Subject: [PATCH 21/28] add endpoint scheme security --- checker/generator/messages.yaml | 225 ++++++++++++++++++++++++++++++++ checker/generator/tree.yaml | 3 + 2 files changed, 228 insertions(+) create mode 100644 checker/generator/messages.yaml diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml new file mode 100644 index 00000000..79612083 --- /dev/null +++ b/checker/generator/messages.yaml @@ -0,0 +1,225 @@ +stability-decreased: stability was decreased from %s to %s +api-path-removed: api path was removed 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 +endpoint-reactivated: reactivated endpoint +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 +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-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 +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-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 +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 +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-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 +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-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 +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 +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 %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-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 +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 +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 +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-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 +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-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 +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 +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-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 +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-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 +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 diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index 7e37f56a..411825a5 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -42,6 +42,9 @@ changes: attributiveAdjective: "%s" - objects: [request parameter] startWith: action + - objects: [endpoint scheme security] + predicativeAdjective: "%s" + startWith: action decrease: - objects: [stability] startWith: object From d3a565b9135c6e6d6067a94e5ac9747aaa7f345f Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 16 Sep 2024 13:08:50 +0300 Subject: [PATCH 22/28] tree-generated messages --- checker/generator/messages.yaml | 463 +++++++++++++++++--------------- 1 file changed, 250 insertions(+), 213 deletions(-) diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index 79612083..27b517e8 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -1,225 +1,262 @@ -stability-decreased: stability was decreased from %s to %s api-path-removed: api path was removed 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: endpoint was removed without deprecation +endpoint-removed: endpoint was removed before sunset endpoint-removed: removed endpoint +endpoint-added: added endpoint endpoint-deprecated: deprecated endpoint endpoint-reactivated: reactivated endpoint -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 -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-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 -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-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 -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 -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-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 -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-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 -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 -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 %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-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 -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 -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 -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-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 -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-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 -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 -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-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 -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-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 -response-media-type-property-mapping-keys-removed: removed mapping keys %s from property %s of media-type %s of response %s +required-request-body-added: added %s required request body %s +required-request-body-removed: removed %s required request body %s +optional-request-body-added: added %s optional request body %s +optional-request-body-removed: removed %s optional request body %s +request-parameter-added: added request parameter +request-parameter-removed: removed request parameter 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 +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 +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 +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-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-discriminator-property-name-changed: discriminator property name 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 +request-body-media-type-default-value-removed: removed default value from 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 +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-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-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-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 +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-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-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-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-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-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-discriminator-property-name-changed: discriminator property name 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 +request-body-media-type-default-value-removed: removed default value from 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-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-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-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-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-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 +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-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-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-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-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-discriminator-property-name-changed: discriminator property name 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 +request-body-media-type-default-value-removed: removed default value from 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-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-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-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-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-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 +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-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-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 +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 From 3433b097d6082be862dbeacf0553192a686ab0d1 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 16 Sep 2024 13:25:04 +0300 Subject: [PATCH 23/28] simplify tree --- checker/generator/generator_test.go | 7 ++ checker/generator/tree.go | 8 +-- checker/generator/tree.yaml | 108 ++++++++++++---------------- 3 files changed, 55 insertions(+), 68 deletions(-) diff --git a/checker/generator/generator_test.go b/checker/generator/generator_test.go index 2d336d76..26135382 100644 --- a/checker/generator/generator_test.go +++ b/checker/generator/generator_test.go @@ -18,6 +18,13 @@ func TestGenerator(t *testing.T) { require.NoError(t, generator.Generate(generator.GetAll, out)) } +func TestTreeGeneratoFiler(t *testing.T) { + file, err := os.Create("messages.yaml") + require.NoError(t, err) + defer file.Close() + require.NoError(t, generator.Generate(generator.GetTree("tree.yaml"), file)) +} + func TestTreeGenerator(t *testing.T) { var out bytes.Buffer require.NoError(t, generator.Generate(generator.GetTree("tree.yaml"), &out)) diff --git a/checker/generator/tree.go b/checker/generator/tree.go index 09c63da5..9f92a971 100644 --- a/checker/generator/tree.go +++ b/checker/generator/tree.go @@ -27,9 +27,9 @@ type Objects []*Object type Object struct { Hierarchy []string `yaml:"hierarchy"` - Objects []string `yaml:"objects"` + Names []string `yaml:"names"` Adverbs []string `yaml:"adverbs"` - StartWith string `yaml:"startWith"` + StartWithName bool `yaml:"startWith"` PredicativeAdjective string `yaml:"predicativeAdjective"` AttributiveAdjective string `yaml:"attributiveAdjective"` } @@ -101,12 +101,12 @@ func getValueSet(object *Object, action string) IValueSet { AttributiveAdjective: object.AttributiveAdjective, PredicativeAdjective: object.PredicativeAdjective, Hierarchy: object.Hierarchy, - Names: object.Objects, + Names: object.Names, Actions: parseAction(action), Adverbs: object.Adverbs, } - if object.StartWith == "object" { + if object.StartWithName { return ValueSetA(valueSet) } return ValueSetB(valueSet) diff --git a/checker/generator/tree.yaml b/checker/generator/tree.yaml index 411825a5..aaab87d9 100644 --- a/checker/generator/tree.yaml +++ b/checker/generator/tree.yaml @@ -3,65 +3,57 @@ changes: excludeFromHierarchy: true actions: remove: - - objects: [api path] + - names: [api path] adverbs: [without deprecation, before sunset] - startWith: object + startWithName: true nextLevel: operations: excludeFromHierarchy: true actions: remove: - - objects: [endpoint] + - names: [endpoint] adverbs: [without deprecation, before sunset] - startWith: object - - objects: [endpoint] - startWith: action + startWithName: true + - names: [endpoint] add: - - objects: [endpoint] - startWith: action + - names: [endpoint] deprecate: - - objects: [endpoint] - startWith: action + - names: [endpoint] reactivate: - - objects: [endpoint] - startWith: action + - names: [endpoint] nextLevel: endpoint: excludeFromHierarchy: true actions: change: - - objects: [operation id] - startWith: object + - names: [operation id] + startWithName: true add/remove: - - objects: [operation id, tag] + - names: [operation id, tag] predicativeAdjective: "%s" - startWith: action - - objects: [required request body, optional request body] - startWith: action + - names: [required request body, optional request body] predicativeAdjective: "%s" attributiveAdjective: "%s" - - objects: [request parameter] - startWith: action - - objects: [endpoint scheme security] + - names: [request parameter] + - names: [endpoint scheme security] predicativeAdjective: "%s" - startWith: action decrease: - - objects: [stability] - startWith: object + - names: [stability] + startWithName: true + fail to parse: + - names: [sunset date] nextLevel: endpoint security scheme: actions: add/remove: - - objects: [security scope] + - names: [security scope] predicativeAdjective: "%s" - startWith: action responses: excludeFromHierarchy: true actions: add/remove: - - objects: [success response status, non-success response status] + - names: [success response status, non-success response status] predicativeAdjective: "%s" - startWith: action nextLevel: response: nextLevel: @@ -84,42 +76,36 @@ components: excludeFromHierarchy: true actions: set/increase/decrease: - - objects: [max, maxLength, min, minLength, minItems, maxItems] + - names: [max, maxLength, min, minLength, minItems, maxItems] predicativeAdjective: value - startWith: object + startWithName: true change/generalize: - - objects: [type/format, pattern] - startWith: object + - names: [type/format, pattern] + startWithName: true change: - - objects: [discriminator property name, required property, optional property] - startWith: object + - names: [discriminator property name, required property, optional property] + startWithName: true add/remove: - - objects: [pattern] - startWith: action + - names: [pattern] predicativeAdjective: "%s" - - objects: [default value] - startWith: action - - objects: [discriminator, mapping keys] - startWith: action + - names: [default value] + - names: [discriminator, mapping keys] predicativeAdjective: "%s" nextLevel: anyOf list: actions: add/remove: - - objects: [schema] - startWith: action + - names: [schema] predicativeAdjective: "%s" oneOf list: actions: add/remove: - - objects: [schema] - startWith: action + - names: [schema] predicativeAdjective: "%s" allOf list: actions: add/remove: - - objects: [schema] - startWith: action + - names: [schema] predicativeAdjective: "%s" properties: excludeFromHierarchy: true @@ -129,40 +115,34 @@ components: schemaLeaf: actions: set/increase/decrease: - - objects: [max, maxLength, min, minLength, minItems, maxItems] + - names: [max, maxLength, min, minLength, minItems, maxItems] predicativeAdjective: value - startWith: object + startWithName: true change/generalize: - - objects: [type/format, pattern] - startWith: object + - names: [type/format, pattern] + startWithName: true change: - - objects: [discriminator property name, required property, optional property] - startWith: object + - names: [discriminator property name, required property, optional property] + startWithName: true add/remove: - - objects: [pattern] - startWith: action + - names: [pattern] predicativeAdjective: "%s" - - objects: [default value] - startWith: action - - objects: [discriminator, mapping keys] - startWith: action + - names: [default value] + - names: [discriminator, mapping keys] predicativeAdjective: "%s" nextLevel: anyOf list: actions: add/remove: - - objects: [schema] - startWith: action + - names: [schema] predicativeAdjective: "%s" oneOf list: actions: add/remove: - - objects: [schema] - startWith: action + - names: [schema] predicativeAdjective: "%s" allOf list: actions: add/remove: - - objects: [schema] - startWith: action + - names: [schema] predicativeAdjective: "%s" From 1e422a27e7be769aa5c218e1c45a8e1c153f2f71 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 16 Sep 2024 21:47:12 +0300 Subject: [PATCH 24/28] sorted messages --- checker/generator/generator.go | 18 +- checker/generator/generator_test.go | 59 ++-- checker/generator/messages.yaml | 458 ++++++++++++++-------------- checker/generator/tree.go | 78 +++-- checker/generator/value_set.go | 52 ++-- 5 files changed, 352 insertions(+), 313 deletions(-) diff --git a/checker/generator/generator.go b/checker/generator/generator.go index f32e552c..04caea62 100644 --- a/checker/generator/generator.go +++ b/checker/generator/generator.go @@ -1,7 +1,6 @@ package generator import ( - "io" "slices" "strings" @@ -9,19 +8,18 @@ import ( ) type MessageGenerator interface { - generate(out io.Writer) + generate() []string } type Getter func() (MessageGenerator, error) -func Generate(getter Getter, out io.Writer) error { +func Generate(getter Getter) ([]string, error) { data, err := getter() if err != nil { - return err + return nil, err } - data.generate(out) - return nil + return data.generate(), nil } func isEmpty(s string) bool { @@ -38,12 +36,12 @@ func filterStrings(list []string, f func(string) bool) []string { return result } -func generateId(hierarchy []string, object, action string) string { +func generateId(hierarchy []string, object, action, adverb string) string { if prefix, _, found := strings.Cut(object, "/"); found { object = prefix } - return strcase.ToKebab(strings.Join(filterStrings([]string{concat(hierarchy), object, conjugate(action)}, isEmpty), "-")) + return strcase.ToKebab(strings.Join(filterStrings([]string{concat(hierarchy), object, conjugate(action), adverb}, isEmpty), "-")) } func concat(list []string) string { @@ -135,6 +133,6 @@ func getPreposition(action string) string { return "from" } -func addAttribute(object, attributiveAdjective, predicativeAdjective string) string { - return strings.Join([]string{attributiveAdjective + " " + object + " " + predicativeAdjective}, " ") +func addAttribute(name, attributiveAdjective, predicativeAdjective string) string { + return strings.Join([]string{attributiveAdjective + " " + name + " " + predicativeAdjective}, " ") } diff --git a/checker/generator/generator_test.go b/checker/generator/generator_test.go index 26135382..6d8df3a5 100644 --- a/checker/generator/generator_test.go +++ b/checker/generator/generator_test.go @@ -1,53 +1,52 @@ package generator_test import ( - "bytes" - "io" "os" + "slices" + "strings" "testing" "github.com/stretchr/testify/require" "github.com/tufin/oasdiff/checker/generator" ) -func TestGenerator(t *testing.T) { - out, err := os.Create("messages.yaml") - require.NoError(t, err) - defer out.Close() +func WriteToFile(t *testing.T, filename string, lines []string) { + t.Helper() - require.NoError(t, generator.Generate(generator.GetAll, out)) + file, err := os.Create(filename) + require.NoError(t, err) + defer file.Close() + for _, line := range lines { + _, err = file.WriteString(line + "\n") + require.NoError(t, err) + } } -func TestTreeGeneratoFiler(t *testing.T) { - file, err := os.Create("messages.yaml") +func TestDataGenerator(t *testing.T) { + result, err := generator.Generate(generator.GetAll) require.NoError(t, err) - defer file.Close() - require.NoError(t, generator.Generate(generator.GetTree("tree.yaml"), file)) + slices.Sort(result) + WriteToFile(t, "messages.yaml", result) } func TestTreeGenerator(t *testing.T) { - var out bytes.Buffer - require.NoError(t, generator.Generate(generator.GetTree("tree.yaml"), &out)) - count, err := lineCounter(&out) + result, err := generator.Generate(generator.GetTree("tree.yaml")) require.NoError(t, err) - require.Equal(t, 260, count) + slices.Sort(result) + WriteToFile(t, "messages.yaml", result) + require.Len(t, result, 262) + badId, unique := isUninueIds(result) + require.True(t, unique, badId) } -func lineCounter(r io.Reader) (int, error) { - buf := make([]byte, 32*1024) - count := 0 - lineSep := []byte{'\n'} - - for { - c, err := r.Read(buf) - count += bytes.Count(buf[:c], lineSep) - - switch { - case err == io.EOF: - return count, nil - - case err != nil: - return count, err +func isUninueIds(messages []string) (string, bool) { + ids := make(map[string]struct{}) + for _, message := range messages { + id := strings.SplitAfter(message, ":")[0] + if _, ok := ids[id]; ok { + return id, false } + ids[id] = struct{}{} } + return "", true } diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index 27b517e8..573ec8f1 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -1,262 +1,262 @@ -api-path-removed: api path was removed without deprecation -api-path-removed: api path was removed before sunset -endpoint-removed: endpoint was removed without deprecation -endpoint-removed: endpoint was removed before sunset -endpoint-removed: removed endpoint +api-path-removed-before-sunset: api path was removed before sunset +api-path-removed-without-deprecation: api path was removed without deprecation endpoint-added: added endpoint endpoint-deprecated: deprecated endpoint endpoint-reactivated: reactivated endpoint -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 -required-request-body-added: added %s required request body %s -required-request-body-removed: removed %s required request body %s -optional-request-body-added: added %s optional request body %s -optional-request-body-removed: removed %s optional request body %s -request-parameter-added: added request parameter -request-parameter-removed: removed request parameter +endpoint-removed-before-sunset: endpoint was removed before sunset +endpoint-removed-without-deprecation: endpoint was removed without deprecation +endpoint-removed: removed endpoint endpoint-scheme-security-added: added endpoint scheme security %s endpoint-scheme-security-removed: removed endpoint scheme security %s -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 +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 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 -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-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-discriminator-property-name-changed: discriminator property name 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 +operation-id-added: added operation id %s +operation-id-changed: operation id was changed from %s to %s +operation-id-removed: removed operation id %s +optional-request-body-added: added %s optional request body %s +optional-request-body-removed: removed %s optional request body %s +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-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-discriminator-added: added discriminator %s to 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-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 -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-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-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-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 -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-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-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-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-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-increased: max 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-max-items-increased: maxItems value of media type %s of request body was increased 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-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-max-length-increased: maxLength value of media type %s of request body was increased 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-set: max value of media type %s of request body was set 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-increased: min 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-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-discriminator-property-name-changed: discriminator property name 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-min-items-increased: minItems value of media type %s of request body was increased 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-length-decreased: minLength value of media type %s of request body was decreased from %s 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-set: minLength value of media type %s of request body was set 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-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-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-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-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-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-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-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-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-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-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-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-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-discriminator-added: added discriminator %s to 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-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-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-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-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-discriminator-property-name-changed: discriminator property name 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 -request-body-media-type-default-value-removed: removed default value from 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-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-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-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-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-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-set: maxItems value of property %s of media type %s of request body was set 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-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-set: maxLength value of property %s of media type %s of request body was set 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-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-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-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-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-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-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-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-set: minItems value of property %s of media type %s of request body was set 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-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-set: minLength value of property %s of media type %s of request body was set 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-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-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-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-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-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-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 -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-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-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-required-property-changed: required property of media type %s of request body was changed 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-parameter-added: added request parameter +request-parameter-all-of-list-schema-added: added schema %s to allOf list %s of %s request parameter %s +request-parameter-all-of-list-schema-removed: removed schema %s from allOf 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-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-discriminator-added: added discriminator %s to %s request parameter %s +request-parameter-discriminator-property-name-changed: discriminator property name of %s request parameter %s was changed from %s to %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 +request-parameter-max-decreased: max value of %s request parameter %s was decreased from %s to %s +request-parameter-max-increased: max 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-max-items-increased: maxItems value of %s request parameter %s was increased from %s to %s +request-parameter-max-items-set: maxItems value of %s request parameter %s was set to %s +request-parameter-max-length-decreased: maxLength value of %s request parameter %s was decreased from %s to %s +request-parameter-max-length-increased: maxLength value of %s request parameter %s was increased from %s to %s +request-parameter-max-length-set: maxLength value of %s request parameter %s was set to %s +request-parameter-max-set: max value of %s request parameter %s was set to %s +request-parameter-min-decreased: min value of %s request parameter %s was decreased from %s to %s +request-parameter-min-increased: min 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-min-items-increased: minItems value of %s request parameter %s was increased from %s to %s +request-parameter-min-items-set: minItems value of %s request parameter %s was set to %s +request-parameter-min-length-decreased: minLength value of %s request parameter %s was decreased from %s to %s +request-parameter-min-length-increased: minLength value of %s request parameter %s was increased from %s to %s +request-parameter-min-length-set: minLength value of %s request parameter %s was set to %s +request-parameter-min-set: min value of %s request parameter %s was set to %s +request-parameter-one-of-list-schema-added: added schema %s to oneOf list %s of %s request parameter %s +request-parameter-one-of-list-schema-removed: removed schema %s from oneOf list %s of %s request parameter %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-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-pattern-removed: removed pattern %s from %s request parameter %s +request-parameter-property-all-of-list-schema-added: added schema %s to allOf list %s of property %s of %s request parameter %s +request-parameter-property-all-of-list-schema-removed: removed schema %s from allOf list %s of property %s of %s request parameter %s +request-parameter-property-any-of-list-schema-added: added schema %s to anyOf list %s of property %s of %s request parameter %s +request-parameter-property-any-of-list-schema-removed: removed schema %s from anyOf list %s of property %s of %s request parameter %s +request-parameter-property-default-value-added: added default value to property %s of %s request parameter %s +request-parameter-property-default-value-removed: removed default value from property %s of %s request parameter %s +request-parameter-property-discriminator-added: added discriminator %s to property %s of %s request parameter %s +request-parameter-property-discriminator-property-name-changed: discriminator property name of property %s of %s request parameter %s was changed from %s to %s +request-parameter-property-discriminator-removed: removed discriminator %s from property %s of %s request parameter %s +request-parameter-property-mapping-keys-added: added mapping keys %s to property %s of %s request parameter %s +request-parameter-property-mapping-keys-removed: removed mapping keys %s from property %s of %s request parameter %s +request-parameter-property-max-decreased: max value of property %s of %s request parameter %s was decreased from %s to %s +request-parameter-property-max-increased: max value of property %s of %s request parameter %s was increased from %s to %s +request-parameter-property-max-items-decreased: maxItems value of property %s of %s request parameter %s was decreased from %s to %s +request-parameter-property-max-items-increased: maxItems value of property %s of %s request parameter %s was increased from %s to %s +request-parameter-property-max-items-set: maxItems value of property %s of %s request parameter %s was set to %s +request-parameter-property-max-length-decreased: maxLength value of property %s of %s request parameter %s was decreased from %s to %s +request-parameter-property-max-length-increased: maxLength value of property %s of %s request parameter %s was increased from %s to %s +request-parameter-property-max-length-set: maxLength value of property %s of %s request parameter %s was set to %s +request-parameter-property-max-set: max value of property %s of %s request parameter %s was set to %s +request-parameter-property-min-decreased: min value of property %s of %s request parameter %s was decreased from %s to %s +request-parameter-property-min-increased: min value of property %s of %s request parameter %s was increased from %s to %s +request-parameter-property-min-items-decreased: minItems value of property %s of %s request parameter %s was decreased from %s to %s +request-parameter-property-min-items-increased: minItems value of property %s of %s request parameter %s was increased from %s to %s +request-parameter-property-min-items-set: minItems value of property %s of %s request parameter %s was set to %s +request-parameter-property-min-length-decreased: minLength value of property %s of %s request parameter %s was decreased from %s to %s +request-parameter-property-min-length-increased: minLength value of property %s of %s request parameter %s was increased from %s to %s +request-parameter-property-min-length-set: minLength value of property %s of %s request parameter %s was set to %s +request-parameter-property-min-set: min value of property %s of %s request parameter %s was set to %s +request-parameter-property-one-of-list-schema-added: added schema %s to oneOf list %s of property %s of %s request parameter %s +request-parameter-property-one-of-list-schema-removed: removed schema %s from oneOf list %s of property %s of %s request parameter %s +request-parameter-property-optional-property-changed: optional property of property %s of %s request parameter %s was changed from %s to %s +request-parameter-property-pattern-added: added pattern %s to property %s of %s request parameter %s +request-parameter-property-pattern-changed: pattern of property %s of %s request parameter %s was changed from %s to %s +request-parameter-property-pattern-generalized: pattern of property %s of %s request parameter %s was generalized from %s to %s +request-parameter-property-pattern-removed: removed pattern %s from property %s of %s request parameter %s +request-parameter-property-required-property-changed: required property of property %s of %s request parameter %s was changed from %s to %s +request-parameter-property-type-changed: type/format of property %s of %s request parameter %s was changed from %s to %s +request-parameter-property-type-generalized: type/format of property %s of %s request parameter %s was generalized from %s to %s +request-parameter-removed: removed request parameter +request-parameter-required-property-changed: required property of %s request parameter %s was changed from %s to %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 +required-request-body-added: added %s required request body %s +required-request-body-removed: removed %s required request body %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-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-discriminator-added: added discriminator %s to 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-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-max-decreased: max value of media-type %s of response %s was decreased from %s 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-items-decreased: maxItems value of media-type %s of response %s was decreased from %s 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-set: maxItems value of media-type %s of response %s was set 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-max-length-increased: maxLength value of media-type %s of response %s was increased 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-set: max value of media-type %s of response %s was set 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-increased: min 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-min-items-increased: minItems value of media-type %s of response %s was increased 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-length-decreased: minLength value of media-type %s of response %s was decreased from %s 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-set: minLength value of media-type %s of response %s was set to %s +response-media-type-min-set: min value of media-type %s of response %s was set to %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-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-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-pattern-removed: removed pattern %s from 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-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-discriminator-added: added discriminator %s to 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-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 +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-increased: max 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-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-set: maxItems value of property %s of media-type %s of response %s was set 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-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-set: maxLength value of property %s of media-type %s of response %s was set 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-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-increased: min 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-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-set: minItems value of property %s of media-type %s of response %s was set 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-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-set: minLength value of property %s of media-type %s of response %s was set 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-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-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-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-pattern-removed: removed pattern %s from property %s of media-type %s of response %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-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-required-property-changed: required property of media-type %s of response %s was changed 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 +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 +tag-added: added tag %s +tag-removed: removed tag %s diff --git a/checker/generator/tree.go b/checker/generator/tree.go index 9f92a971..61d8791c 100644 --- a/checker/generator/tree.go +++ b/checker/generator/tree.go @@ -2,7 +2,6 @@ package generator import ( "fmt" - "io" "os" "strings" @@ -14,22 +13,23 @@ type ChangeTree struct { Components ChangeMap `yaml:"components"` } -type ChangeMap map[string]*Changes +type ChangeMap map[string]Changes type Changes struct { - Ref string `yaml:"$ref"` - ExcludeFromHierarchy bool `yaml:"excludeFromHierarchy"` - Actions map[string]*Objects `yaml:"actions"` - NextLevel ChangeMap `yaml:"nextLevel"` + Ref string `yaml:"$ref"` + ExcludeFromHierarchy bool `yaml:"excludeFromHierarchy"` + Actions Actions `yaml:"actions"` + NextLevel ChangeMap `yaml:"nextLevel"` } -type Objects []*Object +type Actions map[string]Objects +type Objects []Object type Object struct { Hierarchy []string `yaml:"hierarchy"` Names []string `yaml:"names"` Adverbs []string `yaml:"adverbs"` - StartWithName bool `yaml:"startWith"` + StartWithName bool `yaml:"startWithName"` PredicativeAdjective string `yaml:"predicativeAdjective"` AttributiveAdjective string `yaml:"attributiveAdjective"` } @@ -51,52 +51,86 @@ func GetTree(file string) func() (MessageGenerator, error) { } } -func (changeMap ChangeTree) generate(out io.Writer) { - resolveRefs(changeMap.Changes, changeMap.Components) - fillHierarchy(changeMap.Changes, nil) - generateRecursive(changeMap.Changes, out) +func (changeTree ChangeTree) generate() []string { + resolveRefs(changeTree.Changes, changeTree.Components) + fillHierarchy(changeTree.Changes, nil) + return generateRecursive(changeTree.Changes) +} + +func (changeMap ChangeMap) copy() ChangeMap { + result := ChangeMap{} + for key, value := range changeMap { + result[key] = value.copy() + } + return result +} + +func (changes Changes) copy() Changes { + return Changes{ + Ref: changes.Ref, + ExcludeFromHierarchy: changes.ExcludeFromHierarchy, + Actions: changes.Actions.copy(), + NextLevel: changes.NextLevel.copy(), + } +} + +func (actions Actions) copy() Actions { + result := Actions{} + for key, value := range actions { + result[key] = value.copy() + } + return result +} + +func (objects Objects) copy() Objects { + result := make(Objects, 0, len(objects)) + return append(result, objects...) } func resolveRefs(changes ChangeMap, components ChangeMap) { for container, change := range changes { if change.Ref != "" { - changes[container] = components[change.Ref] + changes[container] = components[change.Ref].copy() } resolveRefs(changes[container].NextLevel, components) } } -func generateRecursive(changes ChangeMap, out io.Writer) { +func generateRecursive(changes ChangeMap) []string { + result := []string{} + for _, change := range changes { for action, objects := range change.Actions { - for _, object := range *objects { - getValueSet(object, action).generate(out) + for _, object := range objects { + result = append(result, getValueSet(object, action).generate()...) } } - generateRecursive(change.NextLevel, out) + result = append(result, generateRecursive(change.NextLevel)...) } + + return result } func fillHierarchy(changes ChangeMap, hierarchy []string) { for container, change := range changes { containerHierarchy := getContainerHierarchy(container, change, hierarchy) - for _, objects := range change.Actions { - for _, object := range *objects { - object.Hierarchy = containerHierarchy + for action, objects := range change.Actions { + for i := range objects { + changes[container].Actions[action][i].Hierarchy = containerHierarchy } } fillHierarchy(change.NextLevel, containerHierarchy) } } -func getContainerHierarchy(container string, change *Changes, hierarchy []string) []string { +func getContainerHierarchy(container string, change Changes, hierarchy []string) []string { if change.ExcludeFromHierarchy { return hierarchy } return append([]string{container}, hierarchy...) } -func getValueSet(object *Object, action string) IValueSet { +func getValueSet(object Object, action string) IValueSet { valueSet := ValueSet{ AttributiveAdjective: object.AttributiveAdjective, PredicativeAdjective: object.PredicativeAdjective, diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index e3dacae8..343662a6 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -2,7 +2,6 @@ package generator import ( "fmt" - "io" "strings" ) @@ -20,14 +19,16 @@ func NewValueSets(hierarchy []string, valueSets ValueSets) ValueSets { return result } -func (vs ValueSets) generate(out io.Writer) { +func (vs ValueSets) generate() []string { + result := []string{} for _, v := range vs { - v.generate(out) + result = append(result, v.generate()...) } + return result } type IValueSet interface { - generate(out io.Writer) + generate() []string setHierarchy(hierarchy []string) IValueSet } @@ -58,9 +59,9 @@ func (v ValueSetA) setHierarchy(hierarchy []string) IValueSet { return ValueSetA(ValueSet(v).setHierarchy(hierarchy)) } -func (v ValueSetA) generate(out io.Writer) { - generateMessage := func(hierarchy []string, object, attributiveAdjective, predicativeAdjective, action, adverb string) string { - prefix := addAttribute(object, attributiveAdjective, predicativeAdjective) +func (v ValueSetA) generate() []string { + generateMessage := func(hierarchy []string, name, attributiveAdjective, predicativeAdjective, action, adverb string) string { + prefix := addAttribute(name, attributiveAdjective, predicativeAdjective) if hierarchyMessage := getHierarchyMessage(hierarchy); hierarchyMessage != "" { prefix += " of " + hierarchyMessage } @@ -68,20 +69,17 @@ func (v ValueSetA) generate(out io.Writer) { return standardizeSpaces(fmt.Sprintf("%s was %s %s %s", prefix, conjugate(action), getActionMessage(action), adverb)) } - for _, object := range v.Names { + result := []string{} + for _, name := range v.Names { for _, action := range v.Actions { - id := generateId(v.Hierarchy, object, action) - - adverbs := v.Adverbs - if v.Adverbs == nil { - adverbs = []string{""} - } - for _, adverb := range adverbs { - message := generateMessage(v.Hierarchy, object, v.AttributiveAdjective, v.PredicativeAdjective, action, adverb) - fmt.Fprintf(out, "%s: %s\n", id, message) + for _, adverb := range oneAtLeast(v.Adverbs) { + id := generateId(v.Hierarchy, name, action, adverb) + message := generateMessage(v.Hierarchy, name, v.AttributiveAdjective, v.PredicativeAdjective, action, adverb) + result = append(result, fmt.Sprintf("%s: %s", id, message)) } } } + return result } // ValueSetB messages start with the action @@ -92,14 +90,24 @@ func (v ValueSetB) setHierarchy(hierarchy []string) IValueSet { return ValueSetB(ValueSet(v).setHierarchy(hierarchy)) } -func (v ValueSetB) generate(out io.Writer) { - generateMessage := func(hierarchy []string, object, attributiveAdjective, predicativeAdjective, action string) string { - return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(object, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy)}, " ")) +func (v ValueSetB) generate() []string { + generateMessage := func(hierarchy []string, name, attributiveAdjective, predicativeAdjective, action string) string { + return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(name, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy)}, " ")) } - for _, object := range v.Names { + result := []string{} + for _, name := range v.Names { for _, action := range v.Actions { - fmt.Fprintf(out, "%s: %s\n", generateId(v.Hierarchy, object, action), generateMessage(v.Hierarchy, object, v.AttributiveAdjective, v.PredicativeAdjective, action)) + result = append(result, fmt.Sprintf("%s: %s", generateId(v.Hierarchy, name, action, ""), generateMessage(v.Hierarchy, name, v.AttributiveAdjective, v.PredicativeAdjective, action))) } } + + return result +} + +func oneAtLeast(list []string) []string { + if len(list) == 0 { + return []string{""} + } + return list } From d96c8823d023a7a5b1f9bb8a2b97974b069770f1 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 16 Sep 2024 21:49:36 +0300 Subject: [PATCH 25/28] failed to parse sunset date --- checker/generator/generator.go | 2 ++ checker/generator/messages.yaml | 1 + 2 files changed, 3 insertions(+) diff --git a/checker/generator/generator.go b/checker/generator/generator.go index 04caea62..4f90f6f5 100644 --- a/checker/generator/generator.go +++ b/checker/generator/generator.go @@ -121,6 +121,8 @@ func conjugate(verb string) string { return "set" case "add": return "added" + case "fail to parse": + return "failed to parse" } return verb + "d" } diff --git a/checker/generator/messages.yaml b/checker/generator/messages.yaml index 573ec8f1..9b8b6cfc 100644 --- a/checker/generator/messages.yaml +++ b/checker/generator/messages.yaml @@ -258,5 +258,6 @@ response-media-type-type-generalized: type/format of media-type %s of response % 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 +sunset-date-failed-to-parse: failed to parse sunset date tag-added: added tag %s tag-removed: removed tag %s From dea1f0db832e3fd03970e6f4c88e4b18dd014100 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 16 Sep 2024 23:06:07 +0300 Subject: [PATCH 26/28] fix test --- checker/generator/generator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checker/generator/generator_test.go b/checker/generator/generator_test.go index 6d8df3a5..e00023f4 100644 --- a/checker/generator/generator_test.go +++ b/checker/generator/generator_test.go @@ -34,7 +34,7 @@ func TestTreeGenerator(t *testing.T) { require.NoError(t, err) slices.Sort(result) WriteToFile(t, "messages.yaml", result) - require.Len(t, result, 262) + require.Len(t, result, 263) badId, unique := isUninueIds(result) require.True(t, unique, badId) } From a34fa9f996adffeb35cf9cb9ffa50ea4ba171f20 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 16 Sep 2024 23:16:36 +0300 Subject: [PATCH 27/28] rn data generator --- checker/generator/data.go | 170 ---------------------------- checker/generator/generator_test.go | 7 -- 2 files changed, 177 deletions(-) delete mode 100644 checker/generator/data.go diff --git a/checker/generator/data.go b/checker/generator/data.go deleted file mode 100644 index e98392bc..00000000 --- a/checker/generator/data.go +++ /dev/null @@ -1,170 +0,0 @@ -package generator - -import "slices" - -func GetAll() (MessageGenerator, error) { - return slices.Concat( - getEndpoints(), - getRequest(), - getResponse(), - getComponents(), - ), nil -} - -func getRequest() ValueSets { - return slices.Concat( - 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"}, schemaValueSets), - NewValueSets([]string{"property", "media-type", "response"}, schemaValueSets), - ) -} - -func getEndpoints() ValueSets { - return NewValueSets(nil, endpointValueSets) -} - -func getComponents() ValueSets { - return slices.Concat( - getSecurity(), - ) -} - -func getSecurity() ValueSets { - return NewValueSets(nil, securityValueSets) -} - -var securityValueSets = ValueSets{ - ValueSetB{ - PredicativeAdjective: "%s", - Names: []string{"endpoint scheme security"}, - Actions: []string{"add", "remove"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - Hierarchy: []string{"global security scheme"}, - Names: []string{"security scope"}, - Actions: []string{"add", "remove"}, - }, -} - -var endpointValueSets = ValueSets{ - ValueSetA{ - Names: []string{"stability"}, // /Paths/PathItem/Operation - Actions: []string{"decrease"}, - }, - ValueSetA{ - Names: []string{"api path", "api"}, - Actions: []string{"remove"}, - Adverbs: []string{"without deprecation", "before sunset"}, - }, - ValueSetB{ - Names: []string{"endpoint"}, // /Paths/PathItem - Actions: []string{"add", "remove", "deprecate", "reactivate"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - Names: []string{"success response status", "non-success response status"}, // /Paths/PathItem/Operation/Responses/Response/content/media-type/ - Actions: []string{"add", "remove"}, - }, - ValueSetA{ - Names: []string{"operation id"}, - Actions: []string{"change"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - Names: []string{"operation id", "tag"}, - Actions: []string{"add", "remove"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - Hierarchy: []string{"endpoint security scheme"}, - Names: []string{"security scope"}, - Actions: []string{"add", "remove"}, - }, -} - -var operationValueSets = ValueSets{ - ValueSetB{ - Names: []string{"required request body", "optional request body"}, - Actions: []string{"add", "remove"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - AttributiveAdjective: "%s", - Names: []string{"request parameter"}, - Actions: []string{"add", "remove"}, - }, -} - -var schemaValueSets = ValueSets{ - ValueSetA{ - PredicativeAdjective: "value", - Names: []string{"max", "maxLength", "min", "minLength", "minItems", "maxItems"}, - Actions: []string{"set", "increase", "decrease"}, - }, - ValueSetA{ - Names: []string{"type/format"}, - Actions: []string{"change", "generalize"}, - }, - ValueSetA{ - Names: []string{"discriminator property name"}, - Actions: []string{"change"}, - }, - ValueSetA{ - Names: []string{"pattern"}, - Actions: []string{"change", "generalize"}, - }, - ValueSetA{ - Names: []string{"required property", "optional property"}, - Actions: []string{"change"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - Names: []string{"pattern"}, - Actions: []string{"add", "remove"}, - }, - ValueSetB{ - Names: []string{"default value"}, - Actions: []string{"add", "remove"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - Hierarchy: []string{"anyOf list"}, - Names: []string{"schema"}, - Actions: []string{"add", "remove"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - Hierarchy: []string{"anyOf list"}, - Names: []string{"schema"}, - Actions: []string{"add", "remove"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - Hierarchy: []string{"anyOf list"}, - Names: []string{"schema"}, - Actions: []string{"add", "remove"}, - }, - ValueSetB{ - PredicativeAdjective: "%s", - Names: []string{"discriminator", "mapping keys"}, - 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/generator_test.go b/checker/generator/generator_test.go index e00023f4..574eecc5 100644 --- a/checker/generator/generator_test.go +++ b/checker/generator/generator_test.go @@ -22,13 +22,6 @@ func WriteToFile(t *testing.T, filename string, lines []string) { } } -func TestDataGenerator(t *testing.T) { - result, err := generator.Generate(generator.GetAll) - require.NoError(t, err) - slices.Sort(result) - WriteToFile(t, "messages.yaml", result) -} - func TestTreeGenerator(t *testing.T) { result, err := generator.Generate(generator.GetTree("tree.yaml")) require.NoError(t, err) From 2f4e0a6d2ddeb2bd2ad66b556d185b01caa42bc9 Mon Sep 17 00:00:00 2001 From: Reuven Harrison Date: Mon, 16 Sep 2024 23:22:11 +0300 Subject: [PATCH 28/28] rm unused funcs --- checker/generator/value_set.go | 37 ---------------------------------- 1 file changed, 37 deletions(-) diff --git a/checker/generator/value_set.go b/checker/generator/value_set.go index 343662a6..8eac76eb 100644 --- a/checker/generator/value_set.go +++ b/checker/generator/value_set.go @@ -7,29 +7,8 @@ import ( type ValueSets []IValueSet -// NewValueSets creates a new ValueSets object -func NewValueSets(hierarchy []string, valueSets ValueSets) ValueSets { - - result := make(ValueSets, len(valueSets)) - - for i, vs := range valueSets { - result[i] = vs.setHierarchy(hierarchy) - } - - return result -} - -func (vs ValueSets) generate() []string { - result := []string{} - for _, v := range vs { - result = append(result, v.generate()...) - } - return result -} - type IValueSet interface { generate() []string - setHierarchy(hierarchy []string) IValueSet } type ValueSetList []ValueSet @@ -43,22 +22,10 @@ type ValueSet struct { Adverbs []string } -func (v ValueSet) setHierarchy(hierarchy []string) ValueSet { - if len(hierarchy) > 0 { - v.Hierarchy = append(v.Hierarchy, hierarchy...) - } - - return v -} - // ValueSetA messages start with the object // for example: "api was removed without deprecation" type ValueSetA ValueSet -func (v ValueSetA) setHierarchy(hierarchy []string) IValueSet { - return ValueSetA(ValueSet(v).setHierarchy(hierarchy)) -} - func (v ValueSetA) generate() []string { generateMessage := func(hierarchy []string, name, attributiveAdjective, predicativeAdjective, action, adverb string) string { prefix := addAttribute(name, attributiveAdjective, predicativeAdjective) @@ -86,10 +53,6 @@ func (v ValueSetA) generate() []string { // for example: "removed %s request parameter %s" type ValueSetB ValueSet -func (v ValueSetB) setHierarchy(hierarchy []string) IValueSet { - return ValueSetB(ValueSet(v).setHierarchy(hierarchy)) -} - func (v ValueSetB) generate() []string { generateMessage := func(hierarchy []string, name, attributiveAdjective, predicativeAdjective, action string) string { return standardizeSpaces(strings.Join([]string{conjugate(action), addAttribute(name, attributiveAdjective, predicativeAdjective), getHierarchyPostfix(action, hierarchy)}, " "))