Skip to content

Allow module paths in modifiers(...) - #1657

Open
thelastbackspace wants to merge 2 commits into
juhaku:masterfrom
thelastbackspace:fix/1430-modifiers-path
Open

thelastbackspace wants to merge 2 commits into
juhaku:masterfrom
thelastbackspace:fix/1430-modifiers-path

Conversation

@thelastbackspace

Copy link
Copy Markdown

#[openapi(modifiers(&somewhere::SecurityAddon))] didn't compile ("expected ,") because each modifier was parsed as a bare Ident, so only modifiers(&SecurityAddon) with the type imported into scope worked.

I changed Modifier to parse a syn::Path instead, so &module::Addon, &crate::module::Addon etc. work the same as the bare form. The bare form is still just a one-segment path, so nothing changes for existing users.

Added a test in modify_test.rs that uses a modifier from a nested module. It fails to compile without the change and passes with it. The rest of the utoipa-gen tests pass with the feature set from the justfile.

Fixes #1430

modifiers(&module::Addon) failed to parse because each modifier was
parsed as a single Ident. Parse a syn::Path instead so module-qualified
modifiers work the same as the bare form.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed 'modifiers' namespace pattern matching

1 participant