Skip to content

langium-zod / LangiumZodConfig

Interface: LangiumZodConfig

Defined in: cli.ts:26

User-facing config file shape (langium-zod.config.js / .ts)

Extends

Properties

PropertyTypeDescriptionOverridesInherited fromDefined in
conformance?{ astTypesPath?: string; outputPath?: string; }--ZodGeneratorConfig.conformanceconfig.ts:129
conformance.astTypesPath?string---config.ts:130
conformance.outputPath?string---config.ts:131
crossRefValidation?boolean--ZodGeneratorConfig.crossRefValidationconfig.ts:128
exclude?string[]--FilterConfig.excludeconfig.ts:53
formMetadata?booleanWhen true, emit .meta({ title, description? }) on generated Zod schemas using humanized property/type names as title and JSDoc comments from the grammar as description. The description field is only included when a JSDoc/grammar comment exists for the corresponding type or property. Useful for zod-to-forms integrations that derive field labels from metadata.-ZodGeneratorConfig.formMetadataconfig.ts:157
include?string[]--FilterConfig.includeconfig.ts:52
langiumConfig?stringPath to langium-config.json. Defaults to langium-config.json in cwd. Only used when picked up via the CLI; programmatic API ignores it.--cli.ts:34
objectStyle?"loose" | "strict"Controls how object schemas are emitted. - 'loose' (default): emits z.looseObject(...) which allows extra properties to pass through unchanged. - 'strict': emits z.object(...) (the standard Zod object). This strips unknown properties by default instead of rejecting them with a validation error. Consumers can call .strict() on the emitted schema if they need hard rejection of unknown properties.-ZodGeneratorConfig.objectStyleconfig.ts:167
outputPath?stringExplicit output path. Overrides derived path from langium-config.json out field.ZodGeneratorConfig.outputPath-cli.ts:36
projection?ProjectionConfig--ZodGeneratorConfig.projectionconfig.ts:126
regexOverrides?Record<string, string>Override the generated schema for specific type names. Use this for parser-based datatype rules (e.g. BigDecimal returns string: ... INT ...) whose structure cannot be expressed as a regex automatically by Langium. The value is a raw regex pattern string (without surrounding / slashes). The named type will emit z.string().regex(new RegExp("...")) instead of z.string(). Example regexOverrides: { BigDecimal: String.raw^[+-]?(.[0-9]+[0-9]+.?[0-9]*)([eE][+-]?[0-9]+)?$ }-ZodGeneratorConfig.regexOverrides
stripInternals?boolean--ZodGeneratorConfig.stripInternalsconfig.ts:127

Released under the MIT License.