GREsau / okapi

OpenAPI (AKA Swagger) document generation for Rust projects
MIT License
631 stars 112 forks source link

Tag description #78

Open barvirm opened 2 years ago

barvirm commented 2 years ago

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

ralpha commented 2 years ago

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