-
Notifications
You must be signed in to change notification settings - Fork 5
OpenAPI linter
Andriy Mykulyak edited this page Jun 10, 2023
·
7 revisions
This document describes the architecture of the fresha-openapi-lint tool.
/openapi-lint
/bin
fresha-openapi-lint.js
/src
/formatters
/linter
Linter.ts
LinterConfig.ts
LintResult.ts
ResultFormatter.ts
/rules
/fresha
/jsonapi
/openapi
api.ts
cli.ts
types.ts-
bin/fresha-openapi-lint.js- this file is run bynpx fresha-openap-lint. All it does is to requirebuild/cli.js(the transpiled version of thesrc/cli.ts) -
src/api.ts- This is what gets required byimport '@fresha/openapi-lint';, it exports the public API of the linter. -
src/cli.ts- This is linter CLI. It:- parses the command line
- loads linter configuration file and initializes a
LinterConfigobject - constructs
LinterandLintResultobjects - reads OpenAPI documents specified in the command line, and invokes
Linter.runmethod on each of them - creates a
ResultFormatterinstance and formats the linter result
-
src/types.ts- contains public types used in this package -
src/formatters/- contains result formatters -
src/linter/- contains implementation of the linter functionality -
src/rules/- contains built-in rules and rulesets-
src/rules/openapi/- generic OpenAPI 3.x rules -
src/rules/jsonapi/- generic JSON:API rules -
src/rules/fresha/- rules specific to Fresha
-
-
--config <FILE>- path to the configuration file -
--verbose- prints more information -
--fix- automatically fix problems -
--format <NAME>- use specified output format -
--help- show help -
--version- show package version -
--init- initializes a configuration wizard that helps to create a config file -
--max-warnings <N>- minimal number of warnings to trigger non-zero exit code -
--print-config- prints configuration used