@mintlify/common 1.0.371 → 1.0.373
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/dist/openapi/buildOpenApiMetaTag.d.ts +5 -0
- package/dist/openapi/buildOpenApiMetaTag.js +4 -0
- package/dist/openapi/index.d.ts +1 -0
- package/dist/openapi/index.js +1 -0
- package/dist/openapi/parseOpenApiString.d.ts +0 -4
- package/dist/openapi/parseOpenApiString.js +4 -28
- package/dist/openapi/prepOpenApiFrontmatter.js +11 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/openapi/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { getOpenApiTitleAndDescription } from './getOpenApiTitleAndDescription.j
|
|
|
6
6
|
export { validate, safeValidate } from './validate.js';
|
|
7
7
|
export { getOpenApiDocumentFromUrl } from './getOpenApiDocumentFromUrl.js';
|
|
8
8
|
export { prepOpenApiFrontmatter } from './prepOpenApiFrontmatter.js';
|
|
9
|
+
export { buildOpenApiMetaTag } from './buildOpenApiMetaTag.js';
|
package/dist/openapi/index.js
CHANGED
|
@@ -6,3 +6,4 @@ export { getOpenApiTitleAndDescription } from './getOpenApiTitleAndDescription.j
|
|
|
6
6
|
export { validate, safeValidate } from './validate.js';
|
|
7
7
|
export { getOpenApiDocumentFromUrl } from './getOpenApiDocumentFromUrl.js';
|
|
8
8
|
export { prepOpenApiFrontmatter } from './prepOpenApiFrontmatter.js';
|
|
9
|
+
export { buildOpenApiMetaTag } from './buildOpenApiMetaTag.js';
|
|
@@ -5,14 +5,12 @@ 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
|
|
9
8
|
* returns undefined for any of the values (fails silently)
|
|
10
9
|
*/
|
|
11
10
|
export declare const potentiallyParseOpenApiString: (str: string) => {
|
|
12
11
|
method: OpenAPIV3.HttpMethods;
|
|
13
12
|
endpoint: string;
|
|
14
13
|
filename?: string;
|
|
15
|
-
label?: string;
|
|
16
14
|
} | undefined;
|
|
17
15
|
/**
|
|
18
16
|
*
|
|
@@ -20,11 +18,9 @@ export declare const potentiallyParseOpenApiString: (str: string) => {
|
|
|
20
18
|
* @returns method: API method (GET, POST, PUT, DELETE, PATCH)
|
|
21
19
|
* endpoint: API endpoint
|
|
22
20
|
* filename: filename of the openapi file (if applicable)
|
|
23
|
-
* label: deprecated or empty string
|
|
24
21
|
*/
|
|
25
22
|
export declare const parseOpenApiString: (str: string) => {
|
|
26
23
|
method: OpenAPIV3.HttpMethods;
|
|
27
24
|
endpoint: string;
|
|
28
25
|
filename?: string;
|
|
29
|
-
label?: string;
|
|
30
26
|
};
|
|
@@ -4,7 +4,6 @@
|
|
|
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
|
|
8
7
|
* returns undefined for any of the values (fails silently)
|
|
9
8
|
*/
|
|
10
9
|
export const potentiallyParseOpenApiString = (str) => {
|
|
@@ -12,22 +11,12 @@ export const potentiallyParseOpenApiString = (str) => {
|
|
|
12
11
|
let filename;
|
|
13
12
|
let method;
|
|
14
13
|
let endpoint;
|
|
15
|
-
|
|
16
|
-
const labels = ['deprecated'];
|
|
17
|
-
if (components.length > 4) {
|
|
14
|
+
if (components.length > 3) {
|
|
18
15
|
// improperly formatted openapi string
|
|
19
16
|
return undefined;
|
|
20
17
|
}
|
|
21
|
-
else if (components[0] && components[1] && components[2] && components[3]) {
|
|
22
|
-
[filename, method, endpoint, label] = components;
|
|
23
|
-
}
|
|
24
18
|
else if (components[0] && components[1] && components[2]) {
|
|
25
|
-
|
|
26
|
-
[method, endpoint, label] = components;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
[filename, method, endpoint] = components;
|
|
30
|
-
}
|
|
19
|
+
[filename, method, endpoint] = components;
|
|
31
20
|
}
|
|
32
21
|
else if (components[0] && components[1]) {
|
|
33
22
|
[method, endpoint] = components;
|
|
@@ -47,7 +36,6 @@ export const potentiallyParseOpenApiString = (str) => {
|
|
|
47
36
|
method: method,
|
|
48
37
|
endpoint,
|
|
49
38
|
filename,
|
|
50
|
-
label,
|
|
51
39
|
};
|
|
52
40
|
};
|
|
53
41
|
/**
|
|
@@ -56,28 +44,17 @@ export const potentiallyParseOpenApiString = (str) => {
|
|
|
56
44
|
* @returns method: API method (GET, POST, PUT, DELETE, PATCH)
|
|
57
45
|
* endpoint: API endpoint
|
|
58
46
|
* filename: filename of the openapi file (if applicable)
|
|
59
|
-
* label: deprecated or empty string
|
|
60
47
|
*/
|
|
61
48
|
export const parseOpenApiString = (str) => {
|
|
62
49
|
const components = str.trim().split(/\s+/);
|
|
63
50
|
let filename;
|
|
64
51
|
let method;
|
|
65
52
|
let endpoint;
|
|
66
|
-
|
|
67
|
-
const labels = ['deprecated'];
|
|
68
|
-
if (components.length > 4) {
|
|
53
|
+
if (components.length > 3) {
|
|
69
54
|
throw new Error('improperly formatted openapi string');
|
|
70
55
|
}
|
|
71
|
-
else if (components[0] && components[1] && components[2] && components[3]) {
|
|
72
|
-
[filename, method, endpoint, label] = components;
|
|
73
|
-
}
|
|
74
56
|
else if (components[0] && components[1] && components[2]) {
|
|
75
|
-
|
|
76
|
-
[method, endpoint, label] = components;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
[filename, method, endpoint] = components;
|
|
80
|
-
}
|
|
57
|
+
[filename, method, endpoint] = components;
|
|
81
58
|
}
|
|
82
59
|
else if (components[0] && components[1]) {
|
|
83
60
|
[method, endpoint] = components;
|
|
@@ -93,6 +70,5 @@ export const parseOpenApiString = (str) => {
|
|
|
93
70
|
method: method,
|
|
94
71
|
endpoint,
|
|
95
72
|
filename,
|
|
96
|
-
label,
|
|
97
73
|
};
|
|
98
74
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { parse, isAbsolute } from 'path';
|
|
2
2
|
import { normalizeRelativePath } from '../fs/normalizeRelativePath.js';
|
|
3
3
|
import { schemaFileFrontmatterIsOriginalFileLocation } from '../schema/common.js';
|
|
4
|
+
import { buildOpenApiMetaTag } from './buildOpenApiMetaTag.js';
|
|
4
5
|
import { potentiallyParseOpenApiString } from './parseOpenApiString.js';
|
|
5
6
|
export function prepOpenApiFrontmatter(currPath, openapiFrontmatter) {
|
|
6
7
|
if (!openapiFrontmatter)
|
|
@@ -8,12 +9,20 @@ export function prepOpenApiFrontmatter(currPath, openapiFrontmatter) {
|
|
|
8
9
|
const openapiObj = potentiallyParseOpenApiString(openapiFrontmatter);
|
|
9
10
|
if ((openapiObj === null || openapiObj === void 0 ? void 0 : openapiObj.filename) && schemaFileFrontmatterIsOriginalFileLocation(openapiObj.filename)) {
|
|
10
11
|
if (openapiObj.filename.startsWith('https://')) {
|
|
11
|
-
return
|
|
12
|
+
return buildOpenApiMetaTag({
|
|
13
|
+
filePath: openapiObj.filename,
|
|
14
|
+
method: openapiObj.method.toLowerCase(),
|
|
15
|
+
path: openapiObj.endpoint,
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
const filenameIsAbsolute = isAbsolute(openapiObj.filename);
|
|
14
19
|
const currDir = filenameIsAbsolute ? '/' : parse(currPath).dir;
|
|
15
20
|
const newOpenApiFilename = normalizeRelativePath(currDir, openapiObj.filename);
|
|
16
|
-
return
|
|
21
|
+
return buildOpenApiMetaTag({
|
|
22
|
+
filePath: newOpenApiFilename,
|
|
23
|
+
method: openapiObj.method.toLowerCase(),
|
|
24
|
+
path: openapiObj.endpoint,
|
|
25
|
+
});
|
|
17
26
|
}
|
|
18
27
|
return openapiFrontmatter;
|
|
19
28
|
}
|