We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For redoc for flatten endpoint I expect some help about the fields:
"other": "flatten", "type": "ValueB", "value": true }
NOTE: the actual output of the endpoint is correct, only the documentation is not!
Cargo.toml
[package] name = "example-openapi-flatten" version.workspace = true edition.workspace = true publish.workspace = true [dependencies] poem = { version="3.1.6" } poem-openapi = { version="5.1.5", features= ["redoc", "swagger-ui"]} tokio = { version = "1.42.0", features = ["macros", "rt-multi-thread"] } tracing-subscriber = {version = "0.3.19" }
Main.rs
use poem::{listener::TcpListener, Route, Server}; use poem_openapi::{ param::Query, payload::{Json, PlainText}, Object, OpenApi, OpenApiService, Union, }; struct Api; #[derive(Object)] struct ValueA { pub value: bool, } #[derive(Object)] struct ValueB { pub value: bool, } #[derive(Union)] #[oai(one_of = true, discriminator_name = "type")] enum UnionEnum { ValueA(ValueA), ValueB(ValueB), } #[derive(Object)] struct Flatten { #[oai(flatten)] inner: UnionEnum, other: String, } #[OpenApi] impl Api { #[oai(path = "/flatten", method = "get")] async fn flatten(&self) -> Json<Flatten> { Json(Flatten { inner: UnionEnum::ValueB(ValueB { value: true }), other: "flatten".into(), }) } } #[tokio::main] async fn main() -> Result<(), std::io::Error> { if std::env::var_os("RUST_LOG").is_none() { std::env::set_var("RUST_LOG", "poem=debug"); } tracing_subscriber::fmt::init(); let api_service = OpenApiService::new(Api, "Hello World", "1.0").server("http://localhost:3000/api"); let ui = api_service.redoc(); Server::new(TcpListener::bind("0.0.0.0:3000")) .run(Route::new().nest("/api", api_service).nest("/", ui)) .await }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Expected Behavior
For redoc for flatten endpoint I expect some help about the fields:
NOTE: the actual output of the endpoint is correct, only the documentation is not!
Actual Behavior
Steps to Reproduce the Problem
Cargo.toml
Main.rs
Specifications
The text was updated successfully, but these errors were encountered: