Skip to content
Merged

add stf #2906

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fancy-sides-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': patch
---

Use internal implementation for form in OpenAPI playground
15 changes: 14 additions & 1 deletion examples/openapi/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { source } from '@/lib/source';
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/docs/page';
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/notebook/page';
import { notFound } from 'next/navigation';
import { getMDXComponents } from '@/mdx-components';
import type { Metadata } from 'next';
import { APIPage } from '@/components/api-page';

export default async function Page(props: { params: Promise<{ slug?: string[] }> }) {
const params = await props.params;
Expand All @@ -12,6 +13,18 @@ export default async function Page(props: { params: Promise<{ slug?: string[] }>
notFound();
}

if (page.data.type === 'openapi') {
return (
<DocsPage toc={page.data.toc} full>
<DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription>{page.data.description}</DocsDescription>
<DocsBody>
<APIPage {...page.data.getAPIPageProps()} />
</DocsBody>
</DocsPage>
);
}

const MDX = page.data.body;

return (
Expand Down
2 changes: 1 addition & 1 deletion examples/openapi/app/global.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import 'tailwindcss';
@import 'fumadocs-ui/css/neutral.css';
@import 'fumadocs-ui/css/solar.css';
@import 'fumadocs-ui/css/preset.css';
@import 'fumadocs-openapi/css/preset.css';

Expand Down
35 changes: 0 additions & 35 deletions examples/openapi/app/logo.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions examples/openapi/lib/layout.shared.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
import { Logo } from '@/app/logo';

export function baseOptions(): BaseLayoutProps {
return {
nav: {
title: <Logo />,
title: 'OpenAPI Playground',
},
};
}
22 changes: 15 additions & 7 deletions examples/openapi/lib/source.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { loader } from 'fumadocs-core/source';
import { openapiPlugin } from 'fumadocs-openapi/server';
import { loader, multiple } from 'fumadocs-core/source';
import { openapiPlugin, openapiSource } from 'fumadocs-openapi/server';
import { docs } from 'fumadocs-mdx:collections/server';
import { openapi } from './openapi';

export const source = loader({
baseUrl: '/docs',
source: docs.toFumadocsSource(),
plugins: [openapiPlugin()],
});
export const source = loader(
multiple({
docs: docs.toFumadocsSource(),
openapi: await openapiSource(openapi, {
groupBy: 'tag',
}),
}),
{
baseUrl: '/docs',
plugins: [openapiPlugin()],
},
);
1 change: 1 addition & 0 deletions packages/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
},
"dependencies": {
"@fumari/json-schema-to-typescript": "^2.0.0",
"@fumari/stf": "workspace:^",
"@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-select": "^2.2.6",
Expand Down
Loading
Loading