insomnia/packages/insomnia-app/app/common/spectral.ts
2021-06-30 15:11:20 +00:00

13 lines
400 B
TypeScript

import { IRuleResult, isOpenApiv2, isOpenApiv3, Spectral } from '@stoplight/spectral';
export const initializeSpectral = () => {
const spectral = new Spectral();
spectral.registerFormat('oas2', isOpenApiv2);
spectral.registerFormat('oas3', isOpenApiv3);
spectral.loadRuleset('spectral:oas');
return spectral;
};
export const isLintError = (result: IRuleResult) => result.severity === 0;