File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
openapi-parser/src/helpers Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @gitbook/openapi-parser ' : patch
3
+ ' @gitbook/react-openapi ' : patch
4
+ ---
5
+
6
+ Handle OpenAPI ignored responses
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import type { OpenAPIV3 } from '@scalar/openapi-types';
4
4
* Check if an entity should be ignored
5
5
*/
6
6
export function shouldIgnoreEntity (
7
- data : undefined | OpenAPIV3 . TagObject | OpenAPIV3 . OperationObject
7
+ data : undefined | OpenAPIV3 . TagObject | OpenAPIV3 . OperationObject | OpenAPIV3 . ResponseObject
8
8
) {
9
9
return data ?. [ 'x-internal' ] === true || data ?. [ 'x-gitbook-ignore' ] === true ;
10
10
}
Original file line number Diff line number Diff line change 1
- import type { OpenAPIV3 } from '@gitbook/openapi-parser' ;
1
+ import { type OpenAPIV3 , shouldIgnoreEntity } from '@gitbook/openapi-parser' ;
2
2
import { Markdown } from './Markdown' ;
3
3
import { OpenAPIEmptyExample , OpenAPIExample } from './OpenAPIExample' ;
4
4
import { OpenAPIMediaTypeContent } from './OpenAPIMediaType' ;
@@ -42,7 +42,12 @@ export function OpenAPIResponseExample(props: {
42
42
} ) ;
43
43
44
44
const tabs = responses
45
- . filter ( ( [ _ , responseObject ] ) => responseObject && typeof responseObject === 'object' )
45
+ . filter (
46
+ ( [ _ , responseObject ] ) =>
47
+ responseObject &&
48
+ typeof responseObject === 'object' &&
49
+ ! shouldIgnoreEntity ( responseObject )
50
+ )
46
51
. map ( ( [ key , responseObject ] ) => {
47
52
const description = resolveDescription ( responseObject ) ;
48
53
const label = description ? (
You can’t perform that action at this time.
0 commit comments