Skip to content

Commit df0ba6c

Browse files
committed
use rules provided by the user
1 parent 538a077 commit df0ba6c

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/definitionGenerator.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@ class DefinitionGenerator {
6969
},
7070
};
7171

72+
try {
73+
this.REDOCLY_RULES = require(path.resolve("options", "redocly.json"));
74+
} catch (err) {
75+
this.REDOCLY_RULES = {
76+
spec: "error",
77+
"path-parameters-defined": "error",
78+
"operation-2xx-response": "error",
79+
"operation-4xx-response": "error",
80+
"operation-operationId-unique": "error",
81+
"path-declaration-must-exist": "error",
82+
};
83+
}
84+
7285
try {
7386
this.refParserOptions = require(path.resolve("options", "ref-parser.js"));
7487
} catch (err) {
@@ -1003,16 +1016,7 @@ class DefinitionGenerator {
10031016
async validate() {
10041017
const config = await createConfig({
10051018
apis: {},
1006-
// styleguide: {
1007-
rules: {
1008-
spec: "error",
1009-
"path-parameters-defined": "error",
1010-
"operation-2xx-response": "error",
1011-
"operation-4xx-response": "error",
1012-
"operation-operationId-unique": "error",
1013-
"path-declaration-must-exist": "error",
1014-
},
1015-
// },
1019+
rules: this.REDOCLY_RULES,
10161020
});
10171021

10181022
const apiDesc = stringifyYaml(this.openAPI);

0 commit comments

Comments
 (0)