by Minh N.

Modelina generates accurate, well-tested data models from AsyncAPI, JSON Schema, OpenAPI, Avro, and more across 12+ output languages including TypeScript, Java, C#, Go, Rust, and Dart.
This block provides @asyncapi/modelina v5.10.1, a TypeScript library that generates typed data models from AsyncAPI, OpenAPI, JSON Schema, and other schema inputs across a dozen target languages. The typical buyer is a backend or platform engineer who wants to automate model/DTO generation as part of a code-generation pipeline or API toolchain.
generators/ - Language-specific generators (Java, C#, TypeScript, Go, Rust, Kotlin, Dart, PHP, Python, Scala, C++, JavaScript) plus abstract base classeshelpers/ - Utility helpers shared across generatorsinterpreter/ - Schema interpretation layer that normalises inputs into an internal meta-modelmodels/ - Internal meta-model types (ConstrainedModel, UnionModel, ObjectModel, EnumModel, etc.)processors/ - Input processors for AsyncAPI, OpenAPI, JSON Schema, and raw meta-modelutils/ - Logger and shared utility functionsindex.ts - Root barrel re-exporting everything from the sub-modules abovenpm install @asyncapi/modelina@5.10.1
npm install @apidevtools/json-schema-ref-parser
npm install @apidevtools/swagger-parser
npm install @asyncapi/multi-parser
npm install @asyncapi/parser
npm install alterschema
npm install change-case
npm install fast-xml-parser
npm install js-yaml
npm install typescript-json-schema
No native modules, pod installs, or Android linking are required. This is a pure Node.js library.
Copy the source/ directory into your project, e.g. at src/modelina/.
Add a path alias in tsconfig.json so imports resolve cleanly:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@modelina/*": ["src/modelina/*"]
},
"module": "commonjs",
"target": "ES2019",
"esModuleInterop": true,
"resolveJsonModule": true,
"strict": true
}
}
import { TypeScriptGenerator, CSharpGenerator, JavaGenerator } from './modelina';
// or if using path alias:
import { TypeScriptGenerator } from '@modelina/index';
No environment variables are required for basic usage. If you use the AsyncAPI parser integration, ensure your network can reach remote URLs at generation time.
Spin up an isolated sandbox and run it server-side — no local setup.
Tetrees AI Review of this version
This TypeScript cli / script completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
Pipeline avcp-2026-08-04.1 · SHA-256 1bee0cc3e1d25f4c…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
Reviewed Aug 4, 2026
Push this product straight into your AI IDE, web builder or cloud IDE.
Connect Tetrees to a compatible AI IDE, list products you own, and request the verified ZIP without exposing seller upload controls.
No reviews yet.
Sign in to join the discussion
Loading discussion…
$refTypeScript 4.7+ and Node.js 16+ are strongly recommended. The library ships as TypeScript source; compile it alongside your project (do not pre-compile separately).
class TypeScriptGenerator {
constructor(options?: TypeScriptGeneratorOptions);
generate(input: Record<string, unknown> | InputMetaModel): Promise<OutputModel[]>;
generateCompleteModels(input: ..., options: ...): Promise<OutputModel[]>;
}
The primary entry point for generating TypeScript interfaces and classes. Instantiate with optional presets and constraints overrides, then call generate() with a raw AsyncAPI/OpenAPI/JSON Schema document or a pre-built InputMetaModel.
class CSharpGenerator {
constructor(options?: CSharpGeneratorOptions);
generate(input: Record<string, unknown> | InputMetaModel): Promise<OutputModel[]>;
}
Generates C# classes, records, and enums. Supports presets for JSON serialization (JsonSerializerPreset, NewtonsoftSerializerPreset) and common attribute decoration (CommonPreset). Use when your consumer services are .NET-based.
const Logger: {
setLogger(logger: ModelLoggingInterface): void;
};
interface ModelLoggingInterface {
info(message: string, ...args: unknown[]): void;
warn(message: string, ...args: unknown[]): void;
debug(message: string, ...args: unknown[]): void;
error(message: string, ...args: unknown[]): void;
}
Global logger singleton. Call Logger.setLogger(yourLogger) at startup to pipe Modelina's internal diagnostic messages into your application's log infrastructure (Winston, Pino, etc.).
const CSHARP_DEFAULT_PRESET: CSharpPreset;
const CPLUSPLUS_DEFAULT_PRESET: CplusplusPreset;
The built-in default preset for each language. Pass additional presets alongside these in the generator presets array to layer extra behaviour on top of the defaults.
A plain JSON Schema document is passed directly to the generator. The result array contains one OutputModel per discovered schema definition.
import { TypeScriptGenerator } from './modelina';
const schema = {
$schema: 'http://json-schema.org/draft-07/schema',
title: 'User',
type: 'object',
properties: {
id: { type: 'integer' },
email: { type: 'string' },
active: { type: 'boolean' }
},
required: ['id', 'email']
};
async function main() {
const generator = new TypeScriptGenerator();
const models = await generator.generate(schema);
for (const model of models) {
console.log(`// --- ${model.modelName}.ts ---`);
console.log(model.result);
}
}
main();
Use one of the built-in C# presets to add [JsonProperty] attributes automatically. Combine multiple presets by passing an array.
import {
CSharpGenerator,
CSHARP_DEFAULT_PRESET,
NewtonsoftSerializerPreset
} from './modelina';
const schema = {
title: 'Order',
type: 'object',
properties: {
orderId: { type: 'string' },
total: { type: 'number' }
}
};
async function main() {
const generator = new CSharpGenerator({
presets: [
CSHARP_DEFAULT_PRESET,
{ preset: NewtonsoftSerializerPreset }
]
});
const models = await generator.generate(schema);
for (const model of models) {
console.log(model.result);
}
}
main();
Replace the default silent logger with Pino, and override the model-name constrainer to enforce a Dto suffix on every generated class name.
import pino from 'pino';
import { Logger, TypeScriptGenerator } from './modelina';
import type { ModelLoggingInterface } from './modelina';
const pinoLogger = pino();
const modelinaLogger: ModelLoggingInterface = {
info: (msg, ...a) => pinoLogger.info(a, msg),
warn: (msg, ...a) => pinoLogger.warn(a, msg),
debug: (msg, ...a) => pinoLogger.debug(a, msg),
error: (msg, ...a) => pinoLogger.error(a, msg)
};
Logger.setLogger(modelinaLogger);
const generator = new TypeScriptGenerator({
constraints: {
modelName: ({ modelName }) => `${modelName}Dto`
}
});
const schema = {
title: 'Product',
type: 'object',
properties: { sku: { type: 'string' }, price: { type: 'number' } }
};
generator.generate(schema).then(models => {
models.forEach(m => console.log(m.result));
});
index.ts - Root barrel; re-exports everything from generators, helpers, models, processors, and selectively from utils (Logger, ModelLoggingInterface).generators/ - Contains one sub-directory per target language plus abstract base classes (AbstractGenerator, AbstractRenderer, AbstractDependencyManager, AbstractFileGenerator).generators/AbstractGenerator.ts - Base class all language generators extend; defines generate() and constraint/preset pipeline.generators/AbstractRenderer.ts - Base renderer with common rendering helpers used by every language-specific renderer.generators/AbstractDependencyManager.ts - Tracks import/dependency accumulation during code generation.generators/AbstractFileGenerator.ts - Adds file-system output capability on top of the base generator.helpers/ - Cross-cutting utility functions (naming, formatting) shared across the interpreter and generators.interpreter/ - Converts raw AsyncAPI/OpenAPI/JSON Schema inputs into the internal InputMetaModel format.models/ - Core meta-model classes: ConstrainedObjectModel, ConstrainedEnumModel, UnionModel, etc. These are what renderers operate on.processors/ - Dedicated input processor per schema format; normalises heterogeneous inputs before interpretation.utils/ - Logger singleton and ModelLoggingInterface type; only these two symbols are exported from index.ts."type": "module", set "module": "commonjs" in tsconfig.json or use dynamic import() with an interop wrapper.$ref resolution fails at runtime - @apidevtools/json-schema-ref-parser makes HTTP requests to resolve remote $refs; ensure outbound HTTP is allowed in CI and that the schema host is reachable.infer variance used internally will cause compile errors; pin typescript >= 4.7.0 in devDependencies.index.ts; use named imports rather than wildcard import * to avoid namespace collisions.typescript-json-schema requires reflect-metadata - If you invoke the TypeScript generator on TypeScript class source files rather than JSON Schema, add import 'reflect-metadata' at your entry point and enable emitDecoratorMetadata in tsconfig.json.I have the Modelina source code located at `src/modelina/` in my project.
The integration guide is at `USAGE.md` (read it first for real import paths and API signatures).
The upstream npm package is `@asyncapi/modelina@5.10.1`.
Please help me integrate Modelina into my existing Node.js/TypeScript project step by step:
1. Read USAGE.md and src/modelina/index.ts to understand what is exported.
2. Install all required runtime dependencies listed in USAGE.md.
3. Update my tsconfig.json to compile the source alongside my project.
4. Create a `src/codegen/generate.ts` file that:
- Reads an AsyncAPI or JSON Schema document from disk.
- Uses the appropriate Modelina generator (ask me which target language).
- Writes each OutputModel's `result` string to a file in `src/generated/`.
5. Wire the generator call into my existing Express app startup or a standalone CLI script.
6. Show me how to plug in my existing Winston logger using Logger.setLogger().
Only use imports and symbols that exist in src/modelina/index.ts and the files shown in USAGE.md.
Do not install the pre-built npm package; use the local source exclusively.
Modelina is published under the Apache-2.0 license (see source/LICENSE if present, or the upstream repository). Upstream package: @asyncapi/modelina on npm — source and full documentation at https://www.modelina.org.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
The full install guide and integration prompts unlock after purchase.
Automation, Utilities & Developer Tools
Free