Skip to main content

openapp_sdk_common/
lib.rs

1//! Shared models and types for the `OpenApp` SDK.
2//!
3//! This crate holds:
4//!
5//! * a small set of hand-written envelopes that every language SDK needs (auth token parsing,
6//!   the wire-level [`ApiErrorResponse`]), and
7//! * a committed [`generated`] module which mirrors the strongly-typed models produced from
8//!   `packages/api-spec/openapi.json` via [`progenitor`](https://github.com/oxidecomputer/progenitor).
9//!
10//! The `generated` module is regenerated on demand with
11//!
12//! ```text
13//! just sdk::core::openapi-gen
14//! ```
15//!
16//! (drift-checked by `just sdk::core::openapi-check`). Default builds do **not** invoke the
17//! generator; the committed file is authoritative and compiled as-is.
18
19#![deny(rust_2018_idioms, missing_debug_implementations)]
20#![warn(clippy::pedantic)]
21#![allow(clippy::module_name_repetitions)]
22
23pub mod error;
24pub mod token;
25
26pub mod generated;
27
28pub use error::ApiErrorResponse;
29pub use token::{API_KEY_SEPARATOR, ApiKey, TokenFormatError};
30
31/// The SDK name we advertise in the `User-Agent` header.
32pub const SDK_NAME: &str = "openapp-sdk";
33
34/// The SDK version (kept in sync with `Cargo.toml`).
35pub const SDK_VERSION: &str = env!("CARGO_PKG_VERSION");