@sanity/schema
Version:
75 lines • 1.55 kB
TypeScript
/**
* @beta
*/
declare class Schema {
#private;
_original: {
name: string;
types: any[];
parent?: Schema;
};
_registry: {
[typeName: string]: any;
};
static compile(schemaDef: any): Schema;
constructor(schemaDef: any);
get name(): string;
/**
* Returns the parent schema.
*/
get parent(): Schema | undefined;
get(name: string): any;
has(name: string): boolean;
getTypeNames(): string[];
getLocalTypeNames(): string[];
}
/**
* @deprecated Use `import {Schema} from "@sanity/schema"` instead
*/
declare class DeprecatedDefaultSchema extends Schema {
static compile(schemaDef: any): Schema;
constructor(schemaDef: any);
}
/**
* @internal
*/
type _FIXME_ = any;
/**
* @internal
*/
interface SchemaValidationResult {
severity: 'warning' | 'error';
message: string;
helpId?: string;
}
/**
* @internal
*/
interface TypeWithProblems {
path: ProblemPath;
problems: SchemaValidationResult[];
}
/**
* @internal
*/
interface ProblemPathTypeSegment {
kind: 'type';
type: string;
name: string;
}
/**
* @internal
*/
interface ProblemPathPropertySegment {
kind: 'property';
name: string;
}
/**
* @internal
*/
type ProblemPathSegment = ProblemPathTypeSegment | ProblemPathPropertySegment;
/**
* @internal
*/
type ProblemPath = ProblemPathSegment[];
export { SchemaValidationResult as a, DeprecatedDefaultSchema as c, ProblemPathTypeSegment as i, Schema as l, ProblemPathPropertySegment as n, TypeWithProblems as o, ProblemPathSegment as r, _FIXME_ as s, ProblemPath as t };