UNPKG

prong-editor

Version:

Prong (PRojectional jsON Gui) is an editor framework for creating bespoke in-browser editors for JSON-based domain-specific languages (such as [Vega](https://vega.github.io/vega/), [Vega-Lite](https://vega.github.io/vega-lite/), [Tracery](https://tracery.

52 lines (51 loc) 1.82 kB
import { JSONSchema } from "../JSONSchemaTypes"; import { ASTNode } from "./parser"; import { ErrorCode } from "./utils"; export declare function localize(_info: string, message: string, ...args: any[]): string; export declare function getMatchingSchemas(schema: JSONSchema, code: string): Promise<IApplicableSchema[]>; export declare function produceLintValidations(schema: JSONSchema, code: string): Promise<ValidationResult>; export interface MatchingSchema { node: ASTNode; schema: JSONSchema; } export interface IRange { offset: number; length: number; } export declare type Severity = "Error" | "Warning" | "None"; interface IProblem { location: IRange; severity?: Severity; code?: ErrorCode; message: string; expected?: string[]; } interface IApplicableSchema { node: ASTNode; inverted?: boolean; schema: JSONSchema; } interface ISchemaCollector { schemas: IApplicableSchema[]; add(schema: IApplicableSchema): void; merge(other: ISchemaCollector): void; include(node: ASTNode): boolean; newSub(): ISchemaCollector; } declare class ValidationResult { problems: IProblem[]; propertiesMatches: number; propertiesValueMatches: number; primaryValueMatches: number; enumValueMatch: boolean; enumValues: any[] | undefined; constructor(); hasProblems(): boolean; mergeAll(validationResults: ValidationResult[]): void; merge(validationResult: ValidationResult): void; mergeEnumValues(validationResult: ValidationResult): void; mergePropertyMatch(propertyValidationResult: ValidationResult): void; compare(other: ValidationResult): number; } export declare function validate(n: ASTNode | undefined, schema: JSONSchema, validationResult: ValidationResult, matchingSchemas: ISchemaCollector): void; export {};