1 | import { TransformerFactory, SourceFile } from 'typescript';
|
2 | import SchemaId from './schemaId';
|
3 | import { JsonSchemaDraft04 } from './jsonSchemaDraft04';
|
4 | import { JsonSchemaDraft07 } from './jsonSchemaDraft07';
|
5 | export declare type JsonSchema = JsonSchemaDraft04.Schema | JsonSchemaDraft07.Schema;
|
6 | export declare type JsonSchemaObject = JsonSchemaDraft04.Schema | JsonSchemaDraft07.SchemaObject;
|
7 | export declare type SchemaType = 'Draft04' | 'Draft07';
|
8 | export interface Schema {
|
9 | type: SchemaType;
|
10 | openApiVersion?: 2 | 3;
|
11 | id: SchemaId;
|
12 | content: JsonSchema;
|
13 | rootSchema?: Schema;
|
14 | }
|
15 | export declare function parseSchema(content: JsonSchema, url?: string): Schema;
|
16 | export declare function readSchemaFromStdin(): Promise<Schema>;
|
17 | export declare function readSchemasFromFile(pattern: string): Promise<Schema[]>;
|
18 | export declare function readSchemaFromUrl(url: string): Promise<Schema>;
|
19 | export declare function parseFileContent(content: string, filename?: string): JsonSchema;
|
20 | export interface PluginContext {
|
21 | option: boolean | Record<string, unknown>;
|
22 | inputSchemas: Iterator<[string, Schema]>;
|
23 | }
|
24 | export declare type PreProcessHandler = (contents: Schema[]) => Schema[];
|
25 | export declare type Plugin = {
|
26 | meta: {
|
27 | name: string;
|
28 | version: string;
|
29 | description?: string;
|
30 | };
|
31 | preProcess?: (context: PluginContext) => Promise<PreProcessHandler | undefined>;
|
32 | postProcess?: (context: PluginContext) => Promise<TransformerFactory<SourceFile> | undefined>;
|
33 | };
|
34 | export declare function loadPlugin(name: string, option: boolean | Record<string, unknown>): Promise<Plugin | undefined>;
|