Skip to content

Commit 0924259

Browse files
authored
Expose OpenAPI helper shouldIgnoreEntity (#2903)
1 parent 05affac commit 0924259

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

.changeset/two-numbers-brush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/openapi-parser': patch
3+
---
4+
5+
Expose helper `shouldIgnoreEntity`
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { OpenAPIV3 } from '@scalar/openapi-types';
2+
3+
/**
4+
* Check if an entity should be ignored
5+
*/
6+
export function shouldIgnoreEntity(
7+
data:
8+
| undefined
9+
| Pick<OpenAPIV3.TagObject, 'x-internal' | 'x-gitbook-ignore'>
10+
| Pick<OpenAPIV3.OperationObject, 'x-internal' | 'x-gitbook-ignore'>
11+
) {
12+
return data?.['x-internal'] === true || data?.['x-gitbook-ignore'] === true;
13+
}

packages/openapi-parser/src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
export { parseOpenAPI } from './parse';
22

3+
export { dereference } from '@scalar/openapi-parser';
4+
export type { AnyObject } from '@scalar/openapi-parser';
35
export type * from '@scalar/openapi-types';
4-
export type * from './types';
56
export * from './error';
7+
export * from './helpers/shouldIgnoreEntity';
68
export * from './traverse';
7-
export { dereference } from '@scalar/openapi-parser';
8-
export type { AnyObject } from '@scalar/openapi-parser';
9+
export type * from './types';

0 commit comments

Comments
 (0)