Allow contract composition
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.8k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 41
Description
The feign client can support one contract only, and contracts tend to initialize themselves in the constructor. However, contracts are generally not mutually exclusive, and mixing, let’s say, default and spring contracts is totally possible if one transitions from one contract to another. My current workaround uses reflection and simply merges lists and maps of annotation processors of the two, which works because each contract supports its own set of annotations, so only one processor works at a time. It would be great if feign can provide composite contract out of the box that accept a list of contracts as an argument. The rest already works fine thanks to DeclarativeContract
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 with the contract handling entry point and the referenced DeclarativeContract, then trace how a single contract initializes and exposes its annotation processors. Define the composite contract's input and behavior from the issue, and verify that contracts using distinct annotations can be combined without changing existing single-contract behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100