Skip to content

Add description to field #432

Answered by juhaku
josejachuf asked this question in Q&A
Jan 12, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Yes just add a doc comment for your field. Keep in mind that OpenAPI V3 does not support field descriptions on schema ref fields but only in primitive type fields.

#[derive(ToSchema)]
struct Pet {
   id: u64,
   /// This is my field description
   name: String,
   age: Option<i32>,
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@josejachuf
Comment options

Answer selected by josejachuf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants