UNPKG

docusaurus-theme-redoc

Version:
123 lines (108 loc) 2.75 kB
type ParsedSpec = import('redoc/typings/types').OpenAPISpec; /** * The "SpecProps" are generated by docusaurus-plugin-redoc at build time * And they are passed automatically for the auto-generated pages */ interface SpecProps { /** * Spec to use, already loaded previously */ spec: ParsedSpec; /** * Public path to the spec file used, used by Redoc as download url */ url?: string; /** * @deprecated TODO: If not spec file then pass null at build time rather than passing flags to components */ isSpecFile?: boolean; /** * Theme instance to use */ themeId?: string; /** * Option to disable normalization of spec download URLs * @deprecated TODO: Do the normalization at build time rather than in components */ normalizeUrl?: boolean; } interface RedocProps extends SpecProps { className?: string; /** * Props to forward to the Redoc component */ optionsOverrides?: import('redoc').RedocRawOptions; } interface MdxProps { /** * If you have multiple apis, then add a `id` field in the specs array * And pass the same here */ id?: string; /** * Manually parsed JSON spec to use */ spec?: ParsedSpec; } type ApiSchemaProps = Omit< import('redoc').ObjectDescriptionProps, 'parser' | 'options' | 'schemaRef' > & MdxProps & { /** * Show the example or not */ example?: boolean; /** * Ref to the schema */ pointer: string; }; type ApiOperationProps = MdxProps & { /** * Show the example or not */ example?: boolean; /** * Ref to the operation */ pointer: string; }; declare module '@theme/Redoc' { const Redoc: (props: RedocProps) => JSX.Element; export default Redoc; } declare module '@theme/ApiDoc' { import { Props as LayoutProps } from '@theme/Layout'; interface ApiDocProps { /** * Get this by using `@theme/useSpecData` hook */ specProps: SpecProps; /** * Title/Description for layout is by default loaded from the API spec */ layoutProps?: Omit<LayoutProps, 'children'>; } const ApiDoc: (props: ApiDocProps) => JSX.Element; export default ApiDoc; } declare module '@theme/ApiDocMdx' { const ApiDocMdx: (props: MdxProps) => JSX.Element; export default ApiDocMdx; } declare module '@theme/ApiSchema' { const ApiSchema: (props: ApiSchemaProps) => JSX.Element; export default ApiSchema; } declare module '@theme/ApiOperation' { const ApiOperation: (props: ApiOperationProps) => JSX.Element; export default ApiOperation; } declare module '@theme/useSpecData' { /** * Load redocusaurus plugin data by ID */ const useSpecData: (id?: string, spec?: SpecProps['spec']) => SpecProps; export default useSpecData; }