Skip to content

Release notes ​

Read the highlights of each Golem release.

1.2.0 ​

Golem 1.2.0 replaces generated *BaseModel imports with model<T>(), moves every generated model file into .golem/models/, drops TypeScript 6, and compiles model validators directly to validator IR. Breaking marks a change against 1.1.x.

  • Breaking: Zero-import model<T>() HOC. Extend model<TTask>() from @exprtlabs/golem/model instead of importing a generated *BaseModel class (export class Task extends model<TTask>() { ... }). Build tools rewrite model<T>() to a runtime base call plus a side-effect import of the generated codec. Calling model<T>() without a build tool throws LibError of kind ValidationUnavailable. Clean clones type-check directly without generating first (Define models).
  • Breaking: No *BaseModel classes generated. *BaseModel exports are removed. For IModel types, use WireFormat<TTask> from @exprtlabs/golem/serde and ModelInit<TTask> from @exprtlabs/golem/model instead of generated <Alias>JSON, <Alias>Init, or <Alias>Fields (IObject declarations still emit <Alias>Fields, <Alias>Init, and <Alias>JSON in their generated file).
  • Static convenience methods on model classes. Every class extending model<T>() exposes Task.parse(text, options?), Task.fromWireFormat(wire, options?), Task.stringify(value, options?), Task.toWireFormat(value, options?), Task.validate(value, options?), and Task.assert(value, options?). Standalone generic calls (parse<Task>(), stringify<Task>(), fromWireFormat<Task>(), toWireFormat<Task>(), validate<Task>(), assertValue<Task>()) continue to work (Runtime API).
  • Breaking: Centralized .golem/models/ output. Default model.output changes from src/generated/models to .golem/models. All generated model files (local models, controller DTOs, shared models, golem-mode SDK codecs, and models.validators.generated.ts) are emitted inside model.output. Zero *.model.generated.ts or *.controller.generated.ts files are written beside source files in src/. When model.output lies outside rootDir, golem build emits compiled generated modules under <outDir>/__golem__/models/ and rewrites imports automatically (Generated files).
  • Automatic controller DTO discovery. When ts-openapi (docs or extensions.nest) is configured beside model, Golem automatically discovers inline IObject and IModel declarations in NestJS controller files (*.controller.ts or configured controller sources/suffixes) and emits their codecs into .golem/models/. You no longer need to add .controller.ts to model.suffixes (OpenAPI from controllers).
  • Breaking: TypeScript 7.1+ only. Support for TypeScript 6.x is removed. The typescript peer range is >=7.1.0-0 <8 (7.1.0-beta and newer). Loading an older version fails with golem supports TypeScript 7.1+; found <version> at <path>., and a missing install fails with golem needs TypeScript 7.1+ installed in <directory>. (Compatibility).
  • Split tree-shakable standalone SDK validators. A standalone SDK emits validators/_shared.generated.ts plus one validators/<operation>.generated.ts per operation instead of a single monolithic validators.generated.ts, allowing bundlers to tree-shake unused operation validators.
  • Direct TS-to-IR validator compilation, fast closed-object checks, and streaming serde. @exprtlabs/golem-model compiles TypeScript model descriptors directly to validator IR without a JSON Schema round-trip for supported schemas, validates closed objects in a single zero-allocation pass without Object.getPrototypeOf, streams built-in Date and Temporal models without intermediate wire objects, and uses zero-copy parse() for identity IObjects.
  • Error message i18n. Built-in validation and serde issue messages use a keyed English catalog with opt-in field owners, ModelValidator.messages() overrides, and an optional scan file for translation keys.
  • Untrusted-input security hardening. Closes TOCTOU JSON injection in stringifyJsonString, cyclic JS stack overflow in validate and assert, exponential diamond-DAG DoS, optional Object.prototype property leaks, Record<string, string> toJSON hijacks, IPv6 format amplification, Date spoofing, and unbounded reflected error messages.
  • Bug fixes: Includes 10 bug fixes across model generation, validation, and build rewrites.

Migrating from 1.1.x to 1.2.0 ​

  1. Replace every import { TTaskBaseModel } from './task.model.generated.js' and extends TTaskBaseModel with import { model } from '@exprtlabs/golem/model' and extends model<TTask>(). Replace TTaskJSON and TTaskInit references for IModel types with WireFormat<TTask> and ModelInit<TTask>.
  2. Remove old src/**/*.generated.ts and src/generated/models/ files. Update .gitignore to ignore .golem/ (plus any configured OpenAPI document or SDK output paths); *.generated.ts globs in src/ are no longer needed.
  3. Remove .controller.ts from model.suffixes in golem.yaml if you added it for inline controller DTOs.
  4. Upgrade typescript to >=7.1.0-0 <8 (npm install --save-dev typescript@~7.1.0-beta).
  5. Update any scripts or paths that assumed model.output defaulted to src/generated/models to use .golem/models (or set model.output explicitly in golem.yaml).
  6. Run npx golem generate and npx golem build to regenerate models and split standalone SDK validators.

1.1.0 ​

Golem 1.1.0 is the first stable release. It brings TypeScript models, NestJS controller contracts and an OpenAPI to TypeScript SDK into one generation workflow. Install the generators on their own, or combine them in one golem.yaml. Breaking marks a change against 1.1.0-rc.0, the pre-release.

  • Define models in TypeScript, extend the generated base class with your methods, and convert typed JSON values with fromWireFormat and toWireFormat (Serialization).
  • Validate models with generated TypeScript validators that run without extra packages. Tags add built-in constraints, predicates and conversion pairs.
  • Compose nested models with TypeScript utilities such as Pick and Omit (field types).
  • Generate a typed SDK from OpenAPI with authentication, cancellation, codecs and streaming responses.
  • Generate an OpenAPI document from NestJS controllers without starting the application (OpenAPI from controllers). NestJS requests with NestModelInterceptor.
  • Build with golem build or another build tool (Build tools).
  • Keep generated files current with watch, or run the read-only check command in CI.
  • Share models between apps. Each app generates its own copy.
  • Enable MobX for reactive fields and nested SDK models.
  • The public subpaths of @exprtlabs/golem follow semver, and tooling lives under internal/ (public API). @exprtlabs/golem has 15 public subpaths. The helpers that only generated code calls live in internal/ runtime entries, so generate again after you update (Package subpaths).
  • Run generation on TypeScript 6.0+ and 7.1+, including 7.1.0-beta (Compatibility).
  • TypeScript 7.0 fails at load. Install TypeScript 7.1 or 6 (Generation).
  • Each package registers one golem.yaml block: model, ts-openapi with docs, or openapi-ts with sdks (Configuration, Register a block).
  • Golem derives the job order from what each job reads and writes (Job order).
  • The model block scans from the folder of golem.yaml.
  • A ts-openapi docs job scans from the folder of golem.yaml, which must lie inside the folder of the tsconfig. Put golem.yaml in the project that owns the controllers (Configuration).
  • Import ModelContext and OpenApiContext from @exprtlabs/golem-model/generator and @exprtlabs/golem-openapi-ts/generator, not from @exprtlabs/golem/generator-api.
  • NestJS is the only framework of a ts-openapi docs job (Configuration).
  • In the openapi-ts SDK job, a non-empty remoteHosts list turns on remote references for those hosts only. Without it, the job loads none (Configuration).
  • @exprtlabs/golem-openapi-ts and @exprtlabs/golem-ts-openapi take @exprtlabs/golem as a peer, and typescript as an optional peer. Install typescript in your project.
  • golem build checks and emits inside the golem process and starts no tsc. It keeps no .golem/build stage (Generation).
  • A golem.yaml whose tsconfig is a solution file, with only references, stops golem generate and golem check. Name the app's tsconfig, such as tsconfig.app.json (Generation).
  • One golem generate from a clean tree passes when a model of a controllers root imports the SDK of an openapi job, and a controller that reaches such a model stops with RUNM1084 (Generation).
  • Golem prints a local file relative to the working directory, not as an absolute path, in errors, warnings and diagnostics (Generation).
  • A TypeScript error that stops generation prints in the compiler's plain form, src/a.ts(3,7): error TS2322: ..., as tsc prints it without --pretty (Generation).
  • FileRewrite from @exprtlabs/golem/rewrite has a required importsAt (Generation).
  • The type of the fields of a generated model is the derived T<Name>Fields type (Generation).
  • getObjectCodec and getIModelClass find a model only by its full id (Models).
  • Breaking: getIModelClass and nestModelConstruct return GeneratedModelConstructor | undefined, the class type of @exprtlabs/golem/model. A variable that you typed with the old shape abstract new (values?: never) => object stops compiling (Models).
  • A registered codec holds no JSON Schema. Generated model files are smaller, and a generated parse asks a validation context for Id#wire (Models).
  • A model class with @ApiSchema({ name }) is the OpenAPI component of that name (OpenAPI).
  • A route with no response decorator gets an empty description ("") on its default response, as Nest Swagger writes (OpenAPI).
  • An allOf with a property typed format: date-time in one member and as a $ref to an object in another stops generation. Give the property one type in every member (OpenAPI).
  • A @Body() or @Query() parameter that NestModelInterceptor cannot convert, such as a union of models whose tag the union does not declare, stops generation with RUNM1081. To keep your own interceptor, set nonModelInputs: warn on the nest extension (Generation).
  • The NestJS part of the rewrite and its RUNM1081 checks run only when the ts-openapi block of golem.yaml holds extensions: { nest: {} }. A docs job alone does not turn them on (Generation).
  • NestModelInterceptor comes from @exprtlabs/golem-ts-openapi/nest. Install @exprtlabs/golem-ts-openapi in dependencies (NestJS requests).
  • MobX is the mobx extension of the openapi-ts block, extensions: { mobx: {} }. asGenObservable and getValidator come from @exprtlabs/golem-openapi-ts/mobx and @exprtlabs/golem-openapi-ts/mobx-validation. Generated files import the MobX runtime from @exprtlabs/golem-openapi-ts, so list that package in dependencies (MobX extension).
  • golem build and golem check also stop with RUNM1081 on parameters of one handler that NestModelInterceptor cannot convert together: an optional one-field parameter or optional whole @Body(), a whole and a one-field parameter of one source, parameters that read the same value as different models, and a whole @Query() array. nonModelInputs: warn on the nest extension makes them warnings (Generation).
  • Golem reads a decorator named Body, Query, ApiProperty or ApiPropertyOptional only when it comes from @nestjs/common or @nestjs/swagger, and a nestModelCodec, nestModelUnion or nestModelReturn only when it comes from golem. A NestJS decorator imported under another name or re-exported from another file is read (Generation).
  • A controllers job writes only its OpenAPI document (OpenAPI).
  • A TSerde deserializer that throws on wire input makes parse and fromWireFormat throw LibError with causedByInput: true. The exception of a serializer that throws reaches the caller unchanged (Models).
  • strip: true in the options of parse, fromWireFormat, stringify and toWireFormat removes the keys that a closed object does not declare, at every level, before the checks run. An encode strips the plain objects of the model value, also those that a class instance holds, so a handler can return a database row, or a class that holds one, with an extra column. It keeps a map, an AdditionalProperties tag, pattern properties and an object with exact: false (strip).
  • A whole @Headers() parameter typed as a model holds only the declared fields, decoded to their types. NestModelInterceptor decodes them, and your own interceptor can: nestHeadersCodec(...).decode(request.headers) returns the model, and setNestHeaders hands it to the handler. A field with an uppercase letter stops the build with RUNM1092 (Header models).
  • A TValidation function that throws, or returns neither a boolean nor a string, makes every checked call throw LibError of kind Validation with the original error as cause (Models).
  • A number format such as Format<'int64'> on a string model field stops generation with RUNM1051. A number field takes int32, int64, float and double (Models).
  • A Map or Set field of a Nest DTO needs an @ApiProperty() with type, schema or additionalProperties, or generation stops with RUNM1086 (OpenAPI).
  • A Map or Set field of a model stops generation with RUNM1004 also with validation off (Models).
  • golem-openapi-ts reads a schema with both oneOf and anyOf as both keywords (OpenAPI).
  • A security requirement that names an undeclared scheme stops generation (OpenAPI).
  • The generated client rejects a numeric response header that is not a plain number (OpenAPI).
  • parse<T>(...args) of a model class with a spread before the options stops the build with RUNM1079 (Generation).
  • With validation on, an object keyed by a template literal type rejects a key outside the template, and a key type that golem cannot state as one pattern stops generation with RUNM1004 (Models).
  • With validation on, a tuple with fixed elements after its rest element stops generation with RUNM1021 (Models).
  • Template index signatures of different value types in one object stop generation with RUNM1004 (Models).
  • Models of one name and different schemas in files or folders whose names read alike stop generation with RUNM1005 (OpenAPI).
  • A model union of two or more objects declares its tag key with Discriminator<'kind'>. Golem never looks for it. An untagged union stops with RUNM1080 (Models).
  • The controllers document writes a union's discriminator from the tag only, and a Nest union parameter needs the tag (OpenAPI).
  • A template index signature beside a string index signature of another value type stops generation with RUNM1004 (Models).
  • An OpenAPI 3.1 document with discriminator.defaultMapping stops generation, because the keyword is OpenAPI 3.2 only (OpenAPI).
  • Two @ApiHeader() names of one operation that differ only in case stop generation with NEST1312 (OpenAPI).
  • The controllers job documents optional and mixed body and query parameters, such as @Body('payment') payment?: TPayment and a second whole @Body(), and the build tools report the run-time limits (OpenAPI).
  • A Nest @Query() model field that is a tuple, such as [number, string], decodes each position by its own type: ?pair=1&pair=2 gives [1, '2']. An entry after the listed positions follows the rest type of the tuple, and stays text when the tuple has none.
  • A @ApiBody() with no required writes required: true, a header parameter named Accept, Content-Type or Authorization is ignored with a warning, a spread in @Controller({ ... }) stops with NEST1201, and a model.sources file with no alias stops generation (OpenAPI, Generation).
  • A chained $ref, a $ref to part of a component, an intersection of several data parts, a generic tag alias with a compound base and Record<number, V> give the right result (Models, OpenAPI).
  • A UniqueItems check takes one pass, so a list of any length validates in linear time (Models).
  • A class model decodes about 1.8 to 1.9 times faster (Models).
  • Your own Nest interceptor or pipe decodes a @Query() model or union with nestQueryDecoder.
  • A required OpenAPI property stops generation with OPENAPI_COMPOSITION_UNSATISFIABLE when the keywords beside its enum or const, such as minimum, exclude every value. { enum: [1, 2, 3], minimum: 2 } is the type 2 | 3 (OpenAPI).
  • A job runs again when a file changes that its generator imports from a linked workspace package or from another generator's package (Generation).
  • With dates: temporal, format: duration means the Temporal wire form in every position of the document, in a body, a parameter, a header and a keyword such as not or if. The field accepts the text that Temporal writes, such as PT0.5S (fractional seconds), PT1H30S and P1Y2D. Without temporal, a duration string keeps the RFC 3339 format.
  • A model constructor that throws while golem decodes makes parse, fromWireFormat and the Nest interceptor throw LibError of kind Deserialization with causedByInput: false and the exception as cause, at the root and in a field, an array item or a record value. NestModelInterceptor answers HTTP 500.
  • int64 and Integer values beyond Number.MAX_SAFE_INTEGER are rejected, and MultipleOf compares exact decimal values (Models).
  • golem commands require @exprtlabs/golem at exactly the version of each built-in generator package. An extension package under generators keeps its own version. @exprtlabs/golem/generator-api stays public as the extension API (Package subpaths).
  • A model field of an OpenAPI schema with enum, with or without type, accepts only the listed values, and the other keywords of the schema, such as minimum, maxLength and pattern, apply. A field with type: ['string', 'null'] rejects null unless the enum lists it, and an empty enum accepts no value. A required property whose schema is an empty enum, not: true or false stops generation with OPENAPI_COMPOSITION_UNSATISFIABLE (OpenAPI).
  • A generated client writes a style: cookie array or object parameter that sets no explode as one cookie for each item or key, as OpenAPI 3.2 sets explode to true for style: cookie (OpenAPI).
  • A model cannot turn validation on above its project. { validation: true } on a model in a project with validation: false stops generation with RUNM1089, as does 'sanity' in a project at false (Models).
  • GolemProfile.validation has the type boolean | 'sanity', and resolveProfile accepts 'sanity'. A generator must treat 'sanity' as a level that validates (Generation).
  • A Date field needs an RFC 3339 date-time text with an offset at every validation level, validation off included. A Temporal field accepts only its wire form too, on write as well: stringify and toWireFormat throw Serialization for a value outside it (Models).
  • The model value of a Date or Temporal field is checked with instanceof. A value that fails reports an instance issue. A TSerde class that a *.model.ts file declares stops generation with RUNM1065 (Models).
  • A TSerde field whose JSON value is a string reads only a string, validation off included (Models).
  • Date and the Temporal classes are built-in TSerde types. A field typed Date or Temporal.Instant converts with no tag, and a TSerde tag on the type replaces the default (Dates and times).
  • validation: sanity checks the shape only. It takes golem.yaml and the options of a model, and a call chooses a level with validate: true | 'sanity' | false up to the project level. validate<T>, assertValue<T> and NestModelInterceptor take validate: true | 'sanity' (Models, Validation profiles).
  • A model with { validation: false } can use a validation function from its own file. A shared unnamed object type validates for every model that holds it (Models).
  • A recursive model bounds input nesting with maxDepth (512 by default). The Nest interceptor answers 400 beyond it (Models).
  • An untagged anyOf whose branches state different JSON types checks a value only with the branches of its type (OpenAPI).
  • A generated SDK has no model classes, in either mode, and no per-schema functions. The client checks and converts each request and response, and a response body is a plain object of the SDK type with converted dates. Your own IModel<Charge> gives a class with methods (OpenAPI).
  • An openapi job takes mode: standalone | golem. A standalone SDK (the default) runs alone with a bundled copy of the runtime. A golem mode SDK leaves checks and conversions to the models job (SDK modes).
  • The mobx extension on a standalone SDK stops generation with OPENAPI_MOBX_NEEDS_GOLEM_MODE. Set mode: golem (OpenAPI).
  • The generated client takes a validate option for each client and each call, with a level for requests and responses apart (Lower the checks).
  • An OpenAPI enum or const keeps only the values that its type admits, and a const keeps the keywords beside it. A required property that its type leaves with no value stops generation with OPENAPI_COMPOSITION_UNSATISFIABLE (Diagnostics).
  • Breaking: a tag inside a hole of a template literal type, such as `id-${string & MinLength<3>}`, stops generation with RUNM1045. Write the tag beside the type: `id-${string}` & MinLength<3> (Models).
  • Breaking: with validation on, a field typed by a template literal type, such as `id-${string}`, accepts only the strings that match it, as tsc does. A hole other than string, such as `id-${number}`, stops generation with RUNM1004 (Models).
  • Breaking: an object keyed by a template literal type with a tag in a hole stops generation with RUNM1045 at every validation level (Models).
  • Breaking: an exact or allowAny option typed as a wide boolean stops with RUNM1089 (Models).
  • Breaking: a variant of a Discriminator union that has a TSerde whose wire form is not an object, such as a string, stops generation with RUNM1082 (Models).
  • Breaking: the ModelValidator constructor takes its mode as a required option, new ModelValidator(model, { cache: 'attach' }) (Models).
  • Breaking: a Nest route with @ApiOperation({ hidden: true }) stays in the document. Only @ApiExcludeEndpoint() omits a route (OpenAPI).
  • Breaking: a request body media type with itemSchema stops generation with the rule no-request-item-schema. Declare a request body with schema (OpenAPI).
  • Breaking: two response headers of one response whose names differ only in letter case stop generation with operation-response-headers-unique (OpenAPI).
  • Breaking: a property of a Swagger schema override that is neither an object nor a boolean stops generation with NEST1503 (OpenAPI).
  • Breaking: a oneOf of a recursive array component and another array stops generation with Union has ambiguous conversions (OpenAPI).
  • Breaking: generation type-checks the generated validators module and stops on an error in it (Models).
  • Breaking: two functions of one type written in one field, or a function tag that an inferred value holds beside a written function of the same type, stop with RUNM1040 (Models).
  • Breaking: the string form of uriVersioning is refused with NEST1203 unless it is URI or uri (OpenAPI).
  • Breaking: GeneratorSession.share and GeneratorSession.retain take a SessionKey<Resource> as their key. Make it with sessionKey from @exprtlabs/golem/generator-api (Generation).

Read the CHANGELOG for every change.