@mintlify/common 1.0.541 → 1.0.542

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.
@@ -1,7 +1,7 @@
1
1
  export { getOpenApiOperationMethodAndEndpoint } from './getOpenApiOperationMethodAndEndpoint.js';
2
2
  export { truncateCircularReferences } from './truncateCircularReferences.js';
3
3
  export { openApiCheck } from './openApiCheck.js';
4
- export { parseOpenApiString, potentiallyParseOpenApiString } from './parseOpenApiString.js';
4
+ export { parseOpenApiString, potentiallyParseOpenApiString, parseOpenApiSchemaString, } from './parseOpenApiString.js';
5
5
  export { getOpenApiTitleAndDescription } from './getOpenApiTitleAndDescription.js';
6
6
  export { validate, safeValidate } from './validate.js';
7
7
  export { getOpenApiDocumentFromUrl } from './getOpenApiDocumentFromUrl.js';
@@ -1,7 +1,7 @@
1
1
  export { getOpenApiOperationMethodAndEndpoint } from './getOpenApiOperationMethodAndEndpoint.js';
2
2
  export { truncateCircularReferences } from './truncateCircularReferences.js';
3
3
  export { openApiCheck } from './openApiCheck.js';
4
- export { parseOpenApiString, potentiallyParseOpenApiString } from './parseOpenApiString.js';
4
+ export { parseOpenApiString, potentiallyParseOpenApiString, parseOpenApiSchemaString, } from './parseOpenApiString.js';
5
5
  export { getOpenApiTitleAndDescription } from './getOpenApiTitleAndDescription.js';
6
6
  export { validate, safeValidate } from './validate.js';
7
7
  export { getOpenApiDocumentFromUrl } from './getOpenApiDocumentFromUrl.js';
@@ -24,3 +24,10 @@ export declare const parseOpenApiString: (str: string) => {
24
24
  endpoint: string;
25
25
  filename?: string;
26
26
  };
27
+ /**
28
+ * same as above, but for openapi-schema frontmatter
29
+ */
30
+ export declare const parseOpenApiSchemaString: (str: string) => {
31
+ name: string;
32
+ filename?: string;
33
+ };
@@ -74,3 +74,27 @@ export const parseOpenApiString = (str) => {
74
74
  filename,
75
75
  };
76
76
  };
77
+ /**
78
+ * same as above, but for openapi-schema frontmatter
79
+ */
80
+ export const parseOpenApiSchemaString = (str) => {
81
+ const components = str.trim().split(/\s+/);
82
+ let filename;
83
+ let name;
84
+ if (components.length > 2) {
85
+ throw new Error('improperly formatted openapi schema string');
86
+ }
87
+ else if (components[0] && components[1]) {
88
+ [filename, name] = components;
89
+ }
90
+ else if (components[0]) {
91
+ [name] = components;
92
+ }
93
+ else {
94
+ throw new Error('improperly formatted openapi schema string');
95
+ }
96
+ return {
97
+ name,
98
+ filename,
99
+ };
100
+ };