mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-20 09:33:21 +00:00
e9149036f6
Co-authored-by: Samy Pessé <samypesse@gmail.com>
14 lines
365 B
TypeScript
14 lines
365 B
TypeScript
import { OpenAPIV3 } from 'openapi-types';
|
|
|
|
export function noReference<T>(input: T | OpenAPIV3.ReferenceObject): T {
|
|
if (typeof input === 'object' && !!input && '$ref' in input) {
|
|
throw new Error('Reference found');
|
|
}
|
|
|
|
return input;
|
|
}
|
|
|
|
export function createStateKey(key: string, scope?: string) {
|
|
return scope ? `${scope}_${key}` : key;
|
|
}
|