Make OpenAPI Response structure clearer (#4021)

This commit is contained in:
Nolann B.
2026-02-18 14:32:07 +01:00
committed by GitHub
parent 1deb897de1
commit 2ebb18dc5a
2 changed files with 21 additions and 12 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@gitbook/react-openapi": patch
---
Make OpenAPI Response structure clearer
+16 -12
View File
@@ -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>