Skip to content
New issue

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

Add support for real generics #1034

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions examples/generics-actix/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ fn get_coord_schema<T: PartialSchema>() -> Object {
}

#[derive(Serialize, ToSchema)]
#[aliases(MyFloatObject = MyObject<f64>, MyIntegerObject = MyObject<u64>)]
pub struct MyObject<T: geo_types::CoordNum + PartialSchema> {
#[schema(schema_with=get_coord_schema::<T>)]
at: geo_types::Coord<T>,
Expand All @@ -45,7 +44,7 @@ pub struct FloatParams {
FloatParams
),
responses(
(status = 200, description = "OK", body = MyFloatObject),
(status = 200, description = "OK", body = MyObject<f64>),
),
security(
("api_key" = [])
Expand Down Expand Up @@ -75,7 +74,7 @@ pub struct IntegerParams {
IntegerParams,
),
responses(
(status = 200, description = "OK", body = MyIntegerObject),
(status = 200, description = "OK", body = MyObject<u64>),
),
security(
("api_key" = [])
Expand All @@ -99,7 +98,7 @@ async fn main() -> Result<(), impl Error> {
#[derive(OpenApi)]
#[openapi(
paths(coord_f64, coord_u64),
components(schemas(MyFloatObject, MyIntegerObject))
components(schemas(MyObject<f64>, MyObject<u64>))
)]
struct ApiDoc;

Expand Down
Loading
Loading