import { IRowRendererOptions, TreeListNode, TreeStore } from '@stoplight/tree-list'; import { Dictionary } from '@stoplight/types'; import { JSONSchema4, JSONSchema4TypeName } from 'json-schema'; import * as React from 'react'; export enum SchemaKind { Any = 'any', String = 'string', Number = 'number', Integer = 'integer', Boolean = 'boolean', Null = 'null', Array = 'array', Object = 'object', } export type JSONSchema4CombinerName = 'allOf' | 'anyOf' | 'oneOf'; export type JSONSchema4Annotations = 'title' | 'description' | 'default' | 'examples'; export type JSONSchema4Metadata = 'id' | '$schema'; export interface ICombinerNode { id: string; readonly combiner: JSONSchema4CombinerName; properties?: JSONSchema4[]; annotations: Pick; readonly type?: JSONSchema4TypeName | JSONSchema4TypeName[]; title?: string; } export interface IBaseNode extends Pick { id: string; readonly type?: JSONSchema4TypeName | JSONSchema4TypeName[]; annotations: Partial>; validations: Dictionary; required?: string[]; title?: string; } export interface IRefNode { id: string; $ref: string | null; title?: string; } export interface IArrayNode extends IBaseNode, Pick {} export interface IObjectNode extends IBaseNode, Pick {} export interface IObjectPropertyNode extends IBaseNode { name: string; } export type SchemaNode = ICombinerNode | IBaseNode | IArrayNode | IObjectNode | IObjectPropertyNode | IRefNode; export type SchemaTreeListNode = TreeListNode; export type GoToRefHandler = (path: string, node: IRefNode) => void; export type RowRenderer = ( node: TreeListNode, rowOptions: IRowRendererOptions, treeStore: TreeStore, ) => React.ReactNode; export type ViewMode = 'read' | 'write' | 'standalone';