Skip to content

langium-zod / LangiumZodConfig

Interface: LangiumZodConfig ​

Defined in: generate.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:130
conformance.astTypesPath?string---config.ts:131
conformance.outputPath?string---config.ts:132
crossRefValidation?boolean--ZodGeneratorConfig.crossRefValidationconfig.ts:129
domainOnly?booleanWhen true (CLI --domain-only), emit ONLY the domain surface and skip Zod-schema generation.-ZodGeneratorConfig.domainOnlyconfig.ts:172
domainOutputPath?stringOutput path for the generated domain surface (domain.ts).-ZodGeneratorConfig.domainOutputPathconfig.ts:174
domainOverlays?DomainOverlayConfigProject-specific semantic overlays (renames + read-only merges) supplied by the consumer for the domain target.-ZodGeneratorConfig.domainOverlaysconfig.ts:176
emitDomain?booleanWhen true, the CLI also emits the domain surface to domainOutputPath.-ZodGeneratorConfig.emitDomainconfig.ts:170
exclude?string[]--FilterConfig.excludeconfig.ts:54
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:158
include?string[]--FilterConfig.includeconfig.ts:53
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.--generate.ts:34
namespaceOps?booleanWhen true (CLI --namespace-ops), also emit the namespace-ops surface alongside other targets.-ZodGeneratorConfig.namespaceOpsconfig.ts:178
namespaceOpsIdentity?Record<string, string>Element-type → identity field path map for namespace-ops removeX emission. e.g. { Attribute: 'name', ChoiceOption: 'typeCall.type.$refText' }.-ZodGeneratorConfig.namespaceOpsIdentityconfig.ts:185
namespaceOpsOutputPath?stringOutput path for the generated namespace-ops surface (domain-ops.ts).-ZodGeneratorConfig.namespaceOpsOutputPathconfig.ts:180
namespaceOpsRepository?{ elementTypes?: string[]; }Top-level element types included in the generated domain repository (AnyDomain union). e.g. { elementTypes: ['Data', 'Choice'] }.-ZodGeneratorConfig.namespaceOpsRepositoryconfig.ts:190
namespaceOpsRepository.elementTypes?string[]---config.ts:190
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:168
outputPath?stringExplicit output path. Overrides derived path from langium-config.json out field.ZodGeneratorConfig.outputPath-generate.ts:36
projection?ProjectionConfig--ZodGeneratorConfig.projectionconfig.ts:127
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[1]?(.[0-9]+[0-9]+.?[0-9]*)([eE][+-]?[0-9]+)?$ }-ZodGeneratorConfig.regexOverrides
stripInternals?boolean--ZodGeneratorConfig.stripInternalsconfig.ts:128

  1. +- ↩︎

Released under the MIT License.