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

Name override for PathVariable being ignored #1737

Closed
efgpinto opened this issue Jul 20, 2023 · 0 comments · Fixed by #1742
Closed

Name override for PathVariable being ignored #1737

efgpinto opened this issue Jul 20, 2023 · 0 comments · Fixed by #1742
Assignees
Labels
bug Something isnt working java-sdk kalix-runtime Runtime and SDKs sub-team

Comments

@efgpinto
Copy link
Member

As reported by a user on slack:

I have this action

@RequestMapping("/station/{station_id}")
public class ApiControllerAction extends Action {

@PostMapping("/register")
public Effect<String> registerStation(@PathVariable("station_id") String stationId,
                   @RequestBody StationRegistrationRequest registration) {
…
}
}

When starting, Kalix throws this error:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [kalix.spring.impl.KalixSpringApplication]: Factory method 'kalixSpringApplication' threw exception with message: Missing field descriptor for field name: stationId

When I rename the argument to “station_id” (so it matches the value of the @PathVariable annotation), it works fine, but this defeats the purpose of this annotation off-course. I guess the argumentName needs to match the variable in the @RequestMapping, and the value of the @PathVariable annotation is just not used.
This is not intuitive for people familiar with those spring web annotations.

@efgpinto efgpinto added bug Something isnt working kalix-runtime Runtime and SDKs sub-team java-sdk labels Jul 20, 2023
@aludwiko aludwiko self-assigned this Jul 24, 2023
@aludwiko aludwiko linked a pull request Jul 24, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isnt working java-sdk kalix-runtime Runtime and SDKs sub-team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants