diff --git a/README.md b/README.md index dc9c3c66..643639f5 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ docker run --rm -t tufin/oasdiff -format text -base https://raw.githubuserconten - Comprehensive diff including all aspects of [OpenAPI Specification](https://swagger.io/specification/): paths, operations, parameters, request bodies, responses, schemas, enums, callbacks, security etc. - Allow [non-breaking removal of deprecated resources](#non-breaking-removal-of-deprecated-resources-beta) - Support [path prefix modification](#path-prefix-modification) -- OpenAPI [Lint](#lint-beta) - [Extend Breaking-Changes with Custom Checks](CUSTOMIZING-CHECKS.md) ## Install with Go @@ -84,8 +83,6 @@ Copy binaries from [latest release](https://github.com/Tufin/oasdiff/releases/) language for localized breaking changes checks errors (default "en") -max-circular-dep int maximum allowed number of circular dependencies between objects in OpenAPI specs (default 5) - -no-lint - disable linter -prefix string deprecated. use '-prefix-revision' instead -prefix-base string @@ -442,13 +439,6 @@ You can use the `-exclude-elements` flag to exclude certain kinds of changes: You can ignore multiple elements with a comma-separated list of excluded elements as in [this example](#ignore-changes-to-description-and-examples). Note that [Extensions](https://swagger.io/specification/#specification-extensions) are always excluded from the diff. -## Lint [Beta] -oasdiff performs a lint to validate both specs before running the diff and breaking-changes. -If errors are found, the diff is aborted and the errors are displayed instead. -You can pass `-no-lint` to skip lint validation. - -Note: This is a Beta feature, please report issues - ## Notes for Go Developers ### Embedding oasdiff into your program ```go diff --git a/internal/flags.go b/internal/flags.go index dc641064..b401b35e 100644 --- a/internal/flags.go +++ b/internal/flags.go @@ -39,7 +39,6 @@ type InputFlags struct { excludeEndpoints bool includeChecks utils.StringList excludeElements utils.StringList - noLint bool } func parseFlags(args []string, stdout io.Writer) (*InputFlags, *ReturnError) { @@ -79,7 +78,6 @@ func parseFlags(args []string, stdout io.Writer) (*InputFlags, *ReturnError) { flags.BoolVar(&inputFlags.excludeEndpoints, "exclude-endpoints", false, "exclude endpoints from output (deprecated, use '-exclude-elements endpoints' instead)") flags.Var(&inputFlags.includeChecks, "include-checks", "comma-separated list of optional breaking-changes checks") flags.Var(&inputFlags.excludeElements, "exclude-elements", "comma-separated list of elements to exclude from diff") - flags.BoolVar(&inputFlags.noLint, "no-lint", false, "disable linter") flags.SetOutput(stdout) if err := flags.Parse(args[1:]); err != nil { diff --git a/internal/run.go b/internal/run.go index b926c81b..78e15dd9 100644 --- a/internal/run.go +++ b/internal/run.go @@ -8,7 +8,6 @@ import ( "github.com/tufin/oasdiff/build" "github.com/tufin/oasdiff/checker" "github.com/tufin/oasdiff/diff" - "github.com/tufin/oasdiff/lint" "github.com/tufin/oasdiff/load" ) @@ -87,11 +86,11 @@ func runInternal(args []string, stdout io.Writer, stderr io.Writer) (bool, *Retu return false, getErrDiffFailed(err) } } else { - s1, returnErr := linter(stdout, inputFlags.base, "base", inputFlags.noLint) + s1, returnErr := open(stdout, inputFlags.base, "base") if returnErr != nil { return false, returnErr } - s2, returnErr := linter(stdout, inputFlags.revision, "revision", inputFlags.noLint) + s2, returnErr := open(stdout, inputFlags.revision, "revision") if returnErr != nil { return false, returnErr } @@ -118,23 +117,13 @@ func runInternal(args []string, stdout io.Writer, stderr io.Writer) (bool, *Retu return failEmpty(inputFlags.failOnDiff, diffReport.Empty()), handleDiff(stdout, diffReport, inputFlags.format) } -func linter(stdout io.Writer, source string, name string, noLint bool) (*load.OpenAPISpecInfo, *ReturnError) { +func open(stdout io.Writer, source string, name string) (*load.OpenAPISpecInfo, *ReturnError) { s, err := checker.LoadOpenAPISpecInfo(source) if err != nil { return nil, getErrFailedToLoadSpec(name, source, err) } - if noLint { - return s, nil - } - - errs := lint.Run(*lint.DefaultConfig(), source, s) - if len(errs) > 0 { - printYAML(stdout, errs) - return nil, getErrLintFailed() - } - return s, nil } diff --git a/internal/run_test.go b/internal/run_test.go index a3163a65..2bfaee46 100644 --- a/internal/run_test.go +++ b/internal/run_test.go @@ -168,15 +168,3 @@ func Test_Version(t *testing.T) { require.Zero(t, internal.Run(cmdToArgs("oasdiff -version"), &stdout, io.Discard)) require.Contains(t, stdout.String(), "oasdiff version:") } - -func Test_LintFailed(t *testing.T) { - var stdout bytes.Buffer - require.Equal(t, 130, internal.Run(cmdToArgs("oasdiff -base ../data/lint/openapi-invalid-regex.yaml -revision ../data/openapi-test3.yaml"), &stdout, io.Discard)) - var errs interface{} - require.NoError(t, yaml.Unmarshal(stdout.Bytes(), &errs)) - require.Len(t, errs, 1) -} - -func Test_NoLint(t *testing.T) { - require.Zero(t, internal.Run(cmdToArgs("oasdiff -base ../data/openapi-test3.yaml -revision ../data/openapi-test3.yaml"), io.Discard, io.Discard)) -}