@prefecthq/prefect-ui-library
Version:
This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.
30 lines (23 loc) • 917 B
text/typescript
import { isRecord } from '@/utilities/object'
export type SchemaValueError = string | SchemaValuePropertyError | SchemaValueIndexError
export type SchemaValuePropertyError = {
property: string,
errors: SchemaValueError[],
}
export function isSchemaValuePropertyError(value: SchemaValueError): value is SchemaValuePropertyError {
return isRecord(value) && 'property' in value
}
export type SchemaValueIndexError = {
index: number,
errors: SchemaValueError[],
}
export function isSchemaValueIndexError(value: SchemaValueError): value is SchemaValueIndexError {
return isRecord(value) && 'index' in value
}
export type SchemaValuesValidationResponse = {
errors: SchemaValueError[],
valid: boolean,
}
export function isNotStringError(value: SchemaValueError): value is SchemaValuePropertyError | SchemaValueIndexError {
return isSchemaValueIndexError(value) || isSchemaValuePropertyError(value)
}