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.
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:
What do you think? It would take some time, but I believe I can implement this.