Skip to content

Commit ecfe0c1

Browse files
committed
Handle OpenAPI ignored responses
1 parent 262a9b1 commit ecfe0c1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/shaggy-crabs-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/react-openapi': patch
3+
---
4+
5+
Handle OpenAPI ignored responses

packages/react-openapi/src/OpenAPIResponseExample.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ export function OpenAPIResponseExample(props: {
4242
});
4343

4444
const tabs = responses
45-
.filter(([_, responseObject]) => responseObject && typeof responseObject === 'object')
45+
.filter(
46+
([_, responseObject]) =>
47+
responseObject &&
48+
typeof responseObject === 'object' &&
49+
// Make sure the response is not hidden
50+
!responseObject['x-hideSample']
51+
)
4652
.map(([key, responseObject]) => {
4753
const description = resolveDescription(responseObject);
4854
const label = description ? (

0 commit comments

Comments
 (0)