okapi icon indicating copy to clipboard operation
okapi copied to clipboard

Tag description

Open barvirm opened this issue 3 years ago • 1 comments

Is it possible to create a tag description with the current API?

barvirm avatar Mar 09 '22 13:03 barvirm

Tags, yes Tag description, no, not using a macro at least.

You can merge multiple OpenAPI specs like here: https://github.com/GREsau/okapi/blob/master/examples/custom_schema/src/main.rs#L61 or using https://docs.rs/rocket_okapi/0.8.0-rc.1/rocket_okapi/macro.openapi_get_routes_spec.html Just add your tags and there description. https://github.com/GREsau/okapi/blob/e686b442d6d7bb30913edf1bae900d14ea754cb1/okapi/src/openapi3.rs#L59

OpenApi {
    tags: vec![
        Tag {
            name: "Message".to_owned(),
            description: Some("Here is my desc".to_owned()),
        },
        // ...
    ]
}

If you want to add this using macros, PR's are welcome see: https://github.com/GREsau/okapi/blob/e686b442d6d7bb30913edf1bae900d14ea754cb1/rocket-okapi-codegen/src/openapi_attr/mod.rs#L19-L24

ralpha avatar Mar 11 '22 21:03 ralpha