sql-ddl-to-json-schema
Version:
Parse and convert SQL DDL statements to a JSON Schema.
39 lines (38 loc) • 1.06 kB
TypeScript
import { JSONSchema7 as OriginalJSONSchema7 } from 'json-schema';
import { TableInterface, JSONSchemaFormatOptions } from '../../../../typings';
import { Column } from './column';
type JSONSchema7 = OriginalJSONSchema7 & {
type: string;
required: string[];
definitions?: NonNullable<OriginalJSONSchema7['definitions']>;
properties?: NonNullable<OriginalJSONSchema7['properties']>;
};
/**
* Class to represent a table as parsed from compact format.
*/
export declare class Table {
/**
* Table columns.
*/
columns: Column[];
/**
* Table name.
*/
name: string;
/**
* Table comment.
*/
comment?: string;
/**
* Create Table instance from compact JSON format.
*
* @param json Table in compact JSON format.
*/
static fromCompactJson(json: TableInterface): Table;
/**
* JSON casting of this object calls this method.
* @param options Options available to format as JSON Schema.
*/
toJSON(options: JSONSchemaFormatOptions): JSONSchema7;
}
export {};