metaengine-openapi-httpx
OpenAPI 3.x → idiomatic Python: Pydantic v2 models and an async httpx client, with docstrings, smart HTTP-status error handling, retries, timeouts, and camelCase field aliases. Delivered as a pip-installable CLI — no .NET required.
Pick your registry
The same generator, published to every ecosystem we support. Install however your project expects.
Drive it from the CLI or programmatically
PyPI ships a zero-config CLI. NuGet ships the same generator as a C# fluent API — same options, same output.
After install, point the CLI at your schema. It writes the generated tree to your chosen output directory.
metaengine-openapi-httpx <input> <output> [options]Supports OpenAPI 3.0+ specifications in both JSON and YAML formats. The wheel bundles a platform-native runner, so no .NET install is required.
metaengine-openapi-httpx ./petstore.json ./generatedmetaengine-openapi-httpx https://api.example.com/openapi.json ./generatedmetaengine-openapi-httpx ./petstore.json ./generated \
--documentation \
--camel-case-aliases \
--include-tags pets,storeEvery knob, documented
Every option is available on the C# fluent API as a method, and most are also exposed as CLI flags. Cross-cutting auth, headers, retries and timeouts apply across frameworks.
Python Options
6WithDocumentation()Generate Python docstrings on models and service methodsWithOptionsObjectThreshold(int)Parameter count at which a method switches to an options object (default: 4)WithCamelCaseAliases()Add camelCase Field aliases on Pydantic models (populate_by_name=True) so JSON accepts both snake_case and camelCaseWithSyncMethods()Generate synchronous variants alongside the async methods (named with a _sync suffix)WithMiddleware()Emit httpx transport middleware infrastructure (chained request/response hooks)WithMethodNames(Func)Custom method naming rule
Auth · Headers · Resilience
13WithErrorHandling()Smart error handling based on HTTP status semantics (404/403 → None · 400/422 → error body · 401/500 → raise)WithErrorHandling(errors => errors...)Per-status routing: ReturnNullFor(404, 403) · ReturnErrorFor(400, 422) · ThrowFor(401, 500)WithBearerAuth()Bearer token from env var (default API_TOKEN) — adds an Authorization headerWithBearerAuth(string)Bearer token from a specific env var nameWithBearerAuth(string, string)Bearer token from an env var with a custom header nameWithBasicAuth(string, string)HTTP Basic auth from username + password env varsWithCustomHeader(string, string)Static header read from an env var. Repeatable.WithBaseUrlEnvVar(string)Read the base URL from an env var (default API_BASE_URL)WithTimeout(double)Request timeout in seconds for all operationsWithTimeout(double?, double?, double?, double?)Granular httpx timeout: connect · read · write · poolWithRetries()Retries with exponential backoff (default status 429, 503)WithRetries(int)Retries with a custom max-attempts countWithRetries(int, double, double, int[])Retries with full custom settings including status codes
OpenAPI Filtering
3WithStrictValidation()Enable strict OpenAPI validationWithOperationFilter(Func)Filter operations by predicateWithHeaderFilter(Func)Filter header parameters
Naming Transformations
3Types(Func)Transform type namesPaths(Func)Transform output pathsFileNames(Func)Transform file names
File Management
5CleanDestination()Clean output directory before generationAlwaysOverwrite()Always overwrite existing filesOnlyWhenModelChanged()Update only when model changesOnlyWhenNew()Write only new files, preserve existingCleanDirectories(...)Clean specific subdirectories
Diagnostics
1EnableVerboseLogging()Enable detailed logging