Skip to content

🥅 better checks for request parameters - #349

Merged
ianardee merged 1 commit into
mainfrom
better-checks
Sep 3, 2026
Merged

🥅 better checks for request parameters#349
ianardee merged 1 commit into
mainfrom
better-checks

Conversation

@ianardee

@ianardee ianardee commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires a change to the official Guide documentation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Client-side validation removal breaks existing test expectations/contract behavior and a few new validations/messages are inconsistent or misleading.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR tightens validation and normalization of request/search parameters across the V2 client surface, aiming to reject invalid inputs earlier and generate cleaner request parameters.

Changes:

  • Added/relocated input validation for search/product parameters (e.g., trimming modelId, rejecting invalid page/perPage).
  • Adjusted request-parameter serialization rules (e.g., when optional fields like name, model_type, alias, filename are included).
  • Moved inferenceId/inferenceUrl validation from MindeeClient into the HTTP API layer (and updated related error messages).
File summaries
File Description
src/main/java/com/mindee/v2/search/ragdocuments/RagDocumentSearchParameters.java Adds stricter modelId/filename checks and trims modelId for RAG document search parameters.
src/main/java/com/mindee/v2/search/models/ModelSearchParameters.java Adds stricter validation and simplifies builder/setter behavior for model search parameters.
src/main/java/com/mindee/v2/MindeeClient.java Removes client-side validation for result retrieval inputs (now delegated to API impl).
src/main/java/com/mindee/v2/http/MindeeHttpApiV2.java Adds validation for inferenceId and refines inferenceUrl validation error messaging.
src/main/java/com/mindee/v2/clientoptions/BaseSearchParameters.java Moves page/perPage validation to constructor to fail earlier than request construction.
src/main/java/com/mindee/v2/clientoptions/BaseProductParameters.java Introduces a validating base constructor (modelId/alias/webhookIds) and changes request parameter inclusion rules.
Review details

Suppressed comments (1)

src/main/java/com/mindee/v2/http/MindeeHttpApiV2.java:157

  • The validation rejects whitespace-only inferenceUrl values (trim().isEmpty()), but the exception message says "null or empty". This can confuse callers passing blanks; consider using isBlank() and updating the message accordingly.
    if (inferenceUrl == null || inferenceUrl.trim().isEmpty()) {
      throw new IllegalArgumentException("inferenceUrl cannot be null or empty.");
    }
  • Files reviewed: 6/6 changed files
  • Comments generated: 7
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main/java/com/mindee/v2/MindeeClient.java
Comment thread src/main/java/com/mindee/v2/MindeeClient.java
Comment thread src/main/java/com/mindee/v2/http/MindeeHttpApiV2.java
@ianardee
ianardee merged commit cee7fe6 into main Sep 3, 2026
14 checks passed
@ianardee
ianardee deleted the better-checks branch September 3, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants