utoipauto icon indicating copy to clipboard operation
utoipauto copied to clipboard

Customize reported path

Open jssblck opened this issue 9 months ago • 0 comments

Hey, awesome library! In #2, a user asked to have full paths reported; but I want the opposite: I want to be able to customize the path so that the full thing isn't reported.

For example, if I add paths manually, this works- but I don't see a way to both auto-discover and not have the full path displayed.

In the below example (using Scalar to render the docs), the main ApiDoc is configured like so:

// Note: the below code snippet is inside `crate::api`.

#[utoipauto] // <-- This autodiscovers `crate::api::v1::ping`
#[derive(OpenApi)]
#[openapi(info(description = include_str!("../README.md")), paths(
    v0::health::handle, // <-- This is also autodiscovered, but overridden
))]
struct ApiDoc;

The manually added route correctly (for my preferences anyway) appears relative, but the autodiscovered one has the full path; I'm wondering if there's a way to override this behavior to make the path relative.

Screenshot 2024-05-16 at 4 41 58 PM

Thanks for your time!

jssblck avatar May 16 '24 23:05 jssblck