Skip to main content
Home
This release is 1 version behind 0.0.49 — the latest version of @skmtc/gen-valibot. Jump to latest
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
23%
Published
4 weeks ago (0.0.48)
Package root>src>ValibotArray.ts
import { ContentBase } from 'jsr:@skmtc/core@^0.0.974' import { toValibotValue } from './Valibot.ts' import { applyModifiers } from './applyModifiers.ts' import type { GenerateContextType, GeneratorKey, RefName, TypeSystemValue, Modifiers, OasRef, OasSchema } from 'jsr:@skmtc/core@^0.0.974' type ValibotArrayArgs = { context: GenerateContextType destinationPath: string items: OasSchema | OasRef<'schema'> modifiers: Modifiers generatorKey: GeneratorKey rootRef?: RefName } export class ValibotArray extends ContentBase { type = 'array' as const items: TypeSystemValue modifiers: Modifiers constructor({ context, generatorKey, destinationPath, items, modifiers, rootRef }: ValibotArrayArgs) { super({ context, generatorKey }) this.modifiers = modifiers this.items = toValibotValue({ destinationPath, schema: items, required: true, context, rootRef }) context.register({ imports: { valibot: [{ '*': 'v' }] }, destinationPath }) } override toString(): string { const content = `v.array(${this.items})` return applyModifiers(content, this.modifiers) } }