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

Support for Description in Schema attribute #900

Closed abdullahabro closed 5 months ago

abdullahabro commented 5 months ago

Not able to add description to a particular attribute in a struct using schema attrtibute

#[derive(Serialize, Deserialize, ToSchema, Clone)]
pub struct CreateOrderRequest {
    #[schema(example = "abc-123", description = "unique identifier assigned to the client")]
    pub client_id: String
    }

Getting error

unexpected attribute: description, expected any of: example, value_type, format, default, write_only, read_only, xml, inline, nullable, rename, multiple_of, maximum, minimum, exclusive_maximum, exclusive_minimum, max_length, min_length, pattern, max_items, min_items, schema_with, additional_properties, required, deprecated
juhaku commented 5 months ago

The description comes from the comment of the field https://docs.rs/utoipa/latest/utoipa/derive.ToSchema.html.

abdullahabro commented 5 months ago

@juhaku thanks for letting me know , i completely missed it