Fix crash when displaying invalid Swagger 2.0 block (#214)

* Ignore errors when converting Swagger 2 to OpenAPI 3

* Apply page-api-block only when a block is actually displayed

* Format

* Try to be more lax
This commit is contained in:
Samy Pessé
2024-03-06 09:43:11 +00:00
committed by GitHub
parent d22944419f
commit 203e9103de
6 changed files with 30 additions and 19 deletions
@@ -50,13 +50,18 @@ async function OpenAPIBody(props: BlockProps<DocumentBlockSwagger>) {
CodeBlock: PlainCodeBlock,
defaultInteractiveOpened: context.mode === 'print',
}}
className="openapi-block"
/>
);
}
function OpenAPIFallback() {
return (
<div role="status" aria-busy className={tcls('flex', 'flex-1', 'flex-col', 'gap-3')}>
<div
role="status"
aria-busy
className={'openapi-block ' + tcls('flex', 'flex-1', 'flex-col', 'gap-3')}
>
<LoadingPane
tile={12}
style={['rounded-md', 'h-[47px]', '[max-width:calc(48rem-1px)]']}