mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 05:48:57 +00:00
Make OpenAPI Response structure clearer (#4021)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@gitbook/react-openapi": patch
|
||||
---
|
||||
|
||||
Make OpenAPI Response structure clearer
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
|
||||
import { OpenAPIDisclosure } from './OpenAPIDisclosure';
|
||||
import { OpenAPISchemaPresentation } from './OpenAPISchema';
|
||||
import { OpenAPISchemaProperties } from './OpenAPISchemaServer';
|
||||
import { OpenAPIRootSchema, OpenAPISchemaProperties } from './OpenAPISchemaServer';
|
||||
import type { OpenAPIClientContext } from './context';
|
||||
import { tString } from './translate';
|
||||
import { parameterToProperty, resolveDescription } from './utils';
|
||||
@@ -64,17 +64,21 @@ export function OpenAPIResponse(props: {
|
||||
) : null}
|
||||
{mediaType?.schema && (
|
||||
<div className="openapi-responsebody">
|
||||
<OpenAPISchemaProperties
|
||||
id={`response-${context.blockKey}`}
|
||||
properties={[
|
||||
{
|
||||
schema: mediaType.schema,
|
||||
propertyName: tString(context.translation, 'response'),
|
||||
required: null,
|
||||
},
|
||||
]}
|
||||
context={context}
|
||||
/>
|
||||
{headers.length > 0 ? (
|
||||
<OpenAPISchemaProperties
|
||||
id={`response-${context.blockKey}`}
|
||||
properties={[
|
||||
{
|
||||
schema: mediaType.schema,
|
||||
propertyName: tString(context.translation, 'response'),
|
||||
required: null,
|
||||
},
|
||||
]}
|
||||
context={context}
|
||||
/>
|
||||
) : (
|
||||
<OpenAPIRootSchema schema={mediaType.schema} context={context} />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user