Skip to content

Unable to add custom attributes on fields #600

Open
@Dispersia

Description

@Dispersia

Is your feature request related to a problem? Please describe.
Unable to add custom proc_macro_attribute's to fields, so can't do any rewrite logic

Describe the solution you'd like
juniper::graphql_object to keep custom attributes, not just the graphql(description/deprecation) ones

Describe alternatives you've considered
Having the proc macro go over the entire impl, then defining at the top which fields get rewritten

Additional context
I'm not sure what happens to the field methods, so this may not be possible if it would be transformed in some way. I started going through the codegen, but it's quite a bit at first glance so forgive me if it's not possible.

Example of how some things I would like to do:

struct Query;

#[juniper::graphql_object]
impl Query {
    #[authorize(Policy = policies::Whatever)]
    async fn foo() -> FieldResult<foo> {}
}

and being able to have a partial method rewrite that automatically handles 401/403 type responses

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions