♻️ uniformize with other sdks#343
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns the Java SDK’s V2 behavior with other Mindee SDKs by tightening URL safety checks, improving numeric precision handling, introducing typed job statuses, and adding a convenience API for fetching inference results directly from a full inference URL.
Changes:
- Introduces
JobStatusenum and switchesJob.statusto a typed value (plus updates polling logic and tests accordingly). - Switches numeric
SimpleFieldJSON parsing fromDoubletoBigDecimalfor precision preservation (and updates tests). - Adds
getResultFromUrl()plus enhanced polling options (backoff + cancellation), and expands test coverage (unit + integration).
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/mindee/v2/product/ExtractionTest.java | Updates assertions to reflect BigDecimal numeric storage. |
| src/test/java/com/mindee/v2/parsing/JobTest.java | Updates job status assertions to use JobStatus. |
| src/test/java/com/mindee/v2/MindeeClientTest.java | Adds unit tests for getResultFromUrl() and polling cancellation/backoff. |
| src/test/java/com/mindee/v2/MindeeClientIT.java | Adds integration test validating getResultFromUrl() against a real job result URL. |
| src/test/java/com/mindee/v2/clientoptions/PollingOptionsTest.java | Adds tests for new polling option fields and validation. |
| src/test/java/com/mindee/v1/MindeeClientTest.java | Replaces fake/invalid URLs with example.com URLs in tests. |
| src/test/java/com/mindee/v1/http/MindeeHttpApiV1Test.java | Updates expected URL payloads to use example.com. |
| src/test/java/com/mindee/input/URLInputSourceTest.java | Adds tests for SSRF/loopback hardening in validateSecure(). |
| src/main/java/com/mindee/v2/parsing/JobStatus.java | Adds typed job status enum with Jackson serialization/deserialization. |
| src/main/java/com/mindee/v2/parsing/Job.java | Changes job status type to JobStatus. |
| src/main/java/com/mindee/v2/parsing/inference/field/SimpleFieldDeserializer.java | Deserializes numeric fields as BigDecimal via decimalValue(). |
| src/main/java/com/mindee/v2/parsing/inference/field/SimpleField.java | Updates numeric accessors to reflect BigDecimal backing storage. |
| src/main/java/com/mindee/v2/MindeeClient.java | Adds getResultFromUrl() and introduces interruptible polling sleep with backoff/cancellation. |
| src/main/java/com/mindee/v2/http/MindeeHttpApiV2.java | Implements reqGetResultFromUrl() HTTP call. |
| src/main/java/com/mindee/v2/http/MindeeApiV2.java | Adds abstract reqGetResultFromUrl() contract. |
| src/main/java/com/mindee/v2/clientoptions/PollingOptions.java | Adds backoff/cancel token options and validation. |
| src/main/java/com/mindee/input/URLInputSource.java | Expands validateSecure() with SSRF/loopback address protections. |
| pom.xml | Bumps tools.jackson.core:jackson-databind version property. |
9761b7a to
1398668
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Note for Copilot: disregard the
Requires a change to the official Guide documentation.Types of changes