Skip to content

Description on struct field #1466

@Myslawek

Description

@Myslawek

The documentation (https://docs.rs/utoipa/latest/utoipa/derive.ToSchema.html#named-field-struct-optional-configuration-options-for-schema) states that it is possible to have description on the field. However when trying to annotate a struct field with:

#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
#[derive(ToSchema)]
pub struct SomeRequest {
    #[schema(
        example = "John",
        description = "First name for the requester",
    )]
    name: String,
}

It results in an error, when compiling:

error: unexpected attribute: description, expected any of: example, examples, 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, content_encoding, content_media_type, ignore, no_recursion
  --> src/lib.rs:79:9
   |
79 |         description = "a game for which the optimization should be done"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions