@mintlify/prebuild 1.0.999 → 1.0.1001
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,4 +1,4 @@
|
|
|
1
|
-
import { getOpenApiDocumentFromUrl, optionallyAddLeadingSlash, isAllowedLocalSchemaUrl, potentiallyParseOpenApiString, findNavGroup, } from '@mintlify/common';
|
|
1
|
+
import { getOpenApiDocumentFromUrl, optionallyAddLeadingSlash, isAllowedLocalSchemaUrl, potentiallyParseOpenApiString, findNavGroup, findOpenApiPath, } from '@mintlify/common';
|
|
2
2
|
import { generateOpenApiPagesForDocsConfig } from '@mintlify/scraping';
|
|
3
3
|
import { processOpenApiPath, processOpenApiWebhook, } from '@mintlify/scraping/bin/openapi/common.js';
|
|
4
4
|
import { divisions, } from '@mintlify/validation';
|
|
@@ -154,11 +154,12 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
|
|
|
154
154
|
const tempDecoratedNav = [];
|
|
155
155
|
const writePromises = [];
|
|
156
156
|
if (isWebhook) {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
const webhooks = schema.webhooks;
|
|
158
|
+
const webhookMatch = findOpenApiPath(webhooks, endpoint);
|
|
159
|
+
if (!webhookMatch) {
|
|
160
|
+
throw new Error(`Webhook ${endpoint} not found in ${openapiPath}. ${webhooks ? `Available webhooks: ${Object.keys(webhooks).join(', ')}` : ''}`.trim());
|
|
160
161
|
}
|
|
161
|
-
processOpenApiWebhook(
|
|
162
|
+
processOpenApiWebhook(webhookMatch.pathKey, webhookMatch.pathItem, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
|
|
162
163
|
openApiFilePath: openApiFile.originalFileLocation,
|
|
163
164
|
writeFiles,
|
|
164
165
|
outDir: currentDirectory ?? DEFAULT_OUTPUT_DIR,
|
|
@@ -168,15 +169,16 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
|
|
|
168
169
|
}, findNavGroup);
|
|
169
170
|
}
|
|
170
171
|
else {
|
|
171
|
-
const
|
|
172
|
-
if (!
|
|
173
|
-
|
|
172
|
+
const match = findOpenApiPath(schema.paths, endpoint);
|
|
173
|
+
if (!match) {
|
|
174
|
+
const available = Object.keys(schema.paths ?? {}).join(', ');
|
|
175
|
+
throw new Error(`Endpoint ${endpoint} not found in ${openapiPath}.${available ? ` Available paths: ${available}` : ''}`);
|
|
174
176
|
}
|
|
175
|
-
const opObject =
|
|
177
|
+
const opObject = match.pathItem[method.toLowerCase()];
|
|
176
178
|
if (!opObject) {
|
|
177
|
-
throw new Error(`Method ${method.toUpperCase()} for endpoint ${
|
|
179
|
+
throw new Error(`Method ${method.toUpperCase()} for endpoint ${match.pathKey} not found in ${openapiPath}`);
|
|
178
180
|
}
|
|
179
|
-
processOpenApiPath(
|
|
181
|
+
processOpenApiPath(match.pathKey, { [method.toLowerCase()]: opObject }, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
|
|
180
182
|
openApiFilePath: openApiFile.originalFileLocation,
|
|
181
183
|
writeFiles,
|
|
182
184
|
outDir: currentDirectory ?? DEFAULT_OUTPUT_DIR,
|