github stoplightio/spectral v2.0.0

latest releases: @stoplight/spectral-rulesets-1.21.1, @stoplight/spectral-functions-1.9.1, @stoplight/spectral-formatters-1.4.1...
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.