import { ChevronDown, ChevronRight } from '@geist-ui/icons'; import { DocumentBlockSwagger } from '@gitbook/api'; import { OpenAPIOperation } from '@gitbook/react-openapi'; import React from 'react'; import { LoadingPane } from '@/components/primitives'; import { fetchOpenAPIBlock } from '@/lib/openapi'; import { tcls } from '@/lib/tailwind'; import { BlockProps } from '../Block'; import { PlainCodeBlock } from '../CodeBlock'; import './style.css'; /** * Render an OpenAPI block. */ export async function OpenAPI(props: BlockProps) { const { block, style } = props; return (
{/* Invisible span with the ID to correctly identify the active section in the aside navigation. We don't use the full
because it can be longer than the viewport and will not work well with IntersectionObserver. */} }>
); } async function OpenAPIBody(props: BlockProps) { const { block, context } = props; const data = await fetchOpenAPIBlock(block, context.resolveContentRef); if (!data) { return null; } return ( , chevronRight: , }, CodeBlock: PlainCodeBlock, defaultInteractiveOpened: context.mode === 'print', }} className="openapi-block" /> ); } function OpenAPIFallback() { return (
); }