New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

langium-zod

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

langium-zod

Langium generator plugin that derives Zod schemas from grammar definitions

latest
Source
npmnpm
Version
0.5.3
Version published
Weekly downloads
21
-59.62%
Maintainers
1
Weekly downloads
 
Created
Source

langium-zod

Generate Zod schemas from Langium grammars.

Install

pnpm add langium-zod

Usage

import { generateZodSchemas } from 'langium-zod';

const source = generateZodSchemas({ grammar, services });

Programmatic options

generateZodSchemas({
	grammar,
	outputPath: 'src/generated/zod-schemas.ts',
	include: ['Greeting', 'Tag'],
	exclude: ['InternalNode'],
	stripInternals: true,
	projection: {
		defaults: { strip: ['$container', '$document'] },
		types: {
			Greeting: { fields: ['name', 'tags'] }
		}
	},
	conformance: {
		astTypesPath: 'src/generated/ast.ts'
	},
	crossRefValidation: true
});

CLI options

langium-zod generate \
	--config langium-config.json \
	--out src/generated/zod-schemas.ts \
	--include Greeting,Tag \
	--exclude InternalNode \
	--projection projection.json \
	--strip-internals \
	--conformance \
	--ast-types src/generated/ast.ts \
	--conformance-out src/generated/zod-schemas.conformance.ts \
	--cross-ref-validation

zRef is exported from the package for manual schema customization in runtime-aware validation flows.

Generated output uses Zod 4 and exports named schemas like <TypeName>Schema.

Requirements

  • Node.js >= 20
  • Langium 4.x
  • Zod 4.x

Keywords

langium

FAQs

Package last updated on 10 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts