mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 04:15:04 +03:00
* chore(docs,refs): prebuild self-hosted ref data Pregenerate self-hosted ref data files, in the style of the client lib, Management API, and CLI references. Preparatory step for migrating the self-hosted references to App Router. * refactor(docs): convert self-hosting to app router Convert self-hosting reference pages to App Router. * fix(docs,sitemap)
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { CodeBlock } from '@ui/components/CodeBlock'
|
|
import { sample } from '@har-sdk/openapi-sampler'
|
|
import { Tabs, TabPanel } from '~/features/ui/Tabs'
|
|
|
|
type IParamProps = any
|
|
|
|
const ApiSchema = ({ schema, id }: IParamProps) => {
|
|
let example: string
|
|
try {
|
|
example = sample(schema, { skipReadOnly: true, quiet: true })
|
|
} catch {
|
|
// ignore
|
|
}
|
|
return (
|
|
<Tabs
|
|
scrollable
|
|
size="small"
|
|
type="underlined"
|
|
defaultActiveId={example ? 'example' : 'schema'}
|
|
>
|
|
{example && (
|
|
<TabPanel key={`${id ?? ''}-example`} id="example" label="example">
|
|
<div className="mt-8">
|
|
<CodeBlock language="bash" className="relative">
|
|
{JSON.stringify(example, null, 2)}
|
|
</CodeBlock>
|
|
</div>
|
|
</TabPanel>
|
|
)}
|
|
<TabPanel key={`${id ?? ''}-schema`} id="schema" label="schema">
|
|
<div className="mt-8">
|
|
<CodeBlock language="bash" className="relative">
|
|
{JSON.stringify(schema, null, 2)}
|
|
</CodeBlock>
|
|
</div>
|
|
</TabPanel>
|
|
</Tabs>
|
|
)
|
|
}
|
|
|
|
export default ApiSchema
|