OpenFeign / OpenFeign/feign

Should the documentation have an example for how to use multiple decoders?

Open
#1,249 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In my implementation I need to use the default decoder for byte[] and GsonDecoder to map to objects and I'm doing the following in Java 11:

@Bean
    public Decoder decoder() {
        Decoder decoder = (response, type) -> {
            if (type.getTypeName().equals("java.lang.String") ||
                    type.getTypeName().equals("byte[]")
            ) {
                return new Decoder.Default().decode(response, type);
            } else {
                return new GsonDecoder().decode(response, type);
            }
        };
        return new ResponseEntityDecoder(decoder);
    }

Is this worth having an example in the documentation? I was inspired by this discussion https://github.com/spring-cloud/spring-cloud-netflix/issues/2246

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 locating the existing decoder documentation and examples, then review how custom Decoder configuration is currently explained. Add an example covering separate handling for byte[] or String values and object decoding, and confirm the documentation clearly explains when the example applies.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.