spring-projects / spring-projects/spring-ai
Refactor APIs to return response body instead of ResponseEntity
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
It seems that all API call result is used for getBody() only, for example:
https://github.com/spring-projects/spring-ai/blob/db9ac2fda48247e38aac2e18b3bde44b9d729b92/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiChatModel.java#L199-L202
I think it's better to return domain object directly instead of spring-web API, make it be parity to method parameters, like ChromaApi does:
https://github.com/spring-projects/spring-ai/blob/db9ac2fda48247e38aac2e18b3bde44b9d729b92/vector-stores/spring-ai-chroma-store/src/main/java/org/springframework/ai/chroma/vectorstore/ChromaApi.java#L128-L137
CAUTION: It's breaking changes.
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 OpenAiChatModel.java at the linked call site and compare its API usage with ChromaApi.java lines 128-137. Inventory the API results that callers use only through getBody(), then trace their callers and tests before assessing the breaking change. Done means the affected APIs return domain objects directly and their callers and tests are updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100