valibot-schema-spdx
Version:
Valibot schema for SPDX identifiers
32 lines (28 loc) • 1.34 kB
TypeScript
import { CustomIssue, CustomSchema, ErrorMessage, InferOutput } from 'valibot';
/**
* A schema for validating SPDX license identifiers {@see {@link https://spdx.dev/}}.
* @module
*/
/**
* Function to validate SPDX license identifiers.
* @param overrideMessage - A string to override the default message or a callback to define a custom message function.
* @returns A custom schema for SPDX license validation.
*/
declare const spdx: (overrideMessage?: string | ((value: CustomIssue) => string)) => CustomSchema<string, ErrorMessage<CustomIssue>>;
/**
* Function to validate OSI-approved SPDX license identifiers.
* @param overrideMessage - A string to override the default message or a callback to define a custom message function.
* @returns A custom schema for OSI-approved SPDX license validation.
*/
declare const osi: (overrideMessage?: string | ((value: CustomIssue) => string)) => CustomSchema<string, ErrorMessage<CustomIssue>>;
/**
* Type for the output of the SPDX schema.
* @typedef {InferOutput<ReturnType<typeof spdx>>} SpdxSchema
*/
type SpdxSchema = InferOutput<ReturnType<typeof spdx>>;
/**
* Type for the output of the OSI schema.
* @typedef {InferOutput<ReturnType<typeof osi>>} OsiSchema
*/
type OsiSchema = InferOutput<ReturnType<typeof osi>>;
export { type OsiSchema, type SpdxSchema, osi, spdx };