Theme
TypeScript packageSupported prototypeAvailable now

Author typed API and software contracts, then emit portable OpenAPI JSON or YAML.

npm install codepot-openapi zod
On this page

Package configuration

A contract file exports the result of definePackageConfig.

contracts

contracts is the required ordered list of version builders. Each builder compiles to its own OpenAPI document and output file set.

Keep version contracts independent. Share reusable TypeScript helpers where useful, but avoid mutating one version from another.

output

FieldMeaning
folderOutput directory relative to the working directory
filePrefixBase file name used for generated documents
formatsAny ordered combination of json and yaml
debugFilePrefixOptional prefix for compiler debug output

The exported PackageOutputFormat values are json and yaml.

server

The optional package server adds a server URL and description to generated documents when the contract does not provide more specific server behavior.

compile

compile accepts CompileOptions. Use it for compiler-level behavior rather than output formatting. Prefer defaults unless a project has a documented reason to change a compiler option.

validation

FieldDefault intent
enabledRun generated-document validation
failOnWarningsTreat warnings as a failed generation
allowUnusedComponentsPermit reusable components that are not referenced by a route

Warnings are useful during contract development. Production release checks can enable stricter behavior.

logging

Logging configuration controls compiler and CLI diagnostics. It does not change the generated contract.

Configuration resolution

resolvePackageConfig, resolveOutputConfig, and resolveCompileOptions expose the normalized forms used internally. Most projects should call definePackageConfig and let the CLI resolve defaults.

The root config can import contract modules while remaining the single package entry point.