Should the documentation have an example for how to use multiple decoders?
Open
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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