Registry / web-framework / poem-openapi

poem-openapi

JSON →
library5.1.16rscratesunverified

OpenAPI support for the Poem web framework.

# Cargo.toml [dependencies] poem-openapi = "5.1.16"
INSTALL
IMPORT
SIG · POEM-OPENAPI
P
poem-openapi
web-frameworkrustv5.1.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OpenApi
use poem_openapi::OpenApi;

Define an OpenAPI endpoint using Poem.

use poem_openapi::{OpenApi, payload::PlainText}; struct Api; #[OpenApi] impl Api { #[oai(path = "/hello", method = "get")] async fn hello(&self) -> PlainText<String> { PlainText("Hello, world!".to_string()) } } fn main() { let api_service = poem_openapi::OpenApiService::new(Api) .title("My API") .server("http://localhost:3000"); println!("OpenAPI service created"); }
Debug
Known issues
gotchaRequires the `poem` runtime and async runtime (e.g., Tokio).
fix
Add `poem` and `tokio` as dependencies and use `#[tokio::main]`.
affects: >=5.0.0
Upgrade
Version history
5.1.16latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
Bingbot
1
Resources
poem-openapi — cargo add poem-openapi · libregistry