Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @Path parameter name as default value #426

Closed
Foso opened this issue Sep 25, 2023 · 0 comments · Fixed by #427
Closed

Use @Path parameter name as default value #426

Foso opened this issue Sep 25, 2023 · 0 comments · Fixed by #427
Assignees
Labels
enhancement New feature or request

Comments

@Foso
Copy link
Owner

Foso commented Sep 25, 2023

Is your feature request related to a problem? Please describe.
The Path annotation always needs a value which in some cases might be the same as the parameter name.
@GET("posts/{postId}") suspend fun getPostById(@Path("postId") postId: Int = 4): Post

Describe the solution you'd like
We can improve this by setting a defaultValue for value. When the default is not changed, the parameter name will be used as the value. When the default is changed, that value will be used. Everything else stays the same

@GET("posts/{postId}") suspend fun getPostById(@Path postId: Int = 4): Post

@Foso Foso added the enhancement New feature or request label Sep 25, 2023
@Foso Foso self-assigned this Sep 25, 2023
Foso added a commit that referenced this issue Sep 25, 2023
Foso added a commit that referenced this issue Sep 25, 2023
@Foso Foso linked a pull request Sep 25, 2023 that will close this issue
1 task
@Foso Foso closed this as completed in #427 Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant