Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MetaEngine OpenAPI Python httpx

PyPI version Python versions License: MIT

Generate idiomatic Python clients and models from OpenAPI/Swagger specifications.

Pydantic v2 models and an async httpx client — typed, with optional docstrings, validation, and camelCase field aliases.

No .NET required. Unlike most MetaEngine wrappers, each wheel bundles a self-contained, platform-native binarypip install and run. There is nothing else to install.


Quick Links


Features

  • Self-contained - Bundled native binary per platform; no .NET runtime to install
  • Pydantic v2 models - BaseModel with ConfigDict, typed fields, required vs optional
  • Async httpx client - One service class per OpenAPI tag, model_validate on responses
  • camelCase aliases - snake_case Python properties mapped to camelCase wire names via Field(alias=...)
  • Enums - Standalone Python enum types, properly serialized
  • Docstrings - Optional doc-comment generation from OpenAPI descriptions and examples
  • Tag Filtering - Generate only the operations you need
  • Options Object - Collapse long parameter lists into an options object past a threshold

Installation

pip install metaengine-openapi-httpx

Pre-built wheels are published for Linux (x86_64, aarch64), macOS (Apple Silicon + Intel), and Windows (x64).


Requirements

  • Python 3.8 or later
  • No .NET runtime - the wheel ships a self-contained native binary for your platform

Quick Start

metaengine-openapi-httpx <input> <output> [options]

Recommended Setup

metaengine-openapi-httpx api.yaml ./generated \
  --camel-case-aliases \
  --documentation

More Examples

# From a URL
metaengine-openapi-httpx https://api.example.com/openapi.json ./generated

# Filter by OpenAPI tags
metaengine-openapi-httpx api.yaml ./generated --include-tags orders,users

# Strict spec validation + verbose logging
metaengine-openapi-httpx api.yaml ./generated --strict-validation --verbose

CLI Options

Argument / Option Description Default
input (required) OpenAPI specification file path or URL -
output (required) Output directory for generated Python files -
--include-tags <tags> Only generate operations with these tags (comma-separated) -
--service-suffix <name> Service class naming suffix Service
--options-threshold <n> Parameter count at which a method switches to an options object 4
--camel-case-aliases Generate camelCase field aliases for Pydantic models false
--documentation Generate docstring comments false
--strict-validation Enable strict OpenAPI validation false
--verbose Enable verbose logging false

Generated Code Structure

output/
  ├── models/                    # One file per schema (Pydantic v2)
  │   ├── order.py               # class Order(BaseModel): ...
  │   ├── order_status.py        # standalone enum type
  │   └── ...
  └── services/                  # One async httpx client per tag
      ├── orders_service.py      # class OrdersService with all order operations
      └── ...

Models use Pydantic v2 (BaseModel + ConfigDict); with --camel-case-aliases, snake_case properties carry a Field(alias=...) mapping to the wire name and populate_by_name=True:

class Order(BaseModel):
    model_config = ConfigDict(populate_by_name=True)
    id: int
    customer_name: str = Field(alias='customerName')
    total_amount: float | None = Field(default=None, alias='totalAmount')

Support


License

MIT License - see LICENSE file for details.


About This Repository

This is the documentation and issue tracking repository for MetaEngine OpenAPI Python httpx. The package is published to PyPI.

Source code is proprietary, but the package is free to use under the MIT license.

About

Generate idiomatic Python — Pydantic v2 models and an async httpx client — from OpenAPI specifications. Self-contained: no .NET runtime required.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors