Skip to content

Feature Request: Allow binding annotations variables to argument property #124

Description

@renato-macedo

Currently, it is necessary to have an argument for each variable in the header, path or query in rest annotations. So, if we use 3 variables, we must have 3 arguments in the function and so on. I think that allowing values to be received by the properties of a struct argument will make the functions more concise.

Something like:

type CustomHeaders {
    userAgent: string
    lang: string
    token: string
}

type PostInfo {
    author: string
    slug: string
}

@rest GET /{post.author}/posts/{post.slug} [header user-agent: {headers.userAgent}] [header accept-language: {headers.lang}] [header x-token: {headers.token}]
fn getPost(post: PostInfo, headers: CustomHeaders): Post

What do you think? It would take some time, but I believe I can implement this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions