diff --git a/checker/check_api_security_updated.go b/checker/check_api_security_updated.go index 8ae4a131..dfc7dab2 100644 --- a/checker/check_api_security_updated.go +++ b/checker/check_api_security_updated.go @@ -15,7 +15,7 @@ const ( APIGlobalSecurityScopeRemovedId = "api-global-security-scope-removed" ) -func checkGlobalSecurity(diffReport *diff.Diff, operationsSources *diff.OperationsSourcesMap, config *Config) Changes { +func checkGlobalSecurity(diffReport *diff.Diff) Changes { result := make(Changes, 0) if diffReport.SecurityDiff == nil { return result @@ -57,13 +57,12 @@ func checkGlobalSecurity(diffReport *diff.Diff, operationsSources *diff.Operatio } return result - } func APISecurityUpdatedCheck(diffReport *diff.Diff, operationsSources *diff.OperationsSourcesMap, config *Config) Changes { result := make(Changes, 0) - result = append(result, checkGlobalSecurity(diffReport, operationsSources, config)...) + result = append(result, checkGlobalSecurity(diffReport)...) if diffReport.PathsDiff == nil || diffReport.PathsDiff.Modified == nil { return result @@ -144,7 +143,6 @@ func APISecurityUpdatedCheck(diffReport *diff.Diff, operationsSources *diff.Oper } } } - } } diff --git a/checker/check_components_security_updated.go b/checker/check_components_security_updated.go index 1eb5a328..71ab1e5b 100644 --- a/checker/check_components_security_updated.go +++ b/checker/check_components_security_updated.go @@ -17,7 +17,7 @@ const ( const ComponentSecuritySchemes = "securitySchemes" -func checkOAuthUpdates(updatedSecurity *diff.SecuritySchemeDiff, config *Config, updatedSecurityName string) Changes { +func checkOAuthUpdates(updatedSecurity *diff.SecuritySchemeDiff, updatedSecurityName string) Changes { result := make(Changes, 0) if updatedSecurity.OAuthFlowsDiff == nil { @@ -104,7 +104,7 @@ func APIComponentsSecurityUpdatedCheck(diffReport *diff.Diff, operationsSources } for updatedSecurityName, updatedSecurity := range diffReport.ComponentsDiff.SecuritySchemesDiff.Modified { - result = append(result, checkOAuthUpdates(updatedSecurity, config, updatedSecurityName)...) + result = append(result, checkOAuthUpdates(updatedSecurity, updatedSecurityName)...) if updatedSecurity.TypeDiff != nil { result = append(result, ComponentChange{ diff --git a/checker/checks-utils.go b/checker/checks-utils.go index 4b84a005..2cd07ce0 100644 --- a/checker/checks-utils.go +++ b/checker/checks-utils.go @@ -115,10 +115,10 @@ func CheckAddedPropertiesDiff(schemaDiff *diff.SchemaDiff, processor func(proper if schemaDiff == nil { return } - processAddedPropertiesDiff("", "", schemaDiff, nil, processor) + processAddedPropertiesDiff("", "", schemaDiff, processor) } -func processAddedPropertiesDiff(propertyPath string, propertyName string, schemaDiff *diff.SchemaDiff, parentDiff *diff.SchemaDiff, processor func(propertyPath string, propertyName string, propertyItem *openapi3.Schema, propertyParentDiff *diff.SchemaDiff)) { +func processAddedPropertiesDiff(propertyPath string, propertyName string, schemaDiff *diff.SchemaDiff, processor func(propertyPath string, propertyName string, propertyItem *openapi3.Schema, propertyParentDiff *diff.SchemaDiff)) { if propertyName != "" { if propertyPath == "" { propertyPath = propertyName @@ -129,24 +129,24 @@ func processAddedPropertiesDiff(propertyPath string, propertyName string, schema if schemaDiff.AllOfDiff != nil { for _, v := range schemaDiff.AllOfDiff.Modified { - processAddedPropertiesDiff(fmt.Sprintf("%s/allOf[%s]", propertyPath, v), "", v.Diff, schemaDiff, processor) + processAddedPropertiesDiff(fmt.Sprintf("%s/allOf[%s]", propertyPath, v), "", v.Diff, processor) } } if schemaDiff.AnyOfDiff != nil { for _, v := range schemaDiff.AnyOfDiff.Modified { - processAddedPropertiesDiff(fmt.Sprintf("%s/anyOf[%s]", propertyPath, v), "", v.Diff, schemaDiff, processor) + processAddedPropertiesDiff(fmt.Sprintf("%s/anyOf[%s]", propertyPath, v), "", v.Diff, processor) } } if schemaDiff.OneOfDiff != nil { for _, v := range schemaDiff.OneOfDiff.Modified { - processAddedPropertiesDiff(fmt.Sprintf("%s/oneOf[%s]", propertyPath, v), "", v.Diff, schemaDiff, processor) + processAddedPropertiesDiff(fmt.Sprintf("%s/oneOf[%s]", propertyPath, v), "", v.Diff, processor) } } if schemaDiff.ItemsDiff != nil { - processAddedPropertiesDiff(fmt.Sprintf("%s/items", propertyPath), "", schemaDiff.ItemsDiff, schemaDiff, processor) + processAddedPropertiesDiff(fmt.Sprintf("%s/items", propertyPath), "", schemaDiff.ItemsDiff, processor) } if schemaDiff.PropertiesDiff != nil { @@ -154,7 +154,7 @@ func processAddedPropertiesDiff(propertyPath string, propertyName string, schema processor(propertyPath, v, schemaDiff.Revision.Properties[v].Value, schemaDiff) } for i, v := range schemaDiff.PropertiesDiff.Modified { - processAddedPropertiesDiff(propertyPath, i, v, schemaDiff, processor) + processAddedPropertiesDiff(propertyPath, i, v, processor) } } } @@ -164,10 +164,10 @@ func CheckDeletedPropertiesDiff(schemaDiff *diff.SchemaDiff, processor func(prop return } - processDeletedPropertiesDiff("", "", schemaDiff, nil, processor) + processDeletedPropertiesDiff("", "", schemaDiff, processor) } -func processDeletedPropertiesDiff(propertyPath string, propertyName string, schemaDiff *diff.SchemaDiff, parentDiff *diff.SchemaDiff, processor func(propertyPath string, propertyName string, propertyItem *openapi3.Schema, propertyParentDiff *diff.SchemaDiff)) { +func processDeletedPropertiesDiff(propertyPath string, propertyName string, schemaDiff *diff.SchemaDiff, processor func(propertyPath string, propertyName string, propertyItem *openapi3.Schema, propertyParentDiff *diff.SchemaDiff)) { if propertyName != "" { if propertyPath == "" { propertyPath = propertyName @@ -178,23 +178,23 @@ func processDeletedPropertiesDiff(propertyPath string, propertyName string, sche if schemaDiff.AllOfDiff != nil { for _, v := range schemaDiff.AllOfDiff.Modified { - processDeletedPropertiesDiff(fmt.Sprintf("%s/allOf[%s]", propertyPath, v), "", v.Diff, schemaDiff, processor) + processDeletedPropertiesDiff(fmt.Sprintf("%s/allOf[%s]", propertyPath, v), "", v.Diff, processor) } } if schemaDiff.AnyOfDiff != nil { for _, v := range schemaDiff.AnyOfDiff.Modified { - processDeletedPropertiesDiff(fmt.Sprintf("%s/anyOf[%s]", propertyPath, v), "", v.Diff, schemaDiff, processor) + processDeletedPropertiesDiff(fmt.Sprintf("%s/anyOf[%s]", propertyPath, v), "", v.Diff, processor) } } if schemaDiff.OneOfDiff != nil { for _, v := range schemaDiff.OneOfDiff.Modified { - processDeletedPropertiesDiff(fmt.Sprintf("%s/oneOf[%s]", propertyPath, v), "", v.Diff, schemaDiff, processor) + processDeletedPropertiesDiff(fmt.Sprintf("%s/oneOf[%s]", propertyPath, v), "", v.Diff, processor) } } if schemaDiff.ItemsDiff != nil { - processDeletedPropertiesDiff(fmt.Sprintf("%s/items", propertyPath), "", schemaDiff.ItemsDiff, schemaDiff, processor) + processDeletedPropertiesDiff(fmt.Sprintf("%s/items", propertyPath), "", schemaDiff.ItemsDiff, processor) } if schemaDiff.PropertiesDiff != nil { @@ -202,7 +202,7 @@ func processDeletedPropertiesDiff(propertyPath string, propertyName string, sche processor(propertyPath, v, schemaDiff.Base.Properties[v].Value, schemaDiff) } for i, v := range schemaDiff.PropertiesDiff.Modified { - processDeletedPropertiesDiff(propertyPath, i, v, schemaDiff, processor) + processDeletedPropertiesDiff(propertyPath, i, v, processor) } } } diff --git a/diff/components_diff.go b/diff/components_diff.go index 5ddd5fe5..47b550c8 100644 --- a/diff/components_diff.go +++ b/diff/components_diff.go @@ -36,7 +36,7 @@ func getComponentsDiffInternal(config *Config, state *state, s1, s2 openapi3.Com return result, err } - result.ParametersDiff, err = getParametersDiff(config, state, s1.Parameters, s2.Parameters, PathParamsMap{}) + result.ParametersDiff, err = getParametersDiff(config, state, s1.Parameters, s2.Parameters) if err != nil { return result, err } @@ -56,17 +56,17 @@ func getComponentsDiffInternal(config *Config, state *state, s1, s2 openapi3.Com return result, err } - result.SecuritySchemesDiff, err = getSecuritySchemesDiff(config, state, s1.SecuritySchemes, s2.SecuritySchemes) + result.SecuritySchemesDiff, err = getSecuritySchemesDiff(config, s1.SecuritySchemes, s2.SecuritySchemes) if err != nil { return result, err } - result.ExamplesDiff, err = getExamplesDiff(config, state, s1.Examples, s2.Examples) + result.ExamplesDiff, err = getExamplesDiff(config, s1.Examples, s2.Examples) if err != nil { return result, err } - result.LinksDiff, err = getLinksDiff(config, state, s1.Links, s2.Links) + result.LinksDiff, err = getLinksDiff(config, s1.Links, s2.Links) if err != nil { return result, err } diff --git a/diff/contact.go b/diff/contact.go index e202673a..68823ac5 100644 --- a/diff/contact.go +++ b/diff/contact.go @@ -19,8 +19,8 @@ func (diff *ContactDiff) Empty() bool { return diff == nil || *diff == ContactDiff{} } -func getContactDiff(config *Config, state *state, contact1, contact2 *openapi3.Contact) (*ContactDiff, error) { - diff, err := getContactDiffInternal(config, state, contact1, contact2) +func getContactDiff(config *Config, contact1, contact2 *openapi3.Contact) (*ContactDiff, error) { + diff, err := getContactDiffInternal(config, contact1, contact2) if err != nil { return nil, err } @@ -32,7 +32,7 @@ func getContactDiff(config *Config, state *state, contact1, contact2 *openapi3.C return diff, nil } -func getContactDiffInternal(config *Config, state *state, contact1, contact2 *openapi3.Contact) (*ContactDiff, error) { +func getContactDiffInternal(config *Config, contact1, contact2 *openapi3.Contact) (*ContactDiff, error) { result := ContactDiff{} var err error @@ -51,7 +51,7 @@ func getContactDiffInternal(config *Config, state *state, contact1, contact2 *op return &result, nil } - result.ExtensionsDiff, err = getExtensionsDiff(config, state, contact1.Extensions, contact2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, contact1.Extensions, contact2.Extensions) if err != nil { return nil, err } diff --git a/diff/diff.go b/diff/diff.go index 899bf15d..15cf430b 100644 --- a/diff/diff.go +++ b/diff/diff.go @@ -265,12 +265,12 @@ func getDiffInternal(config *Config, state *state, s1, s2 *openapi3.T) (*Diff, e result := newDiff() var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, s1.Extensions, s2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, s1.Extensions, s2.Extensions) if err != nil { return nil, err } result.OpenAPIDiff = getValueDiff(s1.OpenAPI, s2.OpenAPI) - result.InfoDiff, err = getInfoDiff(config, state, s1.Info, s2.Info) + result.InfoDiff, err = getInfoDiff(config, s1.Info, s2.Info) if err != nil { return nil, err } @@ -283,10 +283,10 @@ func getDiffInternal(config *Config, state *state, s1, s2 *openapi3.T) (*Diff, e return nil, err } - result.SecurityDiff = getSecurityRequirementsDiff(config, state, &s1.Security, &s2.Security) - result.ServersDiff = getServersDiff(config, state, &s1.Servers, &s2.Servers) - result.TagsDiff = getTagsDiff(config, state, s1.Tags, s2.Tags) - result.ExternalDocsDiff, err = getExternalDocsDiff(config, state, s1.ExternalDocs, s2.ExternalDocs) + result.SecurityDiff = getSecurityRequirementsDiff(&s1.Security, &s2.Security) + result.ServersDiff = getServersDiff(config, &s1.Servers, &s2.Servers) + result.TagsDiff = getTagsDiff(config, s1.Tags, s2.Tags) + result.ExternalDocsDiff, err = getExternalDocsDiff(config, s1.ExternalDocs, s2.ExternalDocs) if err != nil { return nil, err } diff --git a/diff/discriminator_diff.go b/diff/discriminator_diff.go index c0d24b29..d57b9b7f 100644 --- a/diff/discriminator_diff.go +++ b/diff/discriminator_diff.go @@ -23,8 +23,8 @@ func newDiscriminatorDiff() *DiscriminatorDiff { } -func getDiscriminatorDiff(config *Config, state *state, discriminator1, discriminator2 *openapi3.Discriminator) (*DiscriminatorDiff, error) { - diff, err := getDiscriminatorDiffInternal(config, state, discriminator1, discriminator2) +func getDiscriminatorDiff(config *Config, discriminator1, discriminator2 *openapi3.Discriminator) (*DiscriminatorDiff, error) { + diff, err := getDiscriminatorDiffInternal(config, discriminator1, discriminator2) if err != nil { return nil, err } @@ -36,7 +36,7 @@ func getDiscriminatorDiff(config *Config, state *state, discriminator1, discrimi return diff, nil } -func getDiscriminatorDiffInternal(config *Config, state *state, discriminator1, discriminator2 *openapi3.Discriminator) (*DiscriminatorDiff, error) { +func getDiscriminatorDiffInternal(config *Config, discriminator1, discriminator2 *openapi3.Discriminator) (*DiscriminatorDiff, error) { result := newDiscriminatorDiff() var err error @@ -55,7 +55,7 @@ func getDiscriminatorDiffInternal(config *Config, state *state, discriminator1, return result, nil } - result.ExtensionsDiff, err = getExtensionsDiff(config, state, discriminator1.Extensions, discriminator2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, discriminator1.Extensions, discriminator2.Extensions) if err != nil { return nil, err } diff --git a/diff/encoding_diff.go b/diff/encoding_diff.go index c7d43401..e617c2d7 100644 --- a/diff/encoding_diff.go +++ b/diff/encoding_diff.go @@ -42,7 +42,7 @@ func getEncodingDiffInternal(config *Config, state *state, value1, value2 *opena return nil, fmt.Errorf("encoding is nil") } - result.ExtensionsDiff, err = getExtensionsDiff(config, state, value1.Extensions, value2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, value1.Extensions, value2.Extensions) if err != nil { return nil, err } diff --git a/diff/enum_diff.go b/diff/enum_diff.go index 271dd7ec..2ab5a369 100644 --- a/diff/enum_diff.go +++ b/diff/enum_diff.go @@ -32,7 +32,7 @@ func (enumDiff *EnumDiff) Empty() bool { len(enumDiff.Deleted) == 0 } -func getEnumDiff(config *Config, state *state, enum1, enum2 EnumValues) *EnumDiff { +func getEnumDiff(enum1, enum2 EnumValues) *EnumDiff { diff := getEnumDiffInternal(enum1, enum2) diff --git a/diff/example_diff.go b/diff/example_diff.go index d89b204e..ad36a411 100644 --- a/diff/example_diff.go +++ b/diff/example_diff.go @@ -18,8 +18,8 @@ func (diff *ExampleDiff) Empty() bool { return diff == nil || *diff == ExampleDiff{} } -func getExampleDiff(config *Config, state *state, value1, value2 *openapi3.Example) (*ExampleDiff, error) { - diff, err := getExampleDiffInternal(config, state, value1, value2) +func getExampleDiff(config *Config, value1, value2 *openapi3.Example) (*ExampleDiff, error) { + diff, err := getExampleDiffInternal(config, value1, value2) if err != nil { return nil, err } @@ -31,11 +31,11 @@ func getExampleDiff(config *Config, state *state, value1, value2 *openapi3.Examp return diff, nil } -func getExampleDiffInternal(config *Config, state *state, value1, value2 *openapi3.Example) (*ExampleDiff, error) { +func getExampleDiffInternal(config *Config, value1, value2 *openapi3.Example) (*ExampleDiff, error) { result := ExampleDiff{} var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, value1.Extensions, value2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, value1.Extensions, value2.Extensions) if err != nil { return nil, err } diff --git a/diff/examples_diff.go b/diff/examples_diff.go index 5d63d325..3484a804 100644 --- a/diff/examples_diff.go +++ b/diff/examples_diff.go @@ -36,9 +36,9 @@ func newExamplessDiff() *ExamplesDiff { } } -func getExamplesDiff(config *Config, state *state, examples1, examples2 openapi3.Examples) (*ExamplesDiff, error) { +func getExamplesDiff(config *Config, examples1, examples2 openapi3.Examples) (*ExamplesDiff, error) { - diff, err := getExamplesDiffInternal(config, state, examples1, examples2) + diff, err := getExamplesDiffInternal(config, examples1, examples2) if err != nil { return nil, err } @@ -50,7 +50,7 @@ func getExamplesDiff(config *Config, state *state, examples1, examples2 openapi3 return diff, nil } -func getExamplesDiffInternal(config *Config, state *state, examples1, examples2 openapi3.Examples) (*ExamplesDiff, error) { +func getExamplesDiffInternal(config *Config, examples1, examples2 openapi3.Examples) (*ExamplesDiff, error) { if config.IsExcludeExamples() { return nil, nil @@ -71,7 +71,7 @@ func getExamplesDiffInternal(config *Config, state *state, examples1, examples2 return nil, err } - diff, err := getExampleDiff(config, state, value1, value2) + diff, err := getExampleDiff(config, value1, value2) if err != nil { return nil, err } diff --git a/diff/extensions_diff.go b/diff/extensions_diff.go index 7eda07e5..23b51b0c 100644 --- a/diff/extensions_diff.go +++ b/diff/extensions_diff.go @@ -8,12 +8,12 @@ func (diff *ExtensionsDiff) Empty() bool { return (*InterfaceMapDiff)(diff).Empty() } -func getExtensionsDiff(config *Config, state *state, extensions1, extensions2 map[string]interface{}) (*ExtensionsDiff, error) { +func getExtensionsDiff(config *Config, extensions1, extensions2 map[string]interface{}) (*ExtensionsDiff, error) { if config.IsExcludeExtensions() { return nil, nil } - diff, err := getExtensionsDiffInternal(state, extensions1, extensions2) + diff, err := getExtensionsDiffInternal(extensions1, extensions2) if err != nil { return nil, err } @@ -25,6 +25,6 @@ func getExtensionsDiff(config *Config, state *state, extensions1, extensions2 ma return (*ExtensionsDiff)(diff), nil } -func getExtensionsDiffInternal(state *state, extensions1, extensions2 map[string]interface{}) (*InterfaceMapDiff, error) { +func getExtensionsDiffInternal(extensions1, extensions2 map[string]interface{}) (*InterfaceMapDiff, error) { return getInterfaceMapDiff(extensions1, extensions2) } diff --git a/diff/external_docs_diff.go b/diff/external_docs_diff.go index 5652c448..31c855ef 100644 --- a/diff/external_docs_diff.go +++ b/diff/external_docs_diff.go @@ -22,8 +22,8 @@ func (diff *ExternalDocsDiff) Empty() bool { return diff == nil || *diff == ExternalDocsDiff{} } -func getExternalDocsDiff(config *Config, state *state, docs1, docs2 *openapi3.ExternalDocs) (*ExternalDocsDiff, error) { - diff, err := getExternalDocsDiffInternal(config, state, docs1, docs2) +func getExternalDocsDiff(config *Config, docs1, docs2 *openapi3.ExternalDocs) (*ExternalDocsDiff, error) { + diff, err := getExternalDocsDiffInternal(config, docs1, docs2) if err != nil { return nil, err } @@ -35,7 +35,7 @@ func getExternalDocsDiff(config *Config, state *state, docs1, docs2 *openapi3.Ex return diff, nil } -func getExternalDocsDiffInternal(config *Config, state *state, docs1, docs2 *openapi3.ExternalDocs) (*ExternalDocsDiff, error) { +func getExternalDocsDiffInternal(config *Config, docs1, docs2 *openapi3.ExternalDocs) (*ExternalDocsDiff, error) { result := newExternalDocsDiff() var err error @@ -53,7 +53,7 @@ func getExternalDocsDiffInternal(config *Config, state *state, docs1, docs2 *ope return result, nil } - result.ExtensionsDiff, err = getExtensionsDiff(config, state, docs1.Extensions, docs2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, docs1.Extensions, docs2.Extensions) if err != nil { return nil, err } diff --git a/diff/header_diff.go b/diff/header_diff.go index 8f2788fd..250ce29f 100644 --- a/diff/header_diff.go +++ b/diff/header_diff.go @@ -38,7 +38,7 @@ func getHeaderDiffInternal(config *Config, state *state, header1, header2 *opena result := HeaderDiff{} var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, header1.Extensions, header2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, header1.Extensions, header2.Extensions) if err != nil { return nil, err } @@ -46,7 +46,7 @@ func getHeaderDiffInternal(config *Config, state *state, header1, header2 *opena result.DeprecatedDiff = getValueDiff(header1.Deprecated, header2.Deprecated) result.RequiredDiff = getValueDiff(header1.Required, header2.Required) - result.ExamplesDiff, err = getExamplesDiff(config, state, header1.Examples, header2.Examples) + result.ExamplesDiff, err = getExamplesDiff(config, header1.Examples, header2.Examples) if err != nil { return nil, err } diff --git a/diff/info_diff.go b/diff/info_diff.go index 4d6ea95a..4209b7c7 100644 --- a/diff/info_diff.go +++ b/diff/info_diff.go @@ -22,8 +22,8 @@ func (diff *InfoDiff) Empty() bool { return diff == nil || *diff == InfoDiff{} } -func getInfoDiff(config *Config, state *state, info1, info2 *openapi3.Info) (*InfoDiff, error) { - diff, err := getInfoDiffInternal(config, state, info1, info2) +func getInfoDiff(config *Config, info1, info2 *openapi3.Info) (*InfoDiff, error) { + diff, err := getInfoDiffInternal(config, info1, info2) if err != nil { return nil, err } @@ -35,7 +35,7 @@ func getInfoDiff(config *Config, state *state, info1, info2 *openapi3.Info) (*In return diff, nil } -func getInfoDiffInternal(config *Config, state *state, info1, info2 *openapi3.Info) (*InfoDiff, error) { +func getInfoDiffInternal(config *Config, info1, info2 *openapi3.Info) (*InfoDiff, error) { if info1 == nil && info2 == nil { return nil, nil @@ -53,15 +53,15 @@ func getInfoDiffInternal(config *Config, state *state, info1, info2 *openapi3.In }, nil } - extensionsDiff, err := getExtensionsDiff(config, state, info1.Extensions, info2.Extensions) + extensionsDiff, err := getExtensionsDiff(config, info1.Extensions, info2.Extensions) if err != nil { return nil, err } - licenseDiff, err := getLicenseDiff(config, state, info1.License, info2.License) + licenseDiff, err := getLicenseDiff(config, info1.License, info2.License) if err != nil { return nil, err } - contactDiff, err := getContactDiff(config, state, info1.Contact, info2.Contact) + contactDiff, err := getContactDiff(config, info1.Contact, info2.Contact) if err != nil { return nil, err } diff --git a/diff/license_diff.go b/diff/license_diff.go index c55a9a92..25045e69 100644 --- a/diff/license_diff.go +++ b/diff/license_diff.go @@ -18,8 +18,8 @@ func (diff *LicenseDiff) Empty() bool { return diff == nil || *diff == LicenseDiff{} } -func getLicenseDiff(config *Config, state *state, license1, license2 *openapi3.License) (*LicenseDiff, error) { - diff, err := getLicenseDiffInternal(config, state, license1, license2) +func getLicenseDiff(config *Config, license1, license2 *openapi3.License) (*LicenseDiff, error) { + diff, err := getLicenseDiffInternal(config, license1, license2) if err != nil { return nil, err @@ -32,7 +32,7 @@ func getLicenseDiff(config *Config, state *state, license1, license2 *openapi3.L return diff, nil } -func getLicenseDiffInternal(config *Config, state *state, license1, license2 *openapi3.License) (*LicenseDiff, error) { +func getLicenseDiffInternal(config *Config, license1, license2 *openapi3.License) (*LicenseDiff, error) { result := LicenseDiff{} var err error @@ -51,7 +51,7 @@ func getLicenseDiffInternal(config *Config, state *state, license1, license2 *op return &result, nil } - result.ExtensionsDiff, err = getExtensionsDiff(config, state, license1.Extensions, license2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, license1.Extensions, license2.Extensions) if err != nil { return nil, err } diff --git a/diff/link_diff.go b/diff/link_diff.go index 1e0fe284..678f15a6 100644 --- a/diff/link_diff.go +++ b/diff/link_diff.go @@ -20,8 +20,8 @@ func (diff *LinkDiff) Empty() bool { return diff == nil || *diff == LinkDiff{} } -func getLinkDiff(config *Config, state *state, link1, link2 *openapi3.Link) (*LinkDiff, error) { - diff, err := getLinkDiffInternal(config, state, link1, link2) +func getLinkDiff(config *Config, link1, link2 *openapi3.Link) (*LinkDiff, error) { + diff, err := getLinkDiffInternal(config, link1, link2) if err != nil { return nil, err } @@ -33,11 +33,11 @@ func getLinkDiff(config *Config, state *state, link1, link2 *openapi3.Link) (*Li return diff, nil } -func getLinkDiffInternal(config *Config, state *state, link1, link2 *openapi3.Link) (*LinkDiff, error) { +func getLinkDiffInternal(config *Config, link1, link2 *openapi3.Link) (*LinkDiff, error) { result := LinkDiff{} var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, link1.Extensions, link2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, link1.Extensions, link2.Extensions) if err != nil { return nil, err } @@ -49,7 +49,7 @@ func getLinkDiffInternal(config *Config, state *state, link1, link2 *openapi3.Li if err != nil { return nil, err } - result.ServerDiff, err = getServerDiff(config, state, link1.Server, link2.Server) + result.ServerDiff, err = getServerDiff(config, link1.Server, link2.Server) if err != nil { return nil, err } diff --git a/diff/links_diff.go b/diff/links_diff.go index a56e66a0..50cf9d8c 100644 --- a/diff/links_diff.go +++ b/diff/links_diff.go @@ -36,8 +36,8 @@ func newLinksDiff() *LinksDiff { } } -func getLinksDiff(config *Config, state *state, links1, links2 openapi3.Links) (*LinksDiff, error) { - diff, err := getLinksDiffsInternal(config, state, links1, links2) +func getLinksDiff(config *Config, links1, links2 openapi3.Links) (*LinksDiff, error) { + diff, err := getLinksDiffsInternal(config, links1, links2) if err != nil { return nil, err } @@ -49,7 +49,7 @@ func getLinksDiff(config *Config, state *state, links1, links2 openapi3.Links) ( return diff, nil } -func getLinksDiffsInternal(config *Config, state *state, links1, links2 openapi3.Links) (*LinksDiff, error) { +func getLinksDiffsInternal(config *Config, links1, links2 openapi3.Links) (*LinksDiff, error) { result := newLinksDiff() @@ -65,7 +65,7 @@ func getLinksDiffsInternal(config *Config, state *state, links1, links2 openapi3 return nil, err } - diff, err := getLinkDiff(config, state, value1, value2) + diff, err := getLinkDiff(config, value1, value2) if err != nil { return nil, err } diff --git a/diff/media_type_diff.go b/diff/media_type_diff.go index d5d7b64d..778c8ea4 100644 --- a/diff/media_type_diff.go +++ b/diff/media_type_diff.go @@ -41,7 +41,7 @@ func getMediaTypeDiffInternal(config *Config, state *state, mediaType1 *openapi3 return nil, fmt.Errorf("media type is nil") } - result.ExtensionsDiff, err = getExtensionsDiff(config, state, mediaType1.Extensions, mediaType2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, mediaType1.Extensions, mediaType2.Extensions) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func getMediaTypeDiffInternal(config *Config, state *state, mediaType1 *openapi3 if err != nil { return nil, err } - result.ExamplesDiff, err = getExamplesDiff(config, state, mediaType1.Examples, mediaType2.Examples) + result.ExamplesDiff, err = getExamplesDiff(config, mediaType1.Examples, mediaType2.Examples) if err != nil { return nil, err } diff --git a/diff/method_diff.go b/diff/method_diff.go index 4cd88e9d..5ccddbf5 100644 --- a/diff/method_diff.go +++ b/diff/method_diff.go @@ -56,7 +56,7 @@ func getMethodDiffInternal(config *Config, state *state, operation1, operation2 result := newMethodDiff() var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, operation1.Extensions, operation2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, operation1.Extensions, operation2.Extensions) if err != nil { return nil, err } @@ -84,9 +84,9 @@ func getMethodDiffInternal(config *Config, state *state, operation1, operation2 return nil, err } result.DeprecatedDiff = getValueDiff(operation1.Deprecated, operation2.Deprecated) - result.SecurityDiff = getSecurityRequirementsDiff(config, state, operation1.Security, operation2.Security) - result.ServersDiff = getServersDiff(config, state, operation1.Servers, operation2.Servers) - result.ExternalDocsDiff, err = getExternalDocsDiff(config, state, operation1.ExternalDocs, operation2.ExternalDocs) + result.SecurityDiff = getSecurityRequirementsDiff(operation1.Security, operation2.Security) + result.ServersDiff = getServersDiff(config, operation1.Servers, operation2.Servers) + result.ExternalDocsDiff, err = getExternalDocsDiff(config, operation1.ExternalDocs, operation2.ExternalDocs) if err != nil { return nil, err } diff --git a/diff/oauth_flow.go b/diff/oauth_flow.go index 4befb6a7..e133fe2a 100644 --- a/diff/oauth_flow.go +++ b/diff/oauth_flow.go @@ -20,8 +20,8 @@ func (diff *OAuthFlowDiff) Empty() bool { return diff == nil || *diff == OAuthFlowDiff{} } -func getOAuthFlowDiff(config *Config, state *state, flow1, flow2 *openapi3.OAuthFlow) (*OAuthFlowDiff, error) { - diff, err := getOAuthFlowDiffInternal(config, state, flow1, flow2) +func getOAuthFlowDiff(config *Config, flow1, flow2 *openapi3.OAuthFlow) (*OAuthFlowDiff, error) { + diff, err := getOAuthFlowDiffInternal(config, flow1, flow2) if err != nil { return nil, err } @@ -33,7 +33,7 @@ func getOAuthFlowDiff(config *Config, state *state, flow1, flow2 *openapi3.OAuth return diff, nil } -func getOAuthFlowDiffInternal(config *Config, state *state, flow1, flow2 *openapi3.OAuthFlow) (*OAuthFlowDiff, error) { +func getOAuthFlowDiffInternal(config *Config, flow1, flow2 *openapi3.OAuthFlow) (*OAuthFlowDiff, error) { if flow1 == nil && flow2 == nil { return nil, nil @@ -52,7 +52,7 @@ func getOAuthFlowDiffInternal(config *Config, state *state, flow1, flow2 *openap return &result, nil } - result.ExtensionsDiff, err = getExtensionsDiff(config, state, flow1.Extensions, flow2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, flow1.Extensions, flow2.Extensions) if err != nil { return nil, err } diff --git a/diff/oauth_flows.go b/diff/oauth_flows.go index 6702b0b1..dfe7ec9a 100644 --- a/diff/oauth_flows.go +++ b/diff/oauth_flows.go @@ -20,8 +20,8 @@ func (diff *OAuthFlowsDiff) Empty() bool { return diff == nil || *diff == OAuthFlowsDiff{} } -func getOAuthFlowsDiff(config *Config, state *state, flows1, flows2 *openapi3.OAuthFlows) (*OAuthFlowsDiff, error) { - diff, err := getOAuthFlowsDiffInternal(config, state, flows1, flows2) +func getOAuthFlowsDiff(config *Config, flows1, flows2 *openapi3.OAuthFlows) (*OAuthFlowsDiff, error) { + diff, err := getOAuthFlowsDiffInternal(config, flows1, flows2) if err != nil { return nil, err } @@ -33,7 +33,7 @@ func getOAuthFlowsDiff(config *Config, state *state, flows1, flows2 *openapi3.OA return diff, nil } -func getOAuthFlowsDiffInternal(config *Config, state *state, flows1, flows2 *openapi3.OAuthFlows) (*OAuthFlowsDiff, error) { +func getOAuthFlowsDiffInternal(config *Config, flows1, flows2 *openapi3.OAuthFlows) (*OAuthFlowsDiff, error) { if flows1 == nil && flows2 == nil { return nil, nil @@ -54,27 +54,27 @@ func getOAuthFlowsDiffInternal(config *Config, state *state, flows1, flows2 *ope result := OAuthFlowsDiff{} var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, flows1.Extensions, flows2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, flows1.Extensions, flows2.Extensions) if err != nil { return nil, err } - result.ImplicitDiff, err = getOAuthFlowDiff(config, state, flows1.Implicit, flows2.Implicit) + result.ImplicitDiff, err = getOAuthFlowDiff(config, flows1.Implicit, flows2.Implicit) if err != nil { return nil, err } - result.PasswordDiff, err = getOAuthFlowDiff(config, state, flows1.Password, flows2.Password) + result.PasswordDiff, err = getOAuthFlowDiff(config, flows1.Password, flows2.Password) if err != nil { return nil, err } - result.ClientCredentialsDiff, err = getOAuthFlowDiff(config, state, flows1.ClientCredentials, flows2.ClientCredentials) + result.ClientCredentialsDiff, err = getOAuthFlowDiff(config, flows1.ClientCredentials, flows2.ClientCredentials) if err != nil { return nil, err } - result.AuthorizationCodeDiff, err = getOAuthFlowDiff(config, state, flows1.AuthorizationCode, flows2.AuthorizationCode) + result.AuthorizationCodeDiff, err = getOAuthFlowDiff(config, flows1.AuthorizationCode, flows2.AuthorizationCode) if err != nil { return nil, err } diff --git a/diff/parameter_diff.go b/diff/parameter_diff.go index f928b646..9a1ba779 100644 --- a/diff/parameter_diff.go +++ b/diff/parameter_diff.go @@ -49,7 +49,7 @@ func getParameterDiffInternal(config *Config, state *state, param1, param2 *open result.NameDiff = getValueDiff(param1.Name, param2.Name) result.InDiff = getValueDiff(param1.In, param2.In) - result.ExtensionsDiff, err = getExtensionsDiff(config, state, param1.Extensions, param2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, param1.Extensions, param2.Extensions) if err != nil { return nil, err } @@ -68,7 +68,7 @@ func getParameterDiffInternal(config *Config, state *state, param1, param2 *open result.ExampleDiff = getValueDiffConditional(config.IsExcludeExamples(), param1.Example, param2.Example) - result.ExamplesDiff, err = getExamplesDiff(config, state, param1.Examples, param2.Examples) + result.ExamplesDiff, err = getExamplesDiff(config, param1.Examples, param2.Examples) if err != nil { return nil, err } diff --git a/diff/parameters_diff.go b/diff/parameters_diff.go index c6622cbb..58bbbc99 100644 --- a/diff/parameters_diff.go +++ b/diff/parameters_diff.go @@ -31,8 +31,8 @@ func newParametersDiff() *ParametersDiff { } } -func getParametersDiff(config *Config, state *state, params1, params2 openapi3.ParametersMap, pathParamsMap PathParamsMap) (*ParametersDiff, error) { - diff, err := getParametersDiffInternal(config, state, params1, params2, pathParamsMap) +func getParametersDiff(config *Config, state *state, params1, params2 openapi3.ParametersMap) (*ParametersDiff, error) { + diff, err := getParametersDiffInternal(config, state, params1, params2) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func getParametersDiff(config *Config, state *state, params1, params2 openapi3.P return diff, nil } -func getParametersDiffInternal(config *Config, state *state, params1, params2 openapi3.ParametersMap, pathParamsMap PathParamsMap) (*ParametersDiff, error) { +func getParametersDiffInternal(config *Config, state *state, params1, params2 openapi3.ParametersMap) (*ParametersDiff, error) { result := newParametersDiff() diff --git a/diff/path_diff.go b/diff/path_diff.go index 7dd6d209..914238b0 100644 --- a/diff/path_diff.go +++ b/diff/path_diff.go @@ -54,7 +54,7 @@ func getPathDiffInternal(config *Config, state *state, pathItemPair *pathItemPai result := newPathDiff() var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, pathItem1.Extensions, pathItem2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, pathItem1.Extensions, pathItem2.Extensions) if err != nil { return nil, err } @@ -68,7 +68,7 @@ func getPathDiffInternal(config *Config, state *state, pathItemPair *pathItemPai return nil, err } - result.ServersDiff = getServersDiff(config, state, &pathItem1.Servers, &pathItem2.Servers) + result.ServersDiff = getServersDiff(config, &pathItem1.Servers, &pathItem2.Servers) result.ParametersDiff, err = getParametersDiffByLocation(config, state, pathItem1.Parameters, pathItem2.Parameters, pathItemPair.PathParamsMap) result.Base = pathItem1 result.Revision = pathItem2 diff --git a/diff/request_body_diff.go b/diff/request_body_diff.go index d13d1847..99eb68a7 100644 --- a/diff/request_body_diff.go +++ b/diff/request_body_diff.go @@ -68,7 +68,7 @@ func getRequestBodyDiffInternal(config *Config, state *state, requestBodyRef1, r return nil, err } - result.ExtensionsDiff, err = getExtensionsDiff(config, state, requestBody1.Extensions, requestBody2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, requestBody1.Extensions, requestBody2.Extensions) if err != nil { return nil, err } diff --git a/diff/required_diff.go b/diff/required_diff.go index b510b111..ee937130 100644 --- a/diff/required_diff.go +++ b/diff/required_diff.go @@ -19,7 +19,7 @@ func (diff *RequiredPropertiesDiff) Empty() bool { return diff.StringsDiff.Empty() } -func getRequiredPropertiesDiff(config *Config, state *state, schema1, schema2 *openapi3.Schema) *RequiredPropertiesDiff { +func getRequiredPropertiesDiff(schema1, schema2 *openapi3.Schema) *RequiredPropertiesDiff { diff := getRequiredPropertiesDiffInternal(schema1.Required, schema2.Required) if diff.Empty() { diff --git a/diff/response_diff.go b/diff/response_diff.go index 90b4898e..cc400240 100644 --- a/diff/response_diff.go +++ b/diff/response_diff.go @@ -37,7 +37,7 @@ func diffResponseValuesInternal(config *Config, state *state, response1, respons result := ResponseDiff{} var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, response1.Extensions, response2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, response1.Extensions, response2.Extensions) if err != nil { return nil, err } @@ -53,7 +53,7 @@ func diffResponseValuesInternal(config *Config, state *state, response1, respons return nil, err } - result.LinksDiff, err = getLinksDiff(config, state, response1.Links, response2.Links) + result.LinksDiff, err = getLinksDiff(config, response1.Links, response2.Links) if err != nil { return nil, err } diff --git a/diff/schema_diff.go b/diff/schema_diff.go index 09a9bf68..0ac0029a 100644 --- a/diff/schema_diff.go +++ b/diff/schema_diff.go @@ -125,7 +125,7 @@ func getSchemaDiffInternal(config *Config, state *state, schema1, schema2 *opena var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, value1.Extensions, value2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, value1.Extensions, value2.Extensions) if err != nil { return nil, err } @@ -149,10 +149,10 @@ func getSchemaDiffInternal(config *Config, state *state, schema1, schema2 *opena result.TitleDiff = getValueDiffConditional(config.IsExcludeTitle(), value1.Title, value2.Title) result.FormatDiff = getValueDiff(value1.Format, value2.Format) result.DescriptionDiff = getValueDiffConditional(config.IsExcludeDescription(), value1.Description, value2.Description) - result.EnumDiff = getEnumDiff(config, state, value1.Enum, value2.Enum) + result.EnumDiff = getEnumDiff(value1.Enum, value2.Enum) result.DefaultDiff = getValueDiff(value1.Default, value2.Default) result.ExampleDiff = getValueDiffConditional(config.IsExcludeExamples(), value1.Example, value2.Example) - result.ExternalDocsDiff, err = getExternalDocsDiff(config, state, value1.ExternalDocs, value2.ExternalDocs) + result.ExternalDocsDiff, err = getExternalDocsDiff(config, value1.ExternalDocs, value2.ExternalDocs) if err != nil { return nil, err } @@ -181,7 +181,7 @@ func getSchemaDiffInternal(config *Config, state *state, schema1, schema2 *opena } // Object - result.RequiredDiff = getRequiredPropertiesDiff(config, state, value1, value2) + result.RequiredDiff = getRequiredPropertiesDiff(value1, value2) result.PropertiesDiff, err = getSchemasDiff(config, state, value1.Properties, value2.Properties) if err != nil { return nil, err @@ -194,7 +194,7 @@ func getSchemaDiffInternal(config *Config, state *state, schema1, schema2 *opena return nil, err } - result.DiscriminatorDiff, err = getDiscriminatorDiff(config, state, value1.Discriminator, value2.Discriminator) + result.DiscriminatorDiff, err = getDiscriminatorDiff(config, value1.Discriminator, value2.Discriminator) if err != nil { return nil, err } diff --git a/diff/security_requirements_diff.go b/diff/security_requirements_diff.go index 868aad70..19605dd7 100644 --- a/diff/security_requirements_diff.go +++ b/diff/security_requirements_diff.go @@ -36,8 +36,8 @@ func newSecurityRequirementsDiff() *SecurityRequirementsDiff { } } -func getSecurityRequirementsDiff(config *Config, state *state, securityRequirements1, securityRequirements2 *openapi3.SecurityRequirements) *SecurityRequirementsDiff { - diff := getSecurityRequirementsDiffInternal(config, state, securityRequirements1, securityRequirements2) +func getSecurityRequirementsDiff(securityRequirements1, securityRequirements2 *openapi3.SecurityRequirements) *SecurityRequirementsDiff { + diff := getSecurityRequirementsDiffInternal(securityRequirements1, securityRequirements2) if diff.Empty() { return nil @@ -46,7 +46,7 @@ func getSecurityRequirementsDiff(config *Config, state *state, securityRequireme return diff } -func getSecurityRequirementsDiffInternal(config *Config, state *state, securityRequirements1, securityRequirements2 *openapi3.SecurityRequirements) *SecurityRequirementsDiff { +func getSecurityRequirementsDiffInternal(securityRequirements1, securityRequirements2 *openapi3.SecurityRequirements) *SecurityRequirementsDiff { result := newSecurityRequirementsDiff() diff --git a/diff/security_scheme.go b/diff/security_scheme.go index a8ab846c..936a3e29 100644 --- a/diff/security_scheme.go +++ b/diff/security_scheme.go @@ -22,8 +22,8 @@ func (diff *SecuritySchemeDiff) Empty() bool { return diff == nil || *diff == SecuritySchemeDiff{} } -func getSecuritySchemeDiff(config *Config, state *state, scheme1, scheme2 *openapi3.SecurityScheme) (*SecuritySchemeDiff, error) { - diff, err := getSecuritySchemeDiffInternal(config, state, scheme1, scheme2) +func getSecuritySchemeDiff(config *Config, scheme1, scheme2 *openapi3.SecurityScheme) (*SecuritySchemeDiff, error) { + diff, err := getSecuritySchemeDiffInternal(config, scheme1, scheme2) if err != nil { return nil, err } @@ -35,11 +35,11 @@ func getSecuritySchemeDiff(config *Config, state *state, scheme1, scheme2 *opena return diff, nil } -func getSecuritySchemeDiffInternal(config *Config, state *state, scheme1, scheme2 *openapi3.SecurityScheme) (*SecuritySchemeDiff, error) { +func getSecuritySchemeDiffInternal(config *Config, scheme1, scheme2 *openapi3.SecurityScheme) (*SecuritySchemeDiff, error) { result := SecuritySchemeDiff{} var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, scheme1.Extensions, scheme2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, scheme1.Extensions, scheme2.Extensions) if err != nil { return nil, err } @@ -50,7 +50,7 @@ func getSecuritySchemeDiffInternal(config *Config, state *state, scheme1, scheme result.InDiff = getValueDiff(scheme1.In, scheme2.In) result.SchemeDiff = getValueDiff(scheme1.Scheme, scheme2.Scheme) result.BearerFormatDiff = getValueDiff(scheme1.BearerFormat, scheme2.BearerFormat) - result.OAuthFlowsDiff, err = getOAuthFlowsDiff(config, state, scheme1.Flows, scheme2.Flows) + result.OAuthFlowsDiff, err = getOAuthFlowsDiff(config, scheme1.Flows, scheme2.Flows) if err != nil { return nil, err } diff --git a/diff/security_schemes.go b/diff/security_schemes.go index c3ca5ac1..5b12b378 100644 --- a/diff/security_schemes.go +++ b/diff/security_schemes.go @@ -36,8 +36,8 @@ func newSecuritySchemesDiff() *SecuritySchemesDiff { } } -func getSecuritySchemesDiff(config *Config, state *state, securitySchemes1, securitySchemes2 openapi3.SecuritySchemes) (*SecuritySchemesDiff, error) { - diff, err := getSecuritySchemesDiffInternal(config, state, securitySchemes1, securitySchemes2) +func getSecuritySchemesDiff(config *Config, securitySchemes1, securitySchemes2 openapi3.SecuritySchemes) (*SecuritySchemesDiff, error) { + diff, err := getSecuritySchemesDiffInternal(config, securitySchemes1, securitySchemes2) if err != nil { return nil, err } @@ -49,7 +49,7 @@ func getSecuritySchemesDiff(config *Config, state *state, securitySchemes1, secu return diff, nil } -func getSecuritySchemesDiffInternal(config *Config, state *state, securitySchemes1, securitySchemes2 openapi3.SecuritySchemes) (*SecuritySchemesDiff, error) { +func getSecuritySchemesDiffInternal(config *Config, securitySchemes1, securitySchemes2 openapi3.SecuritySchemes) (*SecuritySchemesDiff, error) { result := newSecuritySchemesDiff() @@ -63,7 +63,7 @@ func getSecuritySchemesDiffInternal(config *Config, state *state, securityScheme if err != nil { return nil, err } - diff, err := getSecuritySchemeDiff(config, state, value1, value2) + diff, err := getSecuritySchemeDiff(config, value1, value2) if err != nil { return nil, err } diff --git a/diff/server_diff.go b/diff/server_diff.go index eae33552..dd8161ae 100644 --- a/diff/server_diff.go +++ b/diff/server_diff.go @@ -19,8 +19,8 @@ func (diff *ServerDiff) Empty() bool { return diff == nil || *diff == ServerDiff{} } -func getServerDiff(config *Config, state *state, value1, value2 *openapi3.Server) (*ServerDiff, error) { - diff, err := getServerDiffInternal(config, state, value1, value2) +func getServerDiff(config *Config, value1, value2 *openapi3.Server) (*ServerDiff, error) { + diff, err := getServerDiffInternal(config, value1, value2) if err != nil { return nil, err } @@ -32,7 +32,7 @@ func getServerDiff(config *Config, state *state, value1, value2 *openapi3.Server return diff, nil } -func getServerDiffInternal(config *Config, state *state, value1, value2 *openapi3.Server) (*ServerDiff, error) { +func getServerDiffInternal(config *Config, value1, value2 *openapi3.Server) (*ServerDiff, error) { if value1 == nil && value2 == nil { return nil, nil @@ -51,14 +51,14 @@ func getServerDiffInternal(config *Config, state *state, value1, value2 *openapi return &result, nil } - result.ExtensionsDiff, err = getExtensionsDiff(config, state, value1.Extensions, value2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, value1.Extensions, value2.Extensions) if err != nil { return nil, err } result.URLDiff = getValueDiff(value1.URL, value2.URL) result.DescriptionDiff = getValueDiffConditional(config.IsExcludeDescription(), value1.Description, value2.Description) - result.VariablesDiff, err = getVariablesDiff(config, state, value1.Variables, value2.Variables) + result.VariablesDiff, err = getVariablesDiff(config, value1.Variables, value2.Variables) if err != nil { return nil, err } diff --git a/diff/servers_diff.go b/diff/servers_diff.go index 31124733..bdade017 100644 --- a/diff/servers_diff.go +++ b/diff/servers_diff.go @@ -34,8 +34,8 @@ func newServersDiff() *ServersDiff { } } -func getServersDiff(config *Config, state *state, pServers1, pServers2 *openapi3.Servers) *ServersDiff { - diff := getServersDiffInternal(config, state, pServers1, pServers2) +func getServersDiff(config *Config, pServers1, pServers2 *openapi3.Servers) *ServersDiff { + diff := getServersDiffInternal(config, pServers1, pServers2) if diff.Empty() { return nil @@ -44,7 +44,7 @@ func getServersDiff(config *Config, state *state, pServers1, pServers2 *openapi3 return diff } -func getServersDiffInternal(config *Config, state *state, pServers1, pServers2 *openapi3.Servers) *ServersDiff { +func getServersDiffInternal(config *Config, pServers1, pServers2 *openapi3.Servers) *ServersDiff { result := newServersDiff() @@ -53,7 +53,7 @@ func getServersDiffInternal(config *Config, state *state, pServers1, pServers2 * for _, server1 := range servers1 { if server2 := findServer(server1, servers2); server2 != nil { - diff, err := getServerDiff(config, state, server1, server2) + diff, err := getServerDiff(config, server1, server2) if err != nil { return nil } diff --git a/diff/subschemas_diff.go b/diff/subschemas_diff.go index ee2d0862..0c081310 100644 --- a/diff/subschemas_diff.go +++ b/diff/subschemas_diff.go @@ -207,7 +207,7 @@ func isSingleModifiedCase(schemaRefs1, schemaRefs2 openapi3.SchemaRefs, addedIdx func compareByTitle(config *Config, state *state, addedIdx, deletedIdx []int, schemaRefs1, schemaRefs2 openapi3.SchemaRefs) ([]int, []int, ModifiedSubschemas, error) { - addedMatched, deletedMatched := matchByTitle(config, state, addedIdx, deletedIdx, schemaRefs1, schemaRefs2) + addedMatched, deletedMatched := matchByTitle(addedIdx, deletedIdx, schemaRefs1, schemaRefs2) modifiedSchemas := ModifiedSubschemas{} for _, addedId := range addedIdx { @@ -236,7 +236,7 @@ func deleteMatched(idx []int, addedMatched map[int]int) []int { return addedIdxRemaining } -func matchByTitle(config *Config, state *state, addedIdx, deletedIdx []int, schemaRefs1, schemaRefs2 openapi3.SchemaRefs) (map[int]int, map[int]int) { +func matchByTitle(addedIdx, deletedIdx []int, schemaRefs1, schemaRefs2 openapi3.SchemaRefs) (map[int]int, map[int]int) { addedMatched := map[int]int{} deletedMatched := map[int]int{} diff --git a/diff/tag_diff.go b/diff/tag_diff.go index 7376fb3c..89de0f11 100644 --- a/diff/tag_diff.go +++ b/diff/tag_diff.go @@ -15,8 +15,8 @@ func (diff *TagDiff) Empty() bool { return diff == nil || *diff == TagDiff{} } -func getTagDiff(config *Config, state *state, tag1, tag2 *openapi3.Tag) *TagDiff { - diff := getTagDiffInternal(config, state, tag1, tag2) +func getTagDiff(config *Config, tag1, tag2 *openapi3.Tag) *TagDiff { + diff := getTagDiffInternal(config, tag1, tag2) if diff.Empty() { return nil @@ -25,7 +25,7 @@ func getTagDiff(config *Config, state *state, tag1, tag2 *openapi3.Tag) *TagDiff return diff } -func getTagDiffInternal(config *Config, state *state, tag1, tag2 *openapi3.Tag) *TagDiff { +func getTagDiffInternal(config *Config, tag1, tag2 *openapi3.Tag) *TagDiff { result := TagDiff{} result.NameDiff = getValueDiff(tag1.Name, tag2.Name) diff --git a/diff/tags_diff.go b/diff/tags_diff.go index 3277af49..2b76cbd0 100644 --- a/diff/tags_diff.go +++ b/diff/tags_diff.go @@ -34,8 +34,8 @@ func (tagsDiff *TagsDiff) Empty() bool { len(tagsDiff.Modified) == 0 } -func getTagsDiff(config *Config, state *state, tags1, tags2 openapi3.Tags) *TagsDiff { - diff := getTagsDiffInternal(config, state, tags1, tags2) +func getTagsDiff(config *Config, tags1, tags2 openapi3.Tags) *TagsDiff { + diff := getTagsDiffInternal(config, tags1, tags2) if diff.Empty() { return nil @@ -44,13 +44,13 @@ func getTagsDiff(config *Config, state *state, tags1, tags2 openapi3.Tags) *Tags return diff } -func getTagsDiffInternal(config *Config, state *state, tags1, tags2 openapi3.Tags) *TagsDiff { +func getTagsDiffInternal(config *Config, tags1, tags2 openapi3.Tags) *TagsDiff { result := newTagsDiff() for _, tag1 := range tags1 { if tag2 := tags2.Get(tag1.Name); tag2 != nil { - if diff := getTagDiff(config, state, tag1, tag2); !diff.Empty() { + if diff := getTagDiff(config, tag1, tag2); !diff.Empty() { result.Modified[tag1.Name] = diff } } else { diff --git a/diff/variable_diff.go b/diff/variable_diff.go index 98bc79a9..672c1b50 100644 --- a/diff/variable_diff.go +++ b/diff/variable_diff.go @@ -17,8 +17,8 @@ func (diff *VariableDiff) Empty() bool { return diff == nil || *diff == VariableDiff{} } -func getVariableDiff(config *Config, state *state, var1, var2 *openapi3.ServerVariable) (*VariableDiff, error) { - diff, err := getVariableDiffInternal(config, state, var1, var2) +func getVariableDiff(config *Config, var1, var2 *openapi3.ServerVariable) (*VariableDiff, error) { + diff, err := getVariableDiffInternal(config, var1, var2) if err != nil { return nil, err } @@ -30,11 +30,11 @@ func getVariableDiff(config *Config, state *state, var1, var2 *openapi3.ServerVa return diff, nil } -func getVariableDiffInternal(config *Config, state *state, var1, var2 *openapi3.ServerVariable) (*VariableDiff, error) { +func getVariableDiffInternal(config *Config, var1, var2 *openapi3.ServerVariable) (*VariableDiff, error) { result := VariableDiff{} var err error - result.ExtensionsDiff, err = getExtensionsDiff(config, state, var1.Extensions, var2.Extensions) + result.ExtensionsDiff, err = getExtensionsDiff(config, var1.Extensions, var2.Extensions) if err != nil { return nil, err } diff --git a/diff/variables_diff.go b/diff/variables_diff.go index 9938d83e..3bb17903 100644 --- a/diff/variables_diff.go +++ b/diff/variables_diff.go @@ -34,8 +34,8 @@ func newVariablesDiff() *VariablesDiff { } } -func getVariablesDiff(config *Config, state *state, variables1, variables2 map[string]*openapi3.ServerVariable) (*VariablesDiff, error) { - diff, err := getVariablesDiffInternal(config, state, variables1, variables2) +func getVariablesDiff(config *Config, variables1, variables2 map[string]*openapi3.ServerVariable) (*VariablesDiff, error) { + diff, err := getVariablesDiffInternal(config, variables1, variables2) if err != nil { return nil, err } @@ -47,7 +47,7 @@ func getVariablesDiff(config *Config, state *state, variables1, variables2 map[s return diff, nil } -func getVariablesDiffInternal(config *Config, state *state, variables1, variables2 map[string]*openapi3.ServerVariable) (*VariablesDiff, error) { +func getVariablesDiffInternal(config *Config, variables1, variables2 map[string]*openapi3.ServerVariable) (*VariablesDiff, error) { result := newVariablesDiff() for name1, var1 := range variables1 { @@ -57,7 +57,7 @@ func getVariablesDiffInternal(config *Config, state *state, variables1, variable continue } - diff, err := getVariableDiff(config, state, var1, var2) + diff, err := getVariableDiff(config, var1, var2) if err != nil { return nil, err }