Skip to content

Declarative client with @RequestBean and @PathVariable not working #4666

Closed
@TorosyanV

Description

When I'm using declarative client with @RequestBean and @PathVariable generated path is wrong,
provided @PathVariable is missing.

Expected Behaviour

When I have client like this

@Client("https://myapi.com")
public interface ClientApi {

 @Get(value = "/users/{userName}")
 Flowable<User> getUser(@RequestBean GetUserRequest bean);

}

and have POJO is

@Introspected
public class GetUserRequest {

  @PathVariable
  private String userName;

  public String getUserName() {
    return userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }

}

Should be Send HTTP Request: GET /users/someUserName

Actual Behaviour

Where is no any PathVariable after /users
example from logs
[default-nioEventLoopGroup-1-4] DEBUG i.m.h.client.netty.DefaultHttpClient - Sending HTTP Request: GET /users/

Environment Information

  • Operating System: macOS
  • Micronaut Version: 2.1.3
  • JDK Version: 11

But this example is working

@Get(value = "/users/{userName}")
Flowable<User> getUser(@PathVariable String userName);

output from logs
[default-nioEventLoopGroup-1-4] DEBUG i.m.h.client.netty.DefaultHttpClient - Sending HTTP Request: GET /users/someUserName
I don't know it's a bug or this feature is not supported. But it will be better to support such simple things, otherwise Declarative client is useless .

Metadata

Assignees

Labels

type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions