mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-18 08:35:10 +00:00
18 lines
492 B
TypeScript
18 lines
492 B
TypeScript
import { OpenAPIV3 } from '@scalar/openapi-types';
|
|
|
|
export function noReference<T>(input: T | OpenAPIV3.ReferenceObject): T {
|
|
if (checkIsReference(input)) {
|
|
throw new Error('Reference found');
|
|
}
|
|
|
|
return input;
|
|
}
|
|
|
|
function checkIsReference(input: unknown): input is OpenAPIV3.ReferenceObject {
|
|
return typeof input === 'object' && !!input && '$ref' in input;
|
|
}
|
|
|
|
export function createStateKey(key: string, scope?: string) {
|
|
return scope ? `${scope}_${key}` : key;
|
|
}
|