/
formats.ts
53 lines (50 loc) · 1.53 KB
/
formats.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { jsonSchemaDraft4, jsonSchemaDraft7 } from '@stoplight/spectral-formats';
import { schema } from '@stoplight/spectral-functions';
import { RulesetDefinition } from '@stoplight/spectral-core';
import _base from './_base';
export { ruleset as default };
const ruleset: RulesetDefinition = {
rules: {
..._base.rules,
},
overrides: [
{
files: ['schemas/**/*.draft7.json'],
formats: [jsonSchemaDraft7],
rules: {
// if you stumbled upon this file and want to use this rule in your own ruleset - do NOT.
// it doesn't cover many cases, and it's only purpose is to serve us as a test artefact
'valid-number-validation': {
given: ['$..exclusiveMinimum', '$..exclusiveMaximum'],
then: {
function: schema,
functionOptions: {
schema: {
type: 'number',
},
},
},
},
},
},
{
files: ['schemas/**/*.draft4.json'],
formats: [jsonSchemaDraft4],
rules: {
// if you stumbled upon this file and want to use this rule in your own ruleset - do NOT.
// it doesn't cover many cases, and it's only purpose is to serve us as a test artefact
'valid-number-validation': {
given: ['$..exclusiveMinimum', '$..exclusiveMaximum'],
then: {
function: schema,
functionOptions: {
schema: {
type: 'boolean',
},
},
},
},
},
},
],
};