Skip to content

Detecting ToSchema fails when behind a cfg_attr flag #13

@tedbennett

Description

@tedbennett

Hi! 👋

I'm playing around with this crate and ran into an issue where schemas (and I'm guessing paths) aren't detected when behind a cfg_attr flag. E.g:
Works:

#[derive(ToSchema)]
struct Todo {
  // ...
}

Doesn't work:

#[cfg_attr(feature = "openapi", derive(ToSchema))]
struct Todo {
  // ...
}

Essentially, my use case is to only generate the OpenAPI spec when writing it to a file in my CI step, and I don't want to have to compile all my utoipa macros when running the webserver normally.

Thanks for the library, it's really nice!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions