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

Schema and field variables

Schema collections

Schema values

Each schema exposes:

Identity and role

  • id is the normalized registry identity.
  • name is the full naming object.
  • ref preserves the original reference where applicable.
  • kind classifies model, DTO, enum, primitive, alias, composed, or unknown shapes.
  • role records create, update, query, params, body, response, or another Codepot role.
  • resource links the schema to its owning resource when known.

Constraints

default and const are presence-aware, so explicit null remains different from an absent value.

Composition

Each branch uses the normal schema-use shape and can be a ref or inline schema.

Array information

The source may also preserve advanced JSON Schema keywords under normalized constraints or raw.

Object information

additional_properties distinguishes allowed, forbidden, typed, and referenced forms.

Fields

Schema and entity fields share this core:

Schema fields additionally expose:

  • reference identity and resolved target;
  • item schemas for arrays;
  • inline and referenced composition;
  • inherited/projected origin;
  • target-language type helpers.

Query capabilities

Search values:

Enum values

An enum schema exposes enum_type and ordered enum_values. Templates should preserve source values and use language helpers for identifiers or literals.

Dependencies

schema.dependencies records referenced schemas and related generation facts. Prefer planned dependencies and file imports over recursively scanning field refs in the template.

Example

Guidance

  • Prefer schema.kind and schema.role over naming conventions.
  • Use presence-aware values when rendering defaults.
  • Preserve enum source values separately from target identifiers.
  • Check nullable and required independently.
  • Use normalized composition before schema.raw.