diff --git a/internal/flatten.go b/internal/flatten.go index bf8ad954..8ba9e8b4 100644 --- a/internal/flatten.go +++ b/internal/flatten.go @@ -22,7 +22,7 @@ Spec can be a path to a file, a URL or '-' to read standard input. Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - flags.source = load.GetSource(args[0]) + flags.spec = load.GetSource(args[0]) // by now flags have been parsed successfully so we don't need to show usage on any errors cmd.Root().SilenceUsage = true @@ -49,9 +49,9 @@ func runFlatten(flags *FlattenFlags, stdout io.Writer) *ReturnError { loader := openapi3.NewLoader() loader.IsExternalRefsAllowed = true - spec, err := load.LoadSpecInfo(loader, flags.source) + spec, err := load.LoadSpecInfo(loader, flags.spec) if err != nil { - return getErrFailedToLoadSpec("original", flags.source, err) + return getErrFailedToLoadSpec("original", flags.spec, err) } // TODO: get the original format of the spec @@ -59,7 +59,7 @@ func runFlatten(flags *FlattenFlags, stdout io.Writer) *ReturnError { flatSpec, err := flatten.MergeSpec(spec.Spec) if err != nil { - return getErrFailedToFlattenSpec("original", flags.source, err) + return getErrFailedToFlattenSpec("original", flags.spec, err) } if returnErr := outputFlattenedSpec(format, stdout, flatSpec); returnErr != nil { diff --git a/internal/flatten_flags.go b/internal/flatten_flags.go index 8ba9c647..9b5f61e3 100644 --- a/internal/flatten_flags.go +++ b/internal/flatten_flags.go @@ -3,7 +3,7 @@ package internal import "github.com/tufin/oasdiff/load" type FlattenFlags struct { - source load.Source + spec load.Source format string circularReferenceCounter int }