From c41cf922c54d2646716e279d273f7ac226a733c0 Mon Sep 17 00:00:00 2001 From: Rohin Bhargava Date: Fri, 20 Dec 2024 19:17:43 +0000 Subject: [PATCH] fix bundle build --- .../bundle/src/server/getMarkdownForPath.ts | 22 +++++++++---------- .../components/MaybeEnvironmentDropdown.tsx | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/fern-docs/bundle/src/server/getMarkdownForPath.ts b/packages/fern-docs/bundle/src/server/getMarkdownForPath.ts index 4b76268b98..906779d932 100644 --- a/packages/fern-docs/bundle/src/server/getMarkdownForPath.ts +++ b/packages/fern-docs/bundle/src/server/getMarkdownForPath.ts @@ -133,8 +133,8 @@ export function endpointDefinitionToMarkdown( [ "```http", `${endpoint.method} ${endpoint.environments?.find((env) => env.id === endpoint.defaultEnvironment)?.baseUrl ?? endpoint.environments?.[0]?.baseUrl ?? ""}${ApiDefinition.toCurlyBraceEndpointPathLiteral(endpoint.path)}`, - endpoint.request != null - ? `Content-Type: ${endpoint.request.contentType}` + endpoint.requests?.[0] != null + ? `Content-Type: ${endpoint.requests[0].contentType}` : undefined, "```", ] @@ -162,12 +162,12 @@ export function endpointDefinitionToMarkdown( `- ${pascalCaseHeaderKey(param.key)}${getShorthand(param.valueShape, types, param.description)}` ) .join("\n"), - endpoint.request != null ? "## Request Body" : undefined, - typeof endpoint.request?.description === "string" - ? endpoint.request?.description + endpoint.requests?.[0] != null ? "## Request Body" : undefined, + typeof endpoint.requests?.[0]?.description === "string" + ? endpoint.requests?.[0]?.description : undefined, - endpoint.request != null - ? `\`\`\`json\n${JSON.stringify(endpoint.request.body)}\n\`\`\`` + endpoint.requests?.[0] != null + ? `\`\`\`json\n${JSON.stringify(endpoint.requests[0].body)}\n\`\`\`` : undefined, endpoint.responseHeaders?.length ? "## Response Headers" : undefined, endpoint.responseHeaders @@ -176,13 +176,13 @@ export function endpointDefinitionToMarkdown( `- ${pascalCaseHeaderKey(header.key)}${getShorthand(header.valueShape, types, header.description)}` ) .join("\n"), - endpoint.response != null || endpoint.errors?.length + endpoint.responses?.[0] != null || endpoint.errors?.length ? "## Response Body" : undefined, - endpoint.response != null || endpoint.errors?.length + endpoint.responses?.[0] != null || endpoint.errors?.length ? [ - typeof endpoint.response?.description === "string" - ? `- ${endpoint.response.statusCode}: ${endpoint.response?.description}` + typeof endpoint.responses?.[0]?.description === "string" + ? `- ${endpoint.responses?.[0]?.statusCode}: ${endpoint.responses?.[0]?.description}` : undefined, ...(endpoint.errors ?.filter((error) => typeof error.description === "string") diff --git a/packages/fern-docs/ui/src/components/MaybeEnvironmentDropdown.tsx b/packages/fern-docs/ui/src/components/MaybeEnvironmentDropdown.tsx index ee2af62fe8..279003657e 100644 --- a/packages/fern-docs/ui/src/components/MaybeEnvironmentDropdown.tsx +++ b/packages/fern-docs/ui/src/components/MaybeEnvironmentDropdown.tsx @@ -64,7 +64,7 @@ export function MaybeEnvironmentDropdown({ // TODO: clean up this component useEffect(() => { if ( - // eslint-disable-next-line @typescript-eslint/prefer-optional-chain + url && url.host && url.host !== "" &&