Theme
Python packageSupported stable generatorAvailable now

Infer a normalized generation model from OpenAPI and apply bundled or project-owned Jinja template packs.

python -m pip install codepotg
On this page

Template context model

CodepotG exposes a stable normalized context rather than requiring templates to interpret OpenAPI dictionaries directly.

Global context

The stable global surface includes:

An emission additionally receives its declared selection alias, for example model, operation, or resource.

project

project.name is a complete naming object rather than a plain string. project.lang and project.emit provide selected adapter and output information.

api

api is the canonical language-neutral contract:

Use domain collections such as schemas and operations for convenient filtered views. Use api when root-level relationships or source information are required.

Collection contracts

Major collection groups use a consistent shape:

Examples:

Selection aliases

A paths.yaml selection chooses a collection and exposes each item through an alias:

The corresponding template receives model as the current selected item.

Grouped emissions may receive the item list plus a resolved owner such as resource.

Providers

Provider outputs are explicit cross-emission facts. They can expose generated paths, imports, dependencies, exported names, or related records.

A template should not search unrelated global collections when the pack can declare the dependency as a provider.

emit

Per-item emission facts include group, item key, ref, resource path, folder path, filename, dependency refs, resolved dependencies, and imports.

file

Use file for the currently planned output, not for arbitrary filesystem access.

Documentation values

Major objects expose docs, commonly including summary, description, examples, and deprecation information.

Implementation guidance is available through ordered info categories.

Language values

lang exposes the selected adapter, framework, package metadata, feature flags, and helper groups.

Raw and extensions

Every normalized major object exposes:

Use them only after normalized values. Raw access is a compatibility escape hatch, not the primary template API.

Context stability

New variables can be added while compatibility aliases remain available during pack migration. Pack authors should avoid depending on undocumented internal Python objects or object identity.