# @accordproject/concerto-codegen

> Code Generation for the Concerto Modeling Language

Latest version **7.1.0** (published 2026-10-11) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @accordproject/concerto-codegen
pnpm add @accordproject/concerto-codegen
yarn add @accordproject/concerto-codegen
bun add @accordproject/concerto-codegen
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.1.0 |
| Published | 2026-10-11 |
| First published | 2023-02-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 8 |
| Unpacked size | 2.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 16 |
| Author | accordproject.org |
| Maintainers | mttrbrts, dselman, dianalease |
| Keywords | concerto, codegen, modeling |

## Links

- npm: https://www.npmjs.com/package/@accordproject/concerto-codegen
- Repository: https://github.com/accordproject/concerto-codegen
- Homepage: https://github.com/accordproject/concerto
- Issues: https://github.com/accordproject/concerto-codegen/issues
- npm.io page: https://npm.io/package/@accordproject/concerto-codegen

## Dependencies (8)

- [ajv](https://npm.io/package/ajv.md) 8.18.0
- [debug](https://npm.io/package/debug.md) 4.3.4
- [camelcase](https://npm.io/package/camelcase.md) 6.3.0
- [get-value](https://npm.io/package/get-value.md) 3.0.1
- [pluralize](https://npm.io/package/pluralize.md) 8.0.0
- [ajv-formats](https://npm.io/package/ajv-formats.md) 3.0.1
- [json-schema-migrate](https://npm.io/package/json-schema-migrate.md) 2.0.0
- [@openapi-contrib/openapi-schema-to-json-schema](https://npm.io/package/@openapi-contrib/openapi-schema-to-json-schema.md) 4.0.0

## Recent versions

- 7.1.0 (latest) — 2026-10-11
- 3.31.4-20251211090528 (unstable) — 2025-12-11
- 7.0.0 — 2026-10-11
- 6.3.0 — 2026-09-14
- 6.2.0 — 2026-08-27
- 5.1.0 — 2026-07-06
- 5.0.1 — 2026-06-09
- 5.0.0 — 2026-06-03
- 4.1.3 — 2026-05-31
- 4.1.2 — 2026-05-26
- 4.1.1 — 2026-05-19
- 4.1.0 — 2026-05-16
- 4.0.1 — 2026-05-06
- 4.0.0 — 2026-04-28
- 3.32.1 — 2026-03-07
- … 186 more at https://npm.io/package/@accordproject/concerto-codegen/versions

## README

# Concerto CodeGen
Model converters and codegen for [Concerto](https://github.com/accordproject/concerto/) format model files.

## Install

```
npm install @accordproject/concerto-codegen --save
```

## Use

### Benchmark Model Generator

This API allows you to generate models of varying sizes (up to 100 MiB) which can be used to test the performance of your Concerto-handling code.

#### Generate a model up to a specified number of declarations and properties

You can generate a model up to a specified number of declarations and properties using:

```js
const benchmarkModelGenerator = new BenchmarkModelGenerator();
const generated = benchmarkModelGenerator.generateConcertoModels({
    nDeclarations: 5, // Number of declarations in the model
    nProperties: 5, // Number of properties per declaration
});
```

#### Generate a model up to a specified size in bytes

You can generate a model up to a specified size in bytes, however you would need to specify how that model should grow.

##### Grow model by number of declarations

If you'd like to grow it by number of declarations, you will need to specify the number of properties that you wish the model to have (defaults to `1`):

```js
const benchmarkModelGenerator = new BenchmarkModelGenerator();
const generated = benchmarkModelGenerator.generateConcertoModels({
    generateUpToSize: 10000, // Target upper limit of growth in bytes
    growBy: 'declarations', // Element type by which the model should grow
    nProperties: 5, // Number of properties per declaration
});
```

##### Grow model by number of properties

If you'd like to grow it by number of properties, you will need to specify the number of declarations that you wish the model to have (defaults to `1`):

```js
const benchmarkModelGenerator = new BenchmarkModelGenerator();
const generated = benchmarkModelGenerator.generateConcertoModels({
    generateUpToSize: 10000, // Target upper limit of growth in bytes
    growBy: 'properties', // Element type by which the model should grow
    nProperties: 5, // Number of declarations in the model
});
```

The expected response will include an array of generated `models` (currently containing only a single model) and a `metadata` object with information about the generated model e.g:

```js
{
  models: [
    {
      '$class': 'concerto.metamodel@1.0.0.Model',
      decorators: [],
      namespace: 'generated.model@1.0.0',
      imports: [],
      declarations: [
        ...
      ]
    }
  ],
  metadata: {
    requestedModelSizeInBytes: 10000,
    humanReadableRequestedModelSize: '9.77 KiB',
    generatedModelSizeInBytes: 9952,
    humanReadableGeneratedModelSize: '9.72 KiB',
    declarationsN: 5,
    propertiesNInSmallestDeclaration: 15,
    propertiesNInLargestDeclaration: 16
  }
}
```

As you can see from the above example model, the generator will try its best to reach the upper `generateUpToSize` requested size, but may fall short by a few bytes.

## License <a name="license"></a>
Accord Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file. Accord Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/.

---
_Source: https://npm.io/package/@accordproject/concerto-codegen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
