@@ -299,6 +299,73 @@ pub async fn get_user(id: u32) -> Json<User> {
299299}
300300```
301301
302+ ### Tags and Description
303+
304+ You can add tags and descriptions to your routes for better OpenAPI documentation organization.
305+
306+ #### Tags
307+
308+ Use the ` tags ` parameter to group your routes in the OpenAPI documentation:
309+
310+ ``` rust
311+ #[vespera:: route(get, tags = [" users" ])]
312+ pub async fn list_users () -> Json <Vec <User >> {
313+ // ...
314+ }
315+
316+ #[vespera:: route(post, tags = [" users" , " admin" ])]
317+ pub async fn create_user (Json (user ): Json <User >) -> Json <User > {
318+ // ...
319+ }
320+ ```
321+
322+ #### Description
323+
324+ There are two ways to add descriptions to your routes:
325+
326+ ** 1. Using doc comments (recommended):**
327+
328+ Doc comments (` /// ` ) are automatically extracted and used as the route description in OpenAPI:
329+
330+ ``` rust
331+ /// Get all users from the database
332+ ///
333+ /// Returns a list of all registered users.
334+ #[vespera:: route(get)]
335+ pub async fn list_users () -> Json <Vec <User >> {
336+ // ...
337+ }
338+ ```
339+
340+ ** 2. Using the ` description ` parameter:**
341+
342+ You can also explicitly set the description using the ` description ` parameter. This takes priority over doc comments:
343+
344+ ``` rust
345+ /// This doc comment will be ignored
346+ #[vespera:: route(get, description = " Custom description for OpenAPI" )]
347+ pub async fn list_users () -> Json <Vec <User >> {
348+ // ...
349+ }
350+ ```
351+
352+ #### Combined Example
353+
354+ ``` rust
355+ /// Get user by ID
356+ ///
357+ /// Retrieves a specific user by their unique identifier.
358+ #[vespera:: route(get, path = " /{id}" , tags = [" users" ])]
359+ pub async fn get_user (Path (id ): Path <u32 >) -> Json <User > {
360+ // ...
361+ }
362+
363+ #[vespera:: route(post, tags = [" users" , " admin" ], description = " Create a new user account" )]
364+ pub async fn create_user (Json (user ): Json <User >) -> Json <User > {
365+ // ...
366+ }
367+ ```
368+
302369### Supported HTTP Methods
303370
304371- ` GET `
0 commit comments