![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
@fortellis/spec-linter
Advanced tools
Readme
The Fortellis specification validator can be used to ensure that API specifications conform to the Fortellis rules and standards. More information on the Fortellis rules and standards can be found here.
npm i @fortellis/spec-validator
The spec validator exposes two functions for linting api specifications, one for yaml strings and one for parsed JSON objects. Both return an array of resulting linting notices in the spec. A valid spec will return an empty array.
const { lint } = require('@fortellis/spec-validator');
const mySpec = {
// ...
};
const results = lint(mySpec);
const fs = require('fs');
const { lintRaw } = require('@fortellis/spec-validator');
const mySpec = fs.readFileSync('./my-spec.yaml', 'utf8');
const results = lintRaw(mySpec);
Both functions take a second argument to supply an options object. The options object will allow you to partially customize the behavior of the linter. The following are available items in the options object:
Key | Type | Description | Default |
---|---|---|---|
rulesets | object | Define the rulesets used in the linter. Each ruleset is a key in this object. | {} |
severity | enum (number) | Determine the level of linting notice that should be returned in the results array (error (0) , warn (1) , info (2) , hint (3) ). These severity levels are exported as Severity from @fortellis/spec-validator . | 0 |
verbose | boolean | Enable/Disable logging from the linter | false |
The results array that shows you all of the linter notices for the passed in spec will contain objects will a bunch of information about the specific notice and where the notice is located in the spec.
Key | Type | Description |
---|---|---|
code | string | Where the notice originated from. |
message | string | The human readable description of the cause of the notice. |
severity | number | The severity level of the notice (error (0) , warn (1) , info (2) , hint (3) ). |
path | array | An array of keys denoting the location of the notice within the spec. |
range | object | Contains the start and end objects which denote the exact line and character location of the notice within the original spec. |
{
code: 'parser',
message: 'Mapping key must be a string scalar rather than number',
severity: 0,
path: [
'paths',
'/my-endpoint',
'get',
'responses',
'200'
],
range: {
start: {
line: 44,
character: 8
},
end: {
line: 44,
character: 11
}
}
}
FAQs
Validate fortellis API specifications
The npm package @fortellis/spec-linter receives a total of 0 weekly downloads. As such, @fortellis/spec-linter popularity was classified as not popular.
We found that @fortellis/spec-linter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.