All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Introduce parser options #1350
- Allow
documentationUrlto be specified for each rule #1356 - CLI: new
--fail-on-unmatched-globsflag #1117
- CLI:
--fail-on-unmatched-globsshould be used instead of--show-unmatched-globs
- CLI: JUnit formatter respects fail-severity #935
- Respect nullable in case of OAS3 document #1353
- Schema function handles non-string enum values #1377
oas-valid-exampleignores externalValue #1379- Expose
definedfunction correctly #1384
- YAML merge keys can be used in rulesets #1325
- New built-in function
defined#1338 - Enhance error message formatting #1339
- JS API: Document format lookup functions takes filepath #1348
- JS API: Support proxies #1081
- Ruleset accepts
documentationUrlproperty to specify the source of the documentation #1242 - Introduce an experimental JSON Path engine to speed up the linting process #1136. Currently hidden behind USE_NIMMA env variable.
- Improve examples validation #1284
- Path Params being applied to more than http operations #1187
- Occasional out of memory errors caused by better-ajv-errors #1223, #455
- Unexpected result while linting an empty document #1209
- Casing function supports leading char #1256
operation-paramatersrule outputs better messages #1235- Document sources are not normalized correctly under Windows #1185
- Various performance improvements #1184, #1188, #1189, #1300
- New AsyncAPI 2 ruleset and format #965
- Custom functions can be async #694
- Expose fetch and cache to custom functions #1078, #1079
- Drop
example-value-or-externalValuerule and introduceoas3-examples-value-or-externalValue#883, #1098 - Drop useless oas rule tags #1095
- AJV: swallow missing references #1147
- Improve ruleset validation #1144
- Allow running spectral from any directory in Docker #1022
- Improve
oas2-schemaandoas3-schemarules #403 path-paramsrule now properly detects undefined parameters across operations #1076- Load custom functions from NPM correctly #1093
- Teach
path-paramsto report an actual endpoint path #1130
- Built-in functions can now be accessed from custom functions #925
- CLI:
--show-unmatched-globsflag #747
typed-enumfunction is no longer a built-in function. It's been migrated into a custom function of the OpenAPI ruleset #924openapi-tagsrule has been fixed to make it fit its description #1038
- Ruleset exceptions used to slip certain errors through cracks #1018
- Correct misleading
info-licensemessage #1031 - Requiring packages located under node_modules is possible #1029
- Set proper document source if legacy parsed result is given #1040
- YAMLIncompatibleValue diagnostics are now considered warnings #1009
- Alphabetical rule works correctly for $refs #979
- Implement a new
typed-enumrule to detect enum value that do not respect specified type #913 - API: introduced document #876 - note, this is not a breaking change
- Introduce optional enhancers to casing function #884
- Improved Example Object validation #882
oas3-operation-security-definedrule supports optional authentication #895- Generate more correct paths when reporting an error #900
example-value-or-externalValueno longer reports false positives #899schema-pathaccepts a JSON Path expression as a field selector #917schema-pathhandles invalid values gracefully #917oas3-valid-(content-)schema-examplerules handle nullable correctly #914
- Alphabetical rule function now supports numeric keys #730
- Non-JSON-ish YAML mapping keys are reported #726
- CLI: new formatter - text #822
- CLI: new formatter - teamcity #823
- CLI: new formatter - HTML #389
- CLI: custom resolver can be provided leveraging --resolver flag #717
- CLI: input can be provided via STDIN #757
- Implement ignoreUnsupportedFormats to make it easier to detect unrecognized formats #678
- Rule's Given can be an array now #799
- Casing built-in function is added #564
- New oas rule -
operation-tag-defined#704
- BREAKING: The oas2 and oas3 rulesets have been merged into a single oas ruleset #773
- BREAKING: Deprecated Spectral#addRules and Spectral#addFunctions have been removed #561
- BREAKING: Some oas rules, such as
example-value-or-externalValueandopenapi-tags, are now included in the recommended rulset #725 #706 - BREAKING: The
model-descriptionandoperation-summary-formattedrules have been removed #725 - BREAKING: The
whenrule property has been removed #585 - BREAKING: Rules are set to recommended by default #719
- Improved error source detection #685
- Error paths point at unresolved document #839
- Validation messages contain more consistent error paths #867
- CLI: Default
--fail-severityis nowerror, so getting awarn,infoor ahintwill not return a exit status code #706 - Rulesets no longer require a
rulesproperty #652
- Circular remote references with JSON pointers are resolved correctly json-ref-resolver#141
- Local root JSON pointers are resolved correctly json-ref-resolver#146
- Invalid JSON pointers are reported as errors now json-ref-resolver#140 and json-ref-resolver#147
- Unixify glob patterns under Windows #679
- Improved duplicate keys detection #751
- Spectral should be usable in browsers with no crypto module available #846
- Falsy values are printed in validation messages #824
- Validation results are no longer duplicate #680, #737 and #856
- CLI: glob patterns and multiple paths are allowed #534
- CLI: control fail severity and result display #368
- CLI: new formatter - JUnit #478
- CLI: add possibility to proxy requests #446
- Built-in ruleset formats targeting JSON Schema files #571
{{value}}and{{path}}can be used in messages #520 #572
whenRule property is deprecated #585
- Validation results produced by
alphabeticalfunction are more meaningful #613 - Enhanced JSON Schema enum validation #579
- Improved messages generated by
oasPathParamfunction #537 - CLI: the amount of enabled rules is now displayed if you run Spectral with
--verboseflag #435 - Stricter source matching for errors #615
schemafunction can validate falsy values 10e5d1cschemafunction can validate Draft 6 and Draft 7 JSON Schemas ea2ddff- Parameters in links objects are not linted for not having a description property. #272
- More accurate ranges for errors occurring in referenced files 6986b82
- CLI: stylish formatter reports
infoandhintseverity levels correctly #565
CLI: missing tslib #524
- Rulesets can be loaded using
Spectral#loadRulesetmethod - Custom functions can be registered directly in rulesets
- Rulesets can be registered against document format
- New rules: no-$ref-siblings, oas2-anyOf, oas2-oneOf
- YAML's merge keys are supported
- $refs can be used in rulesets
- Resolved document is accessible now if you use
Spectral#runWithResolvedmethod #398
- valid-example rule has been broken into smaller, more specific rules #223
- YAML scalar values are parsed according to YAML 1.2 spec #481
- We swapped oclif with yargs
addRulesandaddFunctionshave been deprecated, usesetRulesandsetFunctionsinstead- Importing built-in ruleset in cjs/esm module way (via require or import) is no longer recommended. Consider using
#loadRulesetinstead
- CLI: relative paths to documents are supported #474
- Improved path and ranges generation #458, #459
- Unknown schema formats are no longer printed #396
- Graceful handling of circular rulesets
- A few other minor issues
- Resolve references to files with relative paths
- Tweaked JSON Path lookup for paths to avoid deep scan, speeding up linting for large documents #413
- NPM install for Windows users was failing due to a dependency not supporting Windows in their build script
- Using the CLI with multiple, custom rulesets
- New syntax for rulesets, including overriding rules and extending rulesets
- More friendly errors and warnings
- CLI
--quietflag added to lint command, removing any output other than results - CLI
--skip-rulesflag added to lint command, to ignore certain rules
- CLI now reports errors and warnings for referenced (
$ref) files
- Configuration files were briefly available in 3.x but removed in v4.0
- CLI
--max-resultsflag is removed