Models
TsModelProjectionInstance
What a model projection gets from its TypeScript base class, on this.
Signature
import type { TsModelProjectionInstance } from '@skmtc/lang-typescript'
interface TsModelProjectionInstance<EnrichmentType = undefined, ProjectionOptions = undefined> extends ModelProjectionInstance<EnrichmentType, ProjectionOptions>, TsProjectionRegisterProperties
The projection's identifier, export path, variant and enrichments.
The caller's options.
The generation context providing access to OAS objects and utilities
Whether this generator has been skipped
Optional generator key - attribution input only
Position of the schema fragment this snippet was built from, as a StackTrail. Callers pass a stable snapshot (a clone taken at the call site - StackTrail is mutable, so an un-cloned reference would alias a trail that later append/remove calls could mutate). The empty trail (StackTrail.empty()) means "no single originating node", in which case the resolver uses the generator-key-derived pointer. Converted to a JSON Pointer string only at the resolver - never carried as a string here.
Insert a related model and return its Inserted reference. The model's name is imported into this projection's file when it is in another one.
Pass { variant } for a variant of the model other than 'main'. { options } is required when the peer declares options and refused when it does not.
{ noExport: true } makes a definition that is not exported. Use it only when the peer's export path is this projection's file and no other file uses the definition: imports are added without a check for it. It has no effect on a definition that exists already.
Insert a schema that can be a $ref or an inline schema, such as a request body. A $ref inserts its model. An inline schema becomes a definition named fallbackName in this projection's file.
{ variant } and { options } reach the $ref branch only. For an inline schema, put what distinguishes it into fallbackName.
{ noExport: true } reaches both branches, and makes a definition that is not exported. Use it only when no other file uses the definition. For a $ref, the peer's export path must also be this projection's file: imports are added without a check for noExport. It has no effect on a definition that exists already.
Register imports and definitions in this projection's own export file (this.settings.exportPath). For a different file use registerInto.
Register imports and definitions in the file you name. register always uses this projection's own export file.