mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +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 type { OpenAPIV3 } from '@gitbook/openapi-parser';
|
||||||
import { OpenAPIDisclosure } from './OpenAPIDisclosure';
|
import { OpenAPIDisclosure } from './OpenAPIDisclosure';
|
||||||
import { OpenAPISchemaPresentation } from './OpenAPISchema';
|
import { OpenAPISchemaPresentation } from './OpenAPISchema';
|
||||||
import { OpenAPISchemaProperties } from './OpenAPISchemaServer';
|
import { OpenAPIRootSchema, OpenAPISchemaProperties } from './OpenAPISchemaServer';
|
||||||
import type { OpenAPIClientContext } from './context';
|
import type { OpenAPIClientContext } from './context';
|
||||||
import { tString } from './translate';
|
import { tString } from './translate';
|
||||||
import { parameterToProperty, resolveDescription } from './utils';
|
import { parameterToProperty, resolveDescription } from './utils';
|
||||||
@@ -64,17 +64,21 @@ export function OpenAPIResponse(props: {
|
|||||||
) : null}
|
) : null}
|
||||||
{mediaType?.schema && (
|
{mediaType?.schema && (
|
||||||
<div className="openapi-responsebody">
|
<div className="openapi-responsebody">
|
||||||
<OpenAPISchemaProperties
|
{headers.length > 0 ? (
|
||||||
id={`response-${context.blockKey}`}
|
<OpenAPISchemaProperties
|
||||||
properties={[
|
id={`response-${context.blockKey}`}
|
||||||
{
|
properties={[
|
||||||
schema: mediaType.schema,
|
{
|
||||||
propertyName: tString(context.translation, 'response'),
|
schema: mediaType.schema,
|
||||||
required: null,
|
propertyName: tString(context.translation, 'response'),
|
||||||
},
|
required: null,
|
||||||
]}
|
},
|
||||||
context={context}
|
]}
|
||||||
/>
|
context={context}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<OpenAPIRootSchema schema={mediaType.schema} context={context} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user