♻️ simplify RAG CRUD - #218
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
It introduces a breaking public API signature change without addressing backward compatibility / change classification, and it also introduces a potential fatal error path via an uninitialized typed static property.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR refactors the V2 RAG document annotation update flow by moving the response-class selection into the annotation parameter objects (instead of passing a response class into each update call), simplifying the CRUD surface area for RAG annotations.
Changes:
- Removed the explicit
$responseClassargument fromClient::updateRagAnnotation()andMindeeApiV2::reqPatchRagAnnotation(), and now deserializes via$params->getResponseClass(). - Introduced a generic
BaseAnnotationParameters<T>with agetResponseClass()accessor. - Updated
RagDocumentAnnotationParametersto declare its associated response class, and updated functional tests accordingly.
File summaries
| File | Description |
|---|---|
| tests/V2/Product/Extraction/RagDocumentsFunctional.php | Updates test calls to updateRagAnnotation() to use the new parameter-driven response class. |
| src/V2/Product/Extraction/RagDocuments/Params/RagDocumentAnnotationParameters.php | Binds the RAG annotation params to ExtractionRagAnnotationResponse via a static response-class field. |
| src/V2/Http/MindeeApiV2.php | Removes $responseClass from reqPatchRagAnnotation() and deserializes using the params’ response class. |
| src/V2/ClientOptions/BaseAnnotationParameters.php | Adds generic response typing and getResponseClass() to parameter objects. |
| src/V2/Client.php | Removes $responseClass from updateRagAnnotation() and adjusts polling path to use the params’ response class. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
Fix the uninitialized upload response class and address the public API compatibility breaks.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
src/V2/Client.php:233
- This removes the first
$responseClassargument from the publicupdateRagAnnotation()method. Existing callers using the previous signature will no longer match this method, making the refactor source-incompatible despite the PR not being marked as breaking. Preserve a compatibility entry point or explicitly version/document the break.
public function updateRagAnnotation(
BaseAnnotationParameters $params
): BaseRagAnnotationResponse {
return $this->mindeeApi->reqPatchRagAnnotation($params);
src/V2/Client.php:342
- Removing the required
$responseClassargument from this public polling method breaks existing calls withupdateAndGetRagAnnotationPoll($responseClass, $params, ...), which now pass a string to theBaseAnnotationParameterstype and fail with aTypeError. This is a breaking API change despite the PR metadata leaving the breaking-change option unchecked; retain a compatibility path or explicitly version and document the break.
public function updateAndGetRagAnnotationPoll(
BaseAnnotationParameters $params,
?PollingOptions $pollingOptions = null,
- Files reviewed: 10/10 changed files
- Comments generated: 4
- Review effort level: Lite
5b6ff88 to
e9386bb
Compare
Description
Types of changes