tamasfe/aide

Support for x-tagGroups

imran-mirza79 opened this issue · 4 comments

How can I achieve the following
x-tagGroups

Use tag method of TransformOperation. The example in the repo show case this.

.tag(Tag {
name: "todo".into(),
description: Some("Todo Management".into()),
..Default::default()
})

Another example

fn test_fn_docs(op: TransformOperation) -> TransformOperation {
  op.description("Test fn.").tag("Test Tag")
}

let app = ApiRouter::new()
    .api_route("/api/test_fn", routing::get_with(test_fn, test_fn_docs))
   // ...

I am already using this tag method. I want group it, as highlighted in red box in the image.

Screenshot from this link: x-tagGroups

image

Oh it is a "group" of other tags. I could be wrong but I don't think I have seen this option in aide. I did a quick google search on this, and I think this is a redoc specific feature and not part of OpenAPI Specification.

you can add x-tagGroups like this:

use serde_json::json;
use aide::openapi::OpenApi; 

let mut api: OpenApi = ...; // get the api struct that you initialize at the start, and where you finish the api into.
api.extensions.insert("x-tagGroups".into(), json!({
    "name": "My Group", 
    "tags": ["tag1", "tag2", "etc..."]
}));