mirror of
https://github.com/supabase/supabase.git
synced 2026-10-19 08:09:11 +03:00
* feat: render body parameters * feat: api parameters render * fix: update mgmt api spec to latest * fix: body param format and support content type selection * fix: prettier errors * fix: use Options to render accepted enum values * fix: prettier again * fix: merge conflict * fix: expose new api routes * fix: prettier again * refactor: ApiBodyParam * fix: add missing apis * chore: tidy up * feat: improve api response with sample + schema tabs * fix: support show/hide object param schema * fix: show no content text * refactor: use collapsible for hidden content * Update apps/docs/components/reference/ApiOperationSection.tsx Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * Update apps/docs/components/ApiSchemaOption.tsx Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * fix: resolve comments --------- Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
36 lines
1018 B
TypeScript
36 lines
1018 B
TypeScript
import { CodeBlock } from '@ui/components/CodeBlock'
|
|
import { sample } from '@har-sdk/openapi-sampler'
|
|
import { Tabs, TabPanel } from '~/components/Tabs'
|
|
|
|
type IParamProps = any
|
|
|
|
const ApiSchema = ({ schema, id }: IParamProps) => {
|
|
const example = sample(schema, { skipReadOnly: true, quiet: true })
|
|
return (
|
|
<Tabs
|
|
scrollable
|
|
size="small"
|
|
type="underlined"
|
|
defaultActiveId="example"
|
|
queryGroup="response-status"
|
|
>
|
|
<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
|