@starduv/lil-schemy
Version:
Lil' Schemy is a cli tool that enables code first schema generation from TypeScript
26 lines (25 loc) • 1.55 kB
TypeScript
export { generate } from './commands/generate';
export { getRootFiles } from './utils';
type NumberFormat = "int32" | "int64" | "float" | "double";
type StringFormat = "date-time" | "time" | "date" | "duration" | "email" | "idn-email" | "hostname" | "idn-hostname" | "ipv4" | "ipv6" | "uuid" | "uri" | "uri-reference" | "uri-template" | "json-pointer" | "relative-json-pointer" | "regex" | "iri" | "iri-reference" | undefined;
export type format = StringFormat | NumberFormat | undefined;
export type OperationMethod = 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH' | 'TRACE';
export interface PathItemOptions {
method: OperationMethod;
path: string;
tags?: string[];
}
export declare function LilPath<Func>(fn: Func, options: PathItemOptions): Func;
export interface ResponseOptions {
description: string;
example?: string;
statusCode: number;
mediaType?: string;
}
export declare function LilResponse<ResponseType>(response: ResponseType, options: ResponseOptions): ResponseType;
export type LilBodyParam<Param, Required extends boolean = true, MediaType extends string = "application/json"> = Param;
export type LilHeader<Param, Required extends boolean = true, Format extends format = undefined> = Param;
export type LilQueryParam<Param, Required extends boolean = false, Format extends format = undefined> = Param;
export type LilRouteParam<Param, Required extends true = true, Format extends format = undefined> = Param;
export type LilRequiredProp<Param> = Param;
export type LilSub<From, To> = From;