docusaurus-plugin-openapi-docs 0.0.0-408 → 0.0.0-409
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/markdown/schema.js +36 -13
- package/lib/markdown/schema.test.js +18 -18
- package/package.json +2 -2
- package/src/markdown/schema.test.ts +18 -18
- package/src/markdown/schema.ts +40 -13
package/lib/markdown/schema.js
CHANGED
|
@@ -61,12 +61,25 @@ function getQualifierMessage(schema) {
|
|
|
61
61
|
let qualifierGroups = [];
|
|
62
62
|
if (schema.minLength || schema.maxLength) {
|
|
63
63
|
let lengthQualifier = "";
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
let minLength;
|
|
65
|
+
let maxLength;
|
|
66
|
+
if (schema.minLength && schema.minLength > 1) {
|
|
67
|
+
minLength = `\`>= ${schema.minLength} characters\``;
|
|
68
|
+
}
|
|
69
|
+
if (schema.minLength && schema.minLength === 1) {
|
|
70
|
+
minLength = `\`non-empty\``;
|
|
66
71
|
}
|
|
67
|
-
lengthQualifier += "length";
|
|
68
72
|
if (schema.maxLength) {
|
|
69
|
-
|
|
73
|
+
maxLength = `\`<= ${schema.maxLength} characters\``;
|
|
74
|
+
}
|
|
75
|
+
if (minLength && !maxLength) {
|
|
76
|
+
lengthQualifier += minLength;
|
|
77
|
+
}
|
|
78
|
+
if (maxLength && !minLength) {
|
|
79
|
+
lengthQualifier += maxLength;
|
|
80
|
+
}
|
|
81
|
+
if (minLength && maxLength) {
|
|
82
|
+
lengthQualifier += `${minLength} and ${maxLength}`;
|
|
70
83
|
}
|
|
71
84
|
qualifierGroups.push(lengthQualifier);
|
|
72
85
|
}
|
|
@@ -75,24 +88,34 @@ function getQualifierMessage(schema) {
|
|
|
75
88
|
typeof schema.exclusiveMinimum === "number" ||
|
|
76
89
|
typeof schema.exclusiveMaximum === "number") {
|
|
77
90
|
let minmaxQualifier = "";
|
|
91
|
+
let minimum;
|
|
92
|
+
let maximum;
|
|
78
93
|
if (typeof schema.exclusiveMinimum === "number") {
|
|
79
|
-
|
|
94
|
+
minimum = `\`> ${schema.exclusiveMinimum}\``;
|
|
80
95
|
}
|
|
81
96
|
else if (schema.minimum && !schema.exclusiveMinimum) {
|
|
82
|
-
|
|
97
|
+
minimum = `\`>= ${schema.minimum}\``;
|
|
83
98
|
}
|
|
84
99
|
else if (schema.minimum && schema.exclusiveMinimum === true) {
|
|
85
|
-
|
|
100
|
+
minimum = `\`> ${schema.minimum}\``;
|
|
86
101
|
}
|
|
87
|
-
minmaxQualifier += "value";
|
|
88
102
|
if (typeof schema.exclusiveMaximum === "number") {
|
|
89
|
-
|
|
103
|
+
maximum = `\`< ${schema.exclusiveMaximum}\``;
|
|
90
104
|
}
|
|
91
105
|
else if (schema.maximum && !schema.exclusiveMaximum) {
|
|
92
|
-
|
|
106
|
+
maximum = `\`<= ${schema.maximum}\``;
|
|
93
107
|
}
|
|
94
108
|
else if (schema.maximum && schema.exclusiveMaximum === true) {
|
|
95
|
-
|
|
109
|
+
maximum = `\`< ${schema.maximum}\``;
|
|
110
|
+
}
|
|
111
|
+
if (minimum && !maximum) {
|
|
112
|
+
minmaxQualifier += minimum;
|
|
113
|
+
}
|
|
114
|
+
if (maximum && !minimum) {
|
|
115
|
+
minmaxQualifier += maximum;
|
|
116
|
+
}
|
|
117
|
+
if (minimum && maximum) {
|
|
118
|
+
minmaxQualifier += `${minimum} and ${maximum}`;
|
|
96
119
|
}
|
|
97
120
|
qualifierGroups.push(minmaxQualifier);
|
|
98
121
|
}
|
|
@@ -109,10 +132,10 @@ function getQualifierMessage(schema) {
|
|
|
109
132
|
qualifierGroups.push(`[${schema.enum.map((e) => `\`${e}\``).join(", ")}]`);
|
|
110
133
|
}
|
|
111
134
|
if (schema.minItems) {
|
|
112
|
-
qualifierGroups.push(
|
|
135
|
+
qualifierGroups.push(`\`>= ${schema.minItems}\``);
|
|
113
136
|
}
|
|
114
137
|
if (schema.maxItems) {
|
|
115
|
-
qualifierGroups.push(
|
|
138
|
+
qualifierGroups.push(`\`<= ${schema.maxItems}\``);
|
|
116
139
|
}
|
|
117
140
|
if (qualifierGroups.length === 0) {
|
|
118
141
|
return undefined;
|
|
@@ -16,17 +16,17 @@ describe("getQualifierMessage", () => {
|
|
|
16
16
|
// minLength + maxLength
|
|
17
17
|
//
|
|
18
18
|
it("should render minLength", () => {
|
|
19
|
-
const expected = "**Possible values:**
|
|
19
|
+
const expected = "**Possible values:** `non-empty`";
|
|
20
20
|
const actual = (0, schema_1.getQualifierMessage)({ minLength: 1 });
|
|
21
21
|
expect(actual).toBe(expected);
|
|
22
22
|
});
|
|
23
23
|
it("should render maxLength", () => {
|
|
24
|
-
const expected = "**Possible values:**
|
|
24
|
+
const expected = "**Possible values:** `<= 40 characters`";
|
|
25
25
|
const actual = (0, schema_1.getQualifierMessage)({ maxLength: 40 });
|
|
26
26
|
expect(actual).toBe(expected);
|
|
27
27
|
});
|
|
28
28
|
it("should render minLength and maxLength", () => {
|
|
29
|
-
const expected = "**Possible values:**
|
|
29
|
+
const expected = "**Possible values:** `non-empty` and `<= 40 characters`";
|
|
30
30
|
const actual = (0, schema_1.getQualifierMessage)({ minLength: 1, maxLength: 40 });
|
|
31
31
|
expect(actual).toBe(expected);
|
|
32
32
|
});
|
|
@@ -39,7 +39,7 @@ describe("getQualifierMessage", () => {
|
|
|
39
39
|
expect(actual).toBe(expected);
|
|
40
40
|
});
|
|
41
41
|
it("should render multiple string qualifiers", () => {
|
|
42
|
-
const expected = "**Possible values:**
|
|
42
|
+
const expected = "**Possible values:** `non-empty` and `<= 40 characters`, Value must match regular expression `^[a-zA-Z0-9_-]*$`";
|
|
43
43
|
const actual = (0, schema_1.getQualifierMessage)({
|
|
44
44
|
minLength: 1,
|
|
45
45
|
maxLength: 40,
|
|
@@ -59,42 +59,42 @@ describe("getQualifierMessage", () => {
|
|
|
59
59
|
// minimum + maximum + exclusiveMinimum + exclusiveMaximum
|
|
60
60
|
//
|
|
61
61
|
it("should render minimum", () => {
|
|
62
|
-
const expected = "**Possible values:** 1
|
|
62
|
+
const expected = "**Possible values:** `>= 1`";
|
|
63
63
|
const actual = (0, schema_1.getQualifierMessage)({ minimum: 1 });
|
|
64
64
|
expect(actual).toBe(expected);
|
|
65
65
|
});
|
|
66
66
|
it("should render maximum", () => {
|
|
67
|
-
const expected = "**Possible values:**
|
|
67
|
+
const expected = "**Possible values:** `<= 40`";
|
|
68
68
|
const actual = (0, schema_1.getQualifierMessage)({ maximum: 40 });
|
|
69
69
|
expect(actual).toBe(expected);
|
|
70
70
|
});
|
|
71
71
|
it("should render numeric exclusiveMinimum", () => {
|
|
72
|
-
const expected = "**Possible values:** 1
|
|
72
|
+
const expected = "**Possible values:** `> 1`";
|
|
73
73
|
const actual = (0, schema_1.getQualifierMessage)({ exclusiveMinimum: 1 });
|
|
74
74
|
expect(actual).toBe(expected);
|
|
75
75
|
});
|
|
76
76
|
it("should render numeric exclusiveMaximum", () => {
|
|
77
|
-
const expected = "**Possible values:**
|
|
77
|
+
const expected = "**Possible values:** `< 40`";
|
|
78
78
|
const actual = (0, schema_1.getQualifierMessage)({ exclusiveMaximum: 40 });
|
|
79
79
|
expect(actual).toBe(expected);
|
|
80
80
|
});
|
|
81
81
|
it("should render boolean exclusiveMinimum", () => {
|
|
82
|
-
const expected = "**Possible values:** 1
|
|
82
|
+
const expected = "**Possible values:** `> 1`";
|
|
83
83
|
const actual = (0, schema_1.getQualifierMessage)({ minimum: 1, exclusiveMinimum: true });
|
|
84
84
|
expect(actual).toBe(expected);
|
|
85
85
|
});
|
|
86
86
|
it("should render boolean exclusiveMaximum", () => {
|
|
87
|
-
const expected = "**Possible values:**
|
|
87
|
+
const expected = "**Possible values:** `< 40`";
|
|
88
88
|
const actual = (0, schema_1.getQualifierMessage)({ maximum: 40, exclusiveMaximum: true });
|
|
89
89
|
expect(actual).toBe(expected);
|
|
90
90
|
});
|
|
91
91
|
it("should render minimum when exclusiveMinimum is false", () => {
|
|
92
|
-
const expected = "**Possible values:** 1
|
|
92
|
+
const expected = "**Possible values:** `>= 1`";
|
|
93
93
|
const actual = (0, schema_1.getQualifierMessage)({ minimum: 1, exclusiveMinimum: false });
|
|
94
94
|
expect(actual).toBe(expected);
|
|
95
95
|
});
|
|
96
96
|
it("should render maximum when exclusiveMaximum is false", () => {
|
|
97
|
-
const expected = "**Possible values:**
|
|
97
|
+
const expected = "**Possible values:** `<= 40`";
|
|
98
98
|
const actual = (0, schema_1.getQualifierMessage)({
|
|
99
99
|
maximum: 40,
|
|
100
100
|
exclusiveMaximum: false,
|
|
@@ -102,12 +102,12 @@ describe("getQualifierMessage", () => {
|
|
|
102
102
|
expect(actual).toBe(expected);
|
|
103
103
|
});
|
|
104
104
|
it("should render minimum and maximum", () => {
|
|
105
|
-
const expected = "**Possible values:** 1
|
|
105
|
+
const expected = "**Possible values:** `>= 1` and `<= 40`";
|
|
106
106
|
const actual = (0, schema_1.getQualifierMessage)({ minimum: 1, maximum: 40 });
|
|
107
107
|
expect(actual).toBe(expected);
|
|
108
108
|
});
|
|
109
109
|
it("should render boolean exclusiveMinimum and maximum", () => {
|
|
110
|
-
const expected = "**Possible values:** 1
|
|
110
|
+
const expected = "**Possible values:** `> 1` and `<= 40`";
|
|
111
111
|
const actual = (0, schema_1.getQualifierMessage)({
|
|
112
112
|
minimum: 1,
|
|
113
113
|
maximum: 40,
|
|
@@ -116,7 +116,7 @@ describe("getQualifierMessage", () => {
|
|
|
116
116
|
expect(actual).toBe(expected);
|
|
117
117
|
});
|
|
118
118
|
it("should render minimum and boolean exclusiveMaximum", () => {
|
|
119
|
-
const expected = "**Possible values:** 1
|
|
119
|
+
const expected = "**Possible values:** `>= 1` and `< 40`";
|
|
120
120
|
const actual = (0, schema_1.getQualifierMessage)({
|
|
121
121
|
minimum: 1,
|
|
122
122
|
maximum: 40,
|
|
@@ -125,7 +125,7 @@ describe("getQualifierMessage", () => {
|
|
|
125
125
|
expect(actual).toBe(expected);
|
|
126
126
|
});
|
|
127
127
|
it("should render numeric exclusiveMinimum and maximum", () => {
|
|
128
|
-
const expected = "**Possible values:** 1
|
|
128
|
+
const expected = "**Possible values:** `> 1` and `<= 40`";
|
|
129
129
|
const actual = (0, schema_1.getQualifierMessage)({
|
|
130
130
|
exclusiveMinimum: 1,
|
|
131
131
|
maximum: 40,
|
|
@@ -133,7 +133,7 @@ describe("getQualifierMessage", () => {
|
|
|
133
133
|
expect(actual).toBe(expected);
|
|
134
134
|
});
|
|
135
135
|
it("should render minimum and numeric exclusiveMaximum", () => {
|
|
136
|
-
const expected = "**Possible values:** 1
|
|
136
|
+
const expected = "**Possible values:** `>= 1` and `< 40`";
|
|
137
137
|
const actual = (0, schema_1.getQualifierMessage)({
|
|
138
138
|
minimum: 1,
|
|
139
139
|
exclusiveMaximum: 40,
|
|
@@ -141,7 +141,7 @@ describe("getQualifierMessage", () => {
|
|
|
141
141
|
expect(actual).toBe(expected);
|
|
142
142
|
});
|
|
143
143
|
it("should render numeric exclusiveMinimum and boolean exclusiveMaximum", () => {
|
|
144
|
-
const expected = "**Possible values:** 1
|
|
144
|
+
const expected = "**Possible values:** `> 1` and `< 40`";
|
|
145
145
|
const actual = (0, schema_1.getQualifierMessage)({
|
|
146
146
|
exclusiveMinimum: 1,
|
|
147
147
|
maximum: 40,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-openapi-docs",
|
|
3
3
|
"description": "OpenAPI plugin for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-409",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=14"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "6cfbade709c0e80f79e91b3e4fa11dbf416490b5"
|
|
71
71
|
}
|
|
@@ -17,19 +17,19 @@ describe("getQualifierMessage", () => {
|
|
|
17
17
|
// minLength + maxLength
|
|
18
18
|
//
|
|
19
19
|
it("should render minLength", () => {
|
|
20
|
-
const expected = "**Possible values:**
|
|
20
|
+
const expected = "**Possible values:** `non-empty`";
|
|
21
21
|
const actual = getQualifierMessage({ minLength: 1 });
|
|
22
22
|
expect(actual).toBe(expected);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should render maxLength", () => {
|
|
26
|
-
const expected = "**Possible values:**
|
|
26
|
+
const expected = "**Possible values:** `<= 40 characters`";
|
|
27
27
|
const actual = getQualifierMessage({ maxLength: 40 });
|
|
28
28
|
expect(actual).toBe(expected);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
it("should render minLength and maxLength", () => {
|
|
32
|
-
const expected = "**Possible values:**
|
|
32
|
+
const expected = "**Possible values:** `non-empty` and `<= 40 characters`";
|
|
33
33
|
const actual = getQualifierMessage({ minLength: 1, maxLength: 40 });
|
|
34
34
|
expect(actual).toBe(expected);
|
|
35
35
|
});
|
|
@@ -46,7 +46,7 @@ describe("getQualifierMessage", () => {
|
|
|
46
46
|
|
|
47
47
|
it("should render multiple string qualifiers", () => {
|
|
48
48
|
const expected =
|
|
49
|
-
"**Possible values:**
|
|
49
|
+
"**Possible values:** `non-empty` and `<= 40 characters`, Value must match regular expression `^[a-zA-Z0-9_-]*$`";
|
|
50
50
|
const actual = getQualifierMessage({
|
|
51
51
|
minLength: 1,
|
|
52
52
|
maxLength: 40,
|
|
@@ -68,49 +68,49 @@ describe("getQualifierMessage", () => {
|
|
|
68
68
|
// minimum + maximum + exclusiveMinimum + exclusiveMaximum
|
|
69
69
|
//
|
|
70
70
|
it("should render minimum", () => {
|
|
71
|
-
const expected = "**Possible values:** 1
|
|
71
|
+
const expected = "**Possible values:** `>= 1`";
|
|
72
72
|
const actual = getQualifierMessage({ minimum: 1 });
|
|
73
73
|
expect(actual).toBe(expected);
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
it("should render maximum", () => {
|
|
77
|
-
const expected = "**Possible values:**
|
|
77
|
+
const expected = "**Possible values:** `<= 40`";
|
|
78
78
|
const actual = getQualifierMessage({ maximum: 40 });
|
|
79
79
|
expect(actual).toBe(expected);
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
it("should render numeric exclusiveMinimum", () => {
|
|
83
|
-
const expected = "**Possible values:** 1
|
|
83
|
+
const expected = "**Possible values:** `> 1`";
|
|
84
84
|
const actual = getQualifierMessage({ exclusiveMinimum: 1 });
|
|
85
85
|
expect(actual).toBe(expected);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
it("should render numeric exclusiveMaximum", () => {
|
|
89
|
-
const expected = "**Possible values:**
|
|
89
|
+
const expected = "**Possible values:** `< 40`";
|
|
90
90
|
const actual = getQualifierMessage({ exclusiveMaximum: 40 });
|
|
91
91
|
expect(actual).toBe(expected);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
it("should render boolean exclusiveMinimum", () => {
|
|
95
|
-
const expected = "**Possible values:** 1
|
|
95
|
+
const expected = "**Possible values:** `> 1`";
|
|
96
96
|
const actual = getQualifierMessage({ minimum: 1, exclusiveMinimum: true });
|
|
97
97
|
expect(actual).toBe(expected);
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
it("should render boolean exclusiveMaximum", () => {
|
|
101
|
-
const expected = "**Possible values:**
|
|
101
|
+
const expected = "**Possible values:** `< 40`";
|
|
102
102
|
const actual = getQualifierMessage({ maximum: 40, exclusiveMaximum: true });
|
|
103
103
|
expect(actual).toBe(expected);
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
it("should render minimum when exclusiveMinimum is false", () => {
|
|
107
|
-
const expected = "**Possible values:** 1
|
|
107
|
+
const expected = "**Possible values:** `>= 1`";
|
|
108
108
|
const actual = getQualifierMessage({ minimum: 1, exclusiveMinimum: false });
|
|
109
109
|
expect(actual).toBe(expected);
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
it("should render maximum when exclusiveMaximum is false", () => {
|
|
113
|
-
const expected = "**Possible values:**
|
|
113
|
+
const expected = "**Possible values:** `<= 40`";
|
|
114
114
|
const actual = getQualifierMessage({
|
|
115
115
|
maximum: 40,
|
|
116
116
|
exclusiveMaximum: false,
|
|
@@ -119,13 +119,13 @@ describe("getQualifierMessage", () => {
|
|
|
119
119
|
});
|
|
120
120
|
|
|
121
121
|
it("should render minimum and maximum", () => {
|
|
122
|
-
const expected = "**Possible values:** 1
|
|
122
|
+
const expected = "**Possible values:** `>= 1` and `<= 40`";
|
|
123
123
|
const actual = getQualifierMessage({ minimum: 1, maximum: 40 });
|
|
124
124
|
expect(actual).toBe(expected);
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
it("should render boolean exclusiveMinimum and maximum", () => {
|
|
128
|
-
const expected = "**Possible values:** 1
|
|
128
|
+
const expected = "**Possible values:** `> 1` and `<= 40`";
|
|
129
129
|
const actual = getQualifierMessage({
|
|
130
130
|
minimum: 1,
|
|
131
131
|
maximum: 40,
|
|
@@ -135,7 +135,7 @@ describe("getQualifierMessage", () => {
|
|
|
135
135
|
});
|
|
136
136
|
|
|
137
137
|
it("should render minimum and boolean exclusiveMaximum", () => {
|
|
138
|
-
const expected = "**Possible values:** 1
|
|
138
|
+
const expected = "**Possible values:** `>= 1` and `< 40`";
|
|
139
139
|
const actual = getQualifierMessage({
|
|
140
140
|
minimum: 1,
|
|
141
141
|
maximum: 40,
|
|
@@ -145,7 +145,7 @@ describe("getQualifierMessage", () => {
|
|
|
145
145
|
});
|
|
146
146
|
|
|
147
147
|
it("should render numeric exclusiveMinimum and maximum", () => {
|
|
148
|
-
const expected = "**Possible values:** 1
|
|
148
|
+
const expected = "**Possible values:** `> 1` and `<= 40`";
|
|
149
149
|
const actual = getQualifierMessage({
|
|
150
150
|
exclusiveMinimum: 1,
|
|
151
151
|
maximum: 40,
|
|
@@ -154,7 +154,7 @@ describe("getQualifierMessage", () => {
|
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
it("should render minimum and numeric exclusiveMaximum", () => {
|
|
157
|
-
const expected = "**Possible values:** 1
|
|
157
|
+
const expected = "**Possible values:** `>= 1` and `< 40`";
|
|
158
158
|
const actual = getQualifierMessage({
|
|
159
159
|
minimum: 1,
|
|
160
160
|
exclusiveMaximum: 40,
|
|
@@ -163,7 +163,7 @@ describe("getQualifierMessage", () => {
|
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
it("should render numeric exclusiveMinimum and boolean exclusiveMaximum", () => {
|
|
166
|
-
const expected = "**Possible values:** 1
|
|
166
|
+
const expected = "**Possible values:** `> 1` and `< 40`";
|
|
167
167
|
const actual = getQualifierMessage({
|
|
168
168
|
exclusiveMinimum: 1,
|
|
169
169
|
maximum: 40,
|
package/src/markdown/schema.ts
CHANGED
|
@@ -74,13 +74,28 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
|
|
|
74
74
|
|
|
75
75
|
if (schema.minLength || schema.maxLength) {
|
|
76
76
|
let lengthQualifier = "";
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
let minLength;
|
|
78
|
+
let maxLength;
|
|
79
|
+
if (schema.minLength && schema.minLength > 1) {
|
|
80
|
+
minLength = `\`>= ${schema.minLength} characters\``;
|
|
81
|
+
}
|
|
82
|
+
if (schema.minLength && schema.minLength === 1) {
|
|
83
|
+
minLength = `\`non-empty\``;
|
|
79
84
|
}
|
|
80
|
-
lengthQualifier += "length";
|
|
81
85
|
if (schema.maxLength) {
|
|
82
|
-
|
|
86
|
+
maxLength = `\`<= ${schema.maxLength} characters\``;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (minLength && !maxLength) {
|
|
90
|
+
lengthQualifier += minLength;
|
|
83
91
|
}
|
|
92
|
+
if (maxLength && !minLength) {
|
|
93
|
+
lengthQualifier += maxLength;
|
|
94
|
+
}
|
|
95
|
+
if (minLength && maxLength) {
|
|
96
|
+
lengthQualifier += `${minLength} and ${maxLength}`;
|
|
97
|
+
}
|
|
98
|
+
|
|
84
99
|
qualifierGroups.push(lengthQualifier);
|
|
85
100
|
}
|
|
86
101
|
|
|
@@ -91,21 +106,33 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
|
|
|
91
106
|
typeof schema.exclusiveMaximum === "number"
|
|
92
107
|
) {
|
|
93
108
|
let minmaxQualifier = "";
|
|
109
|
+
let minimum;
|
|
110
|
+
let maximum;
|
|
94
111
|
if (typeof schema.exclusiveMinimum === "number") {
|
|
95
|
-
|
|
112
|
+
minimum = `\`> ${schema.exclusiveMinimum}\``;
|
|
96
113
|
} else if (schema.minimum && !schema.exclusiveMinimum) {
|
|
97
|
-
|
|
114
|
+
minimum = `\`>= ${schema.minimum}\``;
|
|
98
115
|
} else if (schema.minimum && schema.exclusiveMinimum === true) {
|
|
99
|
-
|
|
116
|
+
minimum = `\`> ${schema.minimum}\``;
|
|
100
117
|
}
|
|
101
|
-
minmaxQualifier += "value";
|
|
102
118
|
if (typeof schema.exclusiveMaximum === "number") {
|
|
103
|
-
|
|
119
|
+
maximum = `\`< ${schema.exclusiveMaximum}\``;
|
|
104
120
|
} else if (schema.maximum && !schema.exclusiveMaximum) {
|
|
105
|
-
|
|
121
|
+
maximum = `\`<= ${schema.maximum}\``;
|
|
106
122
|
} else if (schema.maximum && schema.exclusiveMaximum === true) {
|
|
107
|
-
|
|
123
|
+
maximum = `\`< ${schema.maximum}\``;
|
|
108
124
|
}
|
|
125
|
+
|
|
126
|
+
if (minimum && !maximum) {
|
|
127
|
+
minmaxQualifier += minimum;
|
|
128
|
+
}
|
|
129
|
+
if (maximum && !minimum) {
|
|
130
|
+
minmaxQualifier += maximum;
|
|
131
|
+
}
|
|
132
|
+
if (minimum && maximum) {
|
|
133
|
+
minmaxQualifier += `${minimum} and ${maximum}`;
|
|
134
|
+
}
|
|
135
|
+
|
|
109
136
|
qualifierGroups.push(minmaxQualifier);
|
|
110
137
|
}
|
|
111
138
|
|
|
@@ -127,11 +154,11 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
|
|
|
127
154
|
}
|
|
128
155
|
|
|
129
156
|
if (schema.minItems) {
|
|
130
|
-
qualifierGroups.push(
|
|
157
|
+
qualifierGroups.push(`\`>= ${schema.minItems}\``);
|
|
131
158
|
}
|
|
132
159
|
|
|
133
160
|
if (schema.maxItems) {
|
|
134
|
-
qualifierGroups.push(
|
|
161
|
+
qualifierGroups.push(`\`<= ${schema.maxItems}\``);
|
|
135
162
|
}
|
|
136
163
|
|
|
137
164
|
if (qualifierGroups.length === 0) {
|