Skip to content

Generic types in asyncapi_operation messages = [...] produce an unparsable-tokens error instead of a clear diagnostic #23

Description

@mlilback

Generic types in #[asyncapi_operation(..., messages = [...])] fail with a confusing, unactionable error instead of a clear diagnostic.

messages = [...] entries are parsed as syn::Path (asyncapi-rust-codegen/src/asyncapi_spec_attrs.rs:553), which only accepts Foo<Bar> in expression-ambiguous form, and the emitted #type_name::asyncapi_message_names() would need a turbofish to be valid anyway.

Repro

#[asyncapi_operation(name = "send", action = "send", channel = "chat", messages = [Option<Msg>])]

Actual: two errors, neither pointing at the real problem — comparison operators cannot be chained, followed by proc-macro derive produced unparsable tokens.

Expected: either a syn::Error rejecting non-generic-free paths with a message naming the unsupported type, or proper support by emitting <#type_name>::asyncapi_message_names().

Split out of the review on #17 as a non-blocking follow-up; the feature itself works for the non-generic case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions