@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 webhookObject = schema.webhooks?.[endpoint];
158
- if (!webhookObject || typeof webhookObject !== 'object') {
159
- throw new Error(`Webhook ${endpoint} not found in ${openapiPath}`);
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(endpoint, webhookObject, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
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 pathItemObject = (schema.paths ?? {})[endpoint];
172
- if (!pathItemObject || typeof pathItemObject !== 'object') {
173
- throw new Error(`Endpoint ${endpoint} not found in ${openapiPath}`);
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 = pathItemObject[method.toLowerCase()];
177
+ const opObject = match.pathItem[method.toLowerCase()];
176
178
  if (!opObject) {
177
- throw new Error(`Method ${method.toUpperCase()} for endpoint ${endpoint} not found in ${openapiPath}`);
179
+ throw new Error(`Method ${method.toUpperCase()} for endpoint ${match.pathKey} not found in ${openapiPath}`);
178
180
  }
179
- processOpenApiPath(endpoint, { [method.toLowerCase()]: opObject }, schema, tempNav, tempDecoratedNav, writePromises, pagesAcc, {
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,