github stoplightio/spectral v2.0.0

latest releases: v6.11.1, @stoplight/spectral-cli-6.11.1, @stoplight/spectral-parsers-1.0.4...
5 years ago

2.0.0 (2019-03-28)

Features

  • Added a CLI for linting without needing to play with JavaScript (#105)
  • Use json-ref-parser by default to provide dereferenced object, (#99)
  • Add file paths and line numbers to results, used for CLI output (#106 & #117)
  • Show YAML parsing errors as results (#118)

BREAKING CHANGES

  • The spectral.run() method is now async, so add the await keyword before it
  • The spectral.run() method now returns an array of results, instead of an object containing an array
  • Removed schema-items-is-object rule (#100) (2e5902f)

Before

const resolved = someCustomResolver(specification);
const results = spectral.run(specification, { resolvedTarget: resolved });
console.log(results.results) // [ { ... } ]

After

const results = await spectral.run(specification);
console.log(results) // [ { ... } ]

This is a big simplification to the API, as it will resolve things for you (internal $ref only, so any $ref which is pointing to a location within the same file).

The ability to pass in other resolvers to support external references or other resolving strategies will come in future versions.

Don't miss a new spectral release

NewReleases is sending notifications on new releases.