@mintlify/prebuild 1.0.322 → 1.0.324

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,6 +1,6 @@
1
1
  import { getOpenApiDocumentFromUrl, optionallyAddLeadingSlash } from '@mintlify/common';
2
2
  import { generateOpenApiPagesForDocsConfig } from '@mintlify/scraping';
3
- import { divisions } from '@mintlify/validation';
3
+ import { divisions, } from '@mintlify/validation';
4
4
  import * as path from 'path';
5
5
  import { getOpenApiFilesFromConfig } from '../read/getOpenApiFilesFromConfig.js';
6
6
  const DEFAULT_OUTPUT_DIR = 'api-reference';
@@ -22,8 +22,7 @@ export const generateOpenApiDivisions = async (docsConfig, openApiFiles, targetD
22
22
  export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pagesAcc, opts) => {
23
23
  const { overwrite, writeFiles, targetDir } = opts;
24
24
  const newOpenApiFiles = [];
25
- async function processOpenApiInNav(nav // we will need one of the divisions to be able to get the openapi param (type safety)
26
- ) {
25
+ async function processOpenApiInNav(nav) {
27
26
  let outputDir = DEFAULT_OUTPUT_DIR;
28
27
  let openapi;
29
28
  if ('openapi' in nav) {
@@ -32,7 +31,7 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
32
31
  }
33
32
  else if (typeof nav.openapi === 'object' && 'source' in nav.openapi) {
34
33
  openapi = nav.openapi.source;
35
- outputDir = nav.openapi.directory;
34
+ outputDir = nav.openapi.directory ?? DEFAULT_OUTPUT_DIR;
36
35
  }
37
36
  }
38
37
  if (openapi) {
@@ -63,8 +62,18 @@ export const generateOpenApiFromDocsConfig = async (navigation, openApiFiles, pa
63
62
  if (divisionNav?.division) {
64
63
  return {
65
64
  [divisionNav.division]: divisionNav.name,
66
- groups: navFromGeneratedOpenApiPages,
67
65
  ...divisionNav.nav,
66
+ ...(divisionNav.division === 'group'
67
+ ? {
68
+ pages: 'pages' in nav
69
+ ? [...nav.pages, ...navFromGeneratedOpenApiPages]
70
+ : navFromGeneratedOpenApiPages,
71
+ }
72
+ : {
73
+ groups: 'groups' in nav
74
+ ? [...nav.groups, ...navFromGeneratedOpenApiPages]
75
+ : navFromGeneratedOpenApiPages,
76
+ }),
68
77
  };
69
78
  }
70
79
  }