@mintlify/common 1.0.366 → 1.0.367
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.
|
@@ -5,12 +5,14 @@ import { OpenAPIV3 } from 'openapi-types';
|
|
|
5
5
|
* @returns method: API method (GET, POST, PUT, DELETE, PATCH)
|
|
6
6
|
* endpoint: API endpoint
|
|
7
7
|
* filename: filename of the openapi file (if applicable)
|
|
8
|
+
* label: deprecated or empty string
|
|
8
9
|
* returns undefined for any of the values (fails silently)
|
|
9
10
|
*/
|
|
10
11
|
export declare const potentiallyParseOpenApiString: (str: string) => {
|
|
11
12
|
method: OpenAPIV3.HttpMethods;
|
|
12
13
|
endpoint: string;
|
|
13
14
|
filename?: string;
|
|
15
|
+
label?: string;
|
|
14
16
|
} | undefined;
|
|
15
17
|
/**
|
|
16
18
|
*
|
|
@@ -18,9 +20,11 @@ export declare const potentiallyParseOpenApiString: (str: string) => {
|
|
|
18
20
|
* @returns method: API method (GET, POST, PUT, DELETE, PATCH)
|
|
19
21
|
* endpoint: API endpoint
|
|
20
22
|
* filename: filename of the openapi file (if applicable)
|
|
23
|
+
* label: deprecated or empty string
|
|
21
24
|
*/
|
|
22
25
|
export declare const parseOpenApiString: (str: string) => {
|
|
23
26
|
method: OpenAPIV3.HttpMethods;
|
|
24
27
|
endpoint: string;
|
|
25
28
|
filename?: string;
|
|
29
|
+
label?: string;
|
|
26
30
|
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @returns method: API method (GET, POST, PUT, DELETE, PATCH)
|
|
5
5
|
* endpoint: API endpoint
|
|
6
6
|
* filename: filename of the openapi file (if applicable)
|
|
7
|
+
* label: deprecated or empty string
|
|
7
8
|
* returns undefined for any of the values (fails silently)
|
|
8
9
|
*/
|
|
9
10
|
export const potentiallyParseOpenApiString = (str) => {
|
|
@@ -11,12 +12,22 @@ export const potentiallyParseOpenApiString = (str) => {
|
|
|
11
12
|
let filename;
|
|
12
13
|
let method;
|
|
13
14
|
let endpoint;
|
|
14
|
-
|
|
15
|
+
let label;
|
|
16
|
+
const labels = ['deprecated'];
|
|
17
|
+
if (components.length > 4) {
|
|
15
18
|
// improperly formatted openapi string
|
|
16
19
|
return undefined;
|
|
17
20
|
}
|
|
21
|
+
else if (components[0] && components[1] && components[2] && components[3]) {
|
|
22
|
+
[filename, method, endpoint, label] = components;
|
|
23
|
+
}
|
|
18
24
|
else if (components[0] && components[1] && components[2]) {
|
|
19
|
-
[
|
|
25
|
+
if (labels.includes(components[2])) {
|
|
26
|
+
[method, endpoint, label] = components;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
[filename, method, endpoint] = components;
|
|
30
|
+
}
|
|
20
31
|
}
|
|
21
32
|
else if (components[0] && components[1]) {
|
|
22
33
|
[method, endpoint] = components;
|
|
@@ -36,6 +47,7 @@ export const potentiallyParseOpenApiString = (str) => {
|
|
|
36
47
|
method: method,
|
|
37
48
|
endpoint,
|
|
38
49
|
filename,
|
|
50
|
+
label,
|
|
39
51
|
};
|
|
40
52
|
};
|
|
41
53
|
/**
|
|
@@ -44,17 +56,28 @@ export const potentiallyParseOpenApiString = (str) => {
|
|
|
44
56
|
* @returns method: API method (GET, POST, PUT, DELETE, PATCH)
|
|
45
57
|
* endpoint: API endpoint
|
|
46
58
|
* filename: filename of the openapi file (if applicable)
|
|
59
|
+
* label: deprecated or empty string
|
|
47
60
|
*/
|
|
48
61
|
export const parseOpenApiString = (str) => {
|
|
49
62
|
const components = str.trim().split(/\s+/);
|
|
50
63
|
let filename;
|
|
51
64
|
let method;
|
|
52
65
|
let endpoint;
|
|
53
|
-
|
|
66
|
+
let label;
|
|
67
|
+
const labels = ['deprecated'];
|
|
68
|
+
if (components.length > 4) {
|
|
54
69
|
throw new Error('improperly formatted openapi string');
|
|
55
70
|
}
|
|
71
|
+
else if (components[0] && components[1] && components[2] && components[3]) {
|
|
72
|
+
[filename, method, endpoint, label] = components;
|
|
73
|
+
}
|
|
56
74
|
else if (components[0] && components[1] && components[2]) {
|
|
57
|
-
[
|
|
75
|
+
if (labels.includes(components[2])) {
|
|
76
|
+
[method, endpoint, label] = components;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
[filename, method, endpoint] = components;
|
|
80
|
+
}
|
|
58
81
|
}
|
|
59
82
|
else if (components[0] && components[1]) {
|
|
60
83
|
[method, endpoint] = components;
|
|
@@ -70,5 +93,6 @@ export const parseOpenApiString = (str) => {
|
|
|
70
93
|
method: method,
|
|
71
94
|
endpoint,
|
|
72
95
|
filename,
|
|
96
|
+
label,
|
|
73
97
|
};
|
|
74
98
|
};
|