az-openai-openapi
自动收集自
crates/api/openai-openapi/README.md。
OpenAI REST OpenAPI contract traits, typed DTOs, and fixed REST path constants.
Source
- OpenAPI repository: https://github.com/openai/openai-openapi
- Spec file: https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml
- Source metadata is captured by the compile-time Rust macro in
OpenAiApiSpec.
This crate is implementation-free. Application crates implement the generated traits and decide how to map requests to HTTP clients, auth, retries, and streaming.
The generated traits use concrete Serialize/Deserialize DTOs for JSON request and response bodies. For example, OpenAiChatApi::create_chat_completion accepts CreateChatCompletionRequest and returns CreateChatCompletionResponse, while OpenAiResponsesApi::create_response accepts CreateResponse and returns Response.
OpenAiJsonValue and OpenAiJsonObject are retained only for fields whose OpenAPI schema is intentionally open-ended or lacks a fixed object shape. They are not used as global request/response fallbacks in the REST trait methods.
Generation
The contract source is generated by the Rust generator in crates/micro/openapi-codegen.
The checked-in src/generated snapshot is the compile-time source of truth so DTO fields, REST traits, and diagnostics stay visible to IDEs and code review.
The default source is the official openapi.yaml because openai/openai-openapi does not currently publish openapi.json at the matching raw GitHub URL. To generate from a remote JSON spec mirror, set AZ_OPENAI_OPENAPI_SPEC_URL:
AZ_OPENAI_OPENAPI_SPEC_URL=https://example.com/openapi.json cargo run -p az-openapi-codegen --bin openai
Run the verification with:
cargo run -p az-openapi-codegen --bin openai
cargo fmt -p az-openapi-codegen -p az-openai-openapi
cargo test -p az-openai-openapi
Module collection follows the addzero automod convention: src/lib.rs stays as the crate entrypoint using automod::dir!, src/generated.rs collects the checked-in generated contract modules, and src/contract.rs, src/models.rs, src/paths.rs, and src/bodies.rs expose the checked-in public contract.