
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
@asyncapi/generator-model-sdk
Advanced tools
The official SDK for generating data models from JSON Schema and AsyncAPI spec
AsyncAPI Model SDK is a set of classes/functions for generating data models from JSON Schema and AsyncAPI spec.
This package is under development and it has not reached version 1.0.0 yet, which means its API might get breaking changes without prior notice. Once it reaches its first stable version, we'll follow semantic versioning.
Run this command to install the SDK in your project:
npm install --save @asyncapi/generator-model-sdk
The process of creating data models from input data consists of 2 processes, the input and generation process.
The input process ensures that any supported input is handled correctly, the basics are that any input needs to be converted into our internal model representation CommonModel. The following inputs are supported:
Read more about the input process here.
The generation process uses the predefined CommonModels from the input stage to easily generate models regardless of input. The package supports the following output languages:
Check out the example to see how to use the library and generators document for more info.
NOTE: Each implemented language has different options, dictated by the nature of the language. Keep this in mind when selecting a language.
import { TypeScriptGenerator } from '@asyncapi/generator-model-sdk';
const generator = new TypeScriptGenerator({ modelType: 'interface' });
const doc = {
$id: "Address",
type: "object",
properties: {
street_name: { type: "string" },
city: { type: "string", description: "City description" },
state: { type: "string" },
house_number: { type: "number" },
marriage: { type: "boolean", description: "Status if marriage live in given house" },
pet_names: { type: "array", items: { type: "string" } },
state: { type: "string", enum: ["Texas", "Alabama", "California", "other"] },
},
required: ["street_name", "city", "state", "house_number", "state"],
};
const interfaceModel = await generator.generate(doc);
// interfaceModel[0] should have the shape:
interface Address {
streetName: string;
city: string;
state: string;
houseNumber: number;
marriage?: boolean;
petNames?: Array<string>;
state?: "Texas" | "Alabama" | "California" | "other";
}
These are the supported inputs.
The library expects the asyncapi property for the document to be sat in order to understand the input format.
const parser = require('@asyncapi/parser');
const doc = await parser.parse(`{asyncapi: '2.0.0'}`);
generator.generate(doc);
generator.generate({asyncapi: '2.0.0'});
generator.generate({$schema: 'http://json-schema.org/draft-07/schema#'});
There are multiple ways to customize the library both in terms of processing, logging and output generation, check the customization document.
To setup your development environment please read the development document.
Read CONTRIBUTING guide.
Thanks goes to these wonderful people (emoji key):
Maciej Urbańczyk 🐛 💻 📖 🤔 🚧 💬 ⚠️ 👀 | czlowiek488 🐛 👀 🤔 | Sergio Moya 🐛 | Jonas Lagoni 🐛 💻 📖 🤔 🚧 💬 ⚠️ 👀 | Lukasz Gornicki 👀 | Arjun Garg 💻 | Fran Méndez 👀 |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
The Model SDK for generating data models
We found that @asyncapi/generator-model-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

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.

Security News
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.