UNPKG

930 BTypeScriptView Raw
1import SchemaId from './schemaId';
2export declare type JsonSchema = JsonSchemaOrg.Draft04.Schema | JsonSchemaOrg.Draft07.Schema;
3export declare type JsonSchemaObject = JsonSchemaOrg.Draft04.Schema | JsonSchemaOrg.Draft07.SchemaObject;
4export declare type SchemaType = 'Draft04' | 'Draft07';
5export interface Schema {
6 type: SchemaType;
7 openApiVersion?: 2 | 3;
8 id: SchemaId;
9 content: JsonSchema;
10 rootSchema?: Schema;
11}
12export interface NormalizedSchema extends Schema {
13 content: JsonSchemaObject;
14}
15export declare function parseSchema(content: any, url?: string): Schema;
16export declare function getSubSchema(rootSchema: Schema, pointer: string, id?: SchemaId): Schema;
17export declare function getId(type: SchemaType, content: any): string | undefined;
18export declare function searchAllSubSchema(schema: Schema, onFoundSchema: (subSchema: Schema) => void, onFoundReference: (refId: SchemaId) => void): void;