Skip to main content

Function: canonicalizeConfig()

canonicalizeConfig(config): string

Defined in: packages/core/src/canonicalize-config.ts:85

Serialize a CodegenConfig to a canonical string suitable for hashing into a cache key.

Parameters

config

CodegenConfig

The codegen configuration to serialize.

Returns

string

A deterministic JSON string representation of the config with keys sorted lexicographically.

Example

const key = canonicalizeConfig({ schemaImportPath: './schema', exportName: 'UserSchema' });
const hash = crypto.createHash('sha256').update(key).digest('hex');