Macro openapi_client

Source
openapi_client!() { /* proc-macro */ }
Expand description

Generates an API client and structs from an OpenAPI specification

Supports loading OpenAPI specifications from both local files and remote URLs. The specification format (JSON/YAML) is auto-detected from the file extension or URL path.

Usage:

use openapi_gen::openapi_client;

// From local file with auto-generated client name (derived from API title + "Api")
openapi_client!("path/to/openapi.json");
openapi_client!("path/to/openapi.yaml");

// From URL with auto-generated client name
openapi_client!("https://api.example.com/openapi.json");
openapi_client!("https://raw.githubusercontent.com/user/repo/main/openapi.yaml");

// With custom client name (works for both files and URLs)
openapi_client!("path/to/openapi.json", "MyApiClient");
openapi_client!("https://api.example.com/openapi.json", "MyApiClient");