Skip to main content

realizeInMemoryGeneratorContext

@the-codegen-project/cliDocs


Home / realizeInMemoryGeneratorContext

Function: realizeInMemoryGeneratorContext()

function realizeInMemoryGeneratorContext(__namedParameters): Promise<RunGeneratorContext>

In-memory counterpart of realizeGeneratorContext. Given a config object and the raw specification string, it produces a fully-loaded RunGeneratorContext using the same per-input loaders as the file flow — so callers that hold a spec in memory (the platform's generateInMemory, preview, the playground) generate identical output to codegen generate. This is the single seam for in-memory generation: parsing/normalization lives here, never in downstream consumers.

Parameters

ParameterType
__namedParametersobject
__namedParameters.configuration{ $schema: string; auth: zodInputAuth; generators: ( | { dependencies: string[]; id: string; language: "typescript"; outputPath: string; preset: "parameters"; serializationType: "json"; } | { dependencies: string[]; id: string; includeValidation: boolean; language: "typescript"; outputPath: string; preset: "headers"; serializationType: "json"; } | { asyncapiGenerateForOperations: boolean; asyncapiReverseOperations: boolean; dependencies: string[]; eventSourceDependency: string; functionTypeMapping: Record<string, undefined | ChannelFunctionTypes[]>; headerGeneratorId: string; id: string; importExtension: ".ts" | ".js" | "none"; kafkaTopicSeparator: string; language: "typescript"; organization: "path" | "flat" | "tag"; outputPath: string; parameterGeneratorId: string; payloadGeneratorId: string; preset: "channels"; protocols: ( | "http_client" | "nats" | "kafka" | "mqtt" | "amqp" | "event_source" | "websocket")[]; } | { dependencies: string[]; enum: "enum" | "union"; id: string; includeValidation: boolean; language: "typescript"; map: "indexedObject" | "map" | "record"; outputPath: string; preset: "payloads"; rawPropertyNames: boolean; serializationType: "json"; useForJavaScript: boolean; } | { channelsGeneratorId: string; clientName: string; dependencies: string[]; id: string; importExtension: ".ts" | ".js" | "none"; language: "typescript"; outputPath: string; preset: "client"; protocols: ("http" | "nats")[]; } | { dependencies: string[]; id: string; language: "typescript"; outputPath: string; preset: "types"; } | { dependencies: string[]; id: string; language: "typescript"; options: { constraints: any; defaultPreset: any; dependencyManager: { dependencies: ... | ...; }; enumType: "enum" | "union"; indentation: { size: ... | ...; type: ... | ...; }; mapType: "indexedObject" | "map" | "record"; modelType: "class" | "interface"; moduleSystem: "ESM" | "CJS"; presets: any; processorOptions: any; rawPropertyNames: boolean; renderTypes: boolean; typeMapping: any; useJavascriptReservedKeywords: boolean; }; outputPath: string; preset: "models"; renderers: zodTypeScriptPresets; } | { dependencies: string[]; id: string; language: "typescript"; options: any; outputPath: string; preset: "custom"; renderFunction: (...args) => any; })[]; importExtension: zodImportExtension; inputPath: string; inputType: "asyncapi"; language: "typescript"; telemetry: zodProjectTelemetryConfig; } | { $schema: string; auth: zodInputAuth; generators: ( | { dependencies: string[]; id: string; language: "typescript"; outputPath: string; preset: "parameters"; serializationType: "json"; } | { dependencies: string[]; id: string; includeValidation: boolean; language: "typescript"; outputPath: string; preset: "headers"; serializationType: "json"; } | { asyncapiGenerateForOperations: boolean; asyncapiReverseOperations: boolean; dependencies: string[]; eventSourceDependency: string; functionTypeMapping: Record<string, undefined | ChannelFunctionTypes[]>; headerGeneratorId: string; id: string; importExtension: ".ts" | ".js" | "none"; kafkaTopicSeparator: string; language: "typescript"; organization: "path" | "flat" | "tag"; outputPath: string; parameterGeneratorId: string; payloadGeneratorId: string; preset: "channels"; protocols: ( | "http_client" | "nats" | "kafka" | "mqtt" | "amqp" | "event_source" | "websocket")[]; } | { dependencies: string[]; enum: "enum" | "union"; id: string; includeValidation: boolean; language: "typescript"; map: "indexedObject" | "map" | "record"; outputPath: string; preset: "payloads"; rawPropertyNames: boolean; serializationType: "json"; useForJavaScript: boolean; } | { channelsGeneratorId: string; clientName: string; dependencies: string[]; id: string; importExtension: ".ts" | ".js" | "none"; language: "typescript"; outputPath: string; preset: "client"; protocols: ("http" | "nats")[]; } | { dependencies: string[]; id: string; language: "typescript"; outputPath: string; preset: "types"; } | { dependencies: string[]; id: string; language: "typescript"; options: { constraints: any; defaultPreset: any; dependencyManager: { dependencies: ... | ...; }; enumType: "enum" | "union"; indentation: { size: ... | ...; type: ... | ...; }; mapType: "indexedObject" | "map" | "record"; modelType: "class" | "interface"; moduleSystem: "ESM" | "CJS"; presets: any; processorOptions: any; rawPropertyNames: boolean; renderTypes: boolean; typeMapping: any; useJavascriptReservedKeywords: boolean; }; outputPath: string; preset: "models"; renderers: zodTypeScriptPresets; } | { dependencies: string[]; id: string; language: "typescript"; options: any; outputPath: string; preset: "custom"; renderFunction: (...args) => any; })[]; importExtension: zodImportExtension; inputPath: string; inputType: "openapi"; language: "typescript"; telemetry: zodProjectTelemetryConfig; } | { $schema: string; auth: zodInputAuth; generators: ({ dependencies: string[]; id: string; language: "typescript"; options: { constraints: any; defaultPreset: any; dependencyManager: { dependencies: ... | ...; }; enumType: "enum" | "union"; indentation: { size: ... | ...; type: ... | ...; }; mapType: "indexedObject" | "map" | "record"; modelType: "class" | "interface"; moduleSystem: "ESM" | "CJS"; presets: any; processorOptions: any; rawPropertyNames: boolean; renderTypes: boolean; typeMapping: any; useJavascriptReservedKeywords: boolean; }; outputPath: string; preset: "models"; renderers: zodTypeScriptPresets; } | { dependencies: string[]; id: string; language: "typescript"; options: any; outputPath: string; preset: "custom"; renderFunction: (...args) => any; })[]; importExtension: zodImportExtension; inputPath: string; inputType: "jsonschema"; language: "typescript"; telemetry: zodProjectTelemetryConfig; }
__namedParameters.specificationDocumentstring

Returns

Promise<RunGeneratorContext>

Defined in

src/codegen/configurations.ts:328