OpenFeign / OpenFeign/feign

@QueryMap does not work with POJOs when used after @Param

Open
#852 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

This kind of code (from https://github.com/OpenFeign/feign/pull/335/files#diff-13815c678552a275075ab18b17c67784R616):

@RequestLine("GET /?name={name}")
void queryMapWithQueryParams(@Param("name") String name, @QueryMap Map<String, Object> queryMap);

Does not work when @QueryMap is used on a POJO.

In my case, I was trying to use Spring's Pageable like so:

@RequestLine("GET /things?x={x}&y={y}&z={z}")
CustomPageImpl<ThingDto> getElements(
    @Param("x") ZonedDateTime x,
    @Param("y") String y,
    @Param("z") String z,
    @QueryMap Pageable pageable);

By the way... Is there any simpler way to declare query parameters without having to refer four times to their names?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied @QueryMap POJO and Spring Pageable cases after an @Param, then read the RequestLine, @Param, and @QueryMap handling. Done means POJO query properties work regardless of parameter order, with regression coverage for the shown signatures; the question about simpler declarations is separate.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.