Skip to content

Commit

Permalink
Add comment document
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn committed Sep 27, 2023
1 parent 0a28392 commit 4dd1d7c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/oapi-generics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ struct MyObject<T: ToSchema + std::fmt::Debug + 'static> {
value: T,
}

/// Use string type, this will add to openapi doc.
#[endpoint]
async fn use_string(body: JsonBody<MyObject<String>>) -> String {
format!("{:?}", body)
}

/// Use i32 type, this will add to openapi doc.
#[endpoint]
async fn use_i32(body: JsonBody<MyObject<i32>>) -> String {
format!("{:?}", body)
}

/// Use u64 type, this will add to openapi doc.
#[endpoint]
async fn use_u64(body: JsonBody<MyObject<u64>>) -> String {
format!("{:?}", body)
Expand Down

0 comments on commit 4dd1d7c

Please sign in to comment.