juhaku / utoipa

Simple, Fast, Code first and Compile time generated OpenAPI documentation for Rust
Apache License 2.0
2.23k stars 173 forks source link

Schema name configuration #899

Closed squadgazzz closed 3 weeks ago

squadgazzz commented 5 months ago

According to the docs, there is no way to use a different from the struct name in the openaapi doc, like:

#[derive(ToSchema)]
#[schema(name = "Dog")]
pub struct DogSchema;

Which should generate schema Dog instead of DogSchema.

juhaku commented 4 months ago

According to the docs, there is no way to use a different from the struct name in the openaapi doc, like:

#[derive(ToSchema)]
#[schema(name = "Dog")]
pub struct DogSchema;

Which should generate schema Dog instead of DogSchema.

True, there is no separate attribute for that but as = Dog should be possible. E.g.

#[derive(ToSchema)]
#[schema(as = Dog)]
pub struct DogSchema;
juhaku commented 3 weeks ago

Closing due inactivity. Can be reopened if deemed necessary.