@portabletext/schema
Version:
Portable Text Schema
88 lines (79 loc) • 1.43 kB
text/typescript
/**
* @public
*/
export type Schema = {
block: {
name: string
fields?: ReadonlyArray<FieldDefinition>
}
span: {
name: string
}
styles: ReadonlyArray<StyleSchemaType>
lists: ReadonlyArray<ListSchemaType>
decorators: ReadonlyArray<DecoratorSchemaType>
annotations: ReadonlyArray<AnnotationSchemaType>
blockObjects: ReadonlyArray<BlockObjectSchemaType>
inlineObjects: ReadonlyArray<InlineObjectSchemaType>
}
/**
* @public
*/
export type StyleSchemaType = BaseDefinition & {
/**
* @deprecated
* Use `name` instead
*/
value: string
}
/**
* @public
*/
export type ListSchemaType = BaseDefinition & {
/**
* @deprecated
* Use `name` instead
*/
value: string
}
/**
* @public
*/
export type DecoratorSchemaType = BaseDefinition & {
/**
* @deprecated
* Use `name` instead
*/
value: string
}
/**
* @public
*/
export type AnnotationSchemaType = BaseDefinition & {
fields: ReadonlyArray<FieldDefinition>
}
/**
* @public
*/
export type BlockObjectSchemaType = BaseDefinition & {
fields: ReadonlyArray<FieldDefinition>
}
/**
* @public
*/
export type InlineObjectSchemaType = BaseDefinition & {
fields: ReadonlyArray<FieldDefinition>
}
/**
* @public
*/
export type FieldDefinition = BaseDefinition & {
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
}
/**
* @public
*/
export type BaseDefinition = {
name: string
title?: string
}