Skip to content

SDK-2787: .NET - Add support for retrieving the extraction_image_ids field from the IDV pages - dotnet#552

Open
mehmet-yoti wants to merge 1 commit into
developmentfrom
websdk-auto/SDK-2787-dotnet-add-support-for-retrieving-the-extraction-image-ids-field-from-the-idv-pages
Open

SDK-2787: .NET - Add support for retrieving the extraction_image_ids field from the IDV pages - dotnet#552
mehmet-yoti wants to merge 1 commit into
developmentfrom
websdk-auto/SDK-2787-dotnet-add-support-for-retrieving-the-extraction-image-ids-field-from-the-idv-pages

Conversation

@mehmet-yoti

Copy link
Copy Markdown
Contributor

Now I have everything I need. The core change is a one-property addition to PageResponse.cs, with the rest of the diff being whitespace normalization (tab-to-spaces) across many files bundled in the same commit.

Summary

Adds support for deserializing the extraction_image_ids field returned in IDV page responses from the Yoti Doc Scan API. The PageResponse model gains a new ExtractionImageIds property (List<string>) that maps to the extraction_image_ids JSON field, defaulting to an empty list when the field is absent. The commit also includes a broad whitespace normalization sweep (tab-to-spaces) across many source and test files.

Changes

  • src/Yoti.Auth/DocScan/Session/Retrieve/PageResponse.cs — Added ExtractionImageIds property (List<string>, JSON key extraction_image_ids), initialized to an empty list to avoid null-reference issues when the field is omitted by the API.
  • test/Yoti.Auth.Tests/DocScan/Session/Retrieve/Check/CheckResponseTests.cs — Added four new unit tests covering:
    • Single ID in the array
    • Multiple IDs in the array
    • Empty array (extraction_image_ids: [])
    • Field entirely absent from the JSON payload
  • Whitespace/formatting (85 files) — Indentation normalized from tabs to spaces across src/, test/, and examples/ to align with the project's style convention. No functional changes in these files.

QA Test Steps

Setup

  1. Check out branch websdk-auto/SDK-2787-dotnet-add-support-for-retrieving-the-extraction-image-ids-field-from-the-idv-pages.
  2. Build the solution: dotnet build.
  3. Run the test suite to confirm all new and existing tests pass: dotnet test.

Unit test verification
4. In the test output, confirm these four new tests pass in CheckResponseTests:

  • CheckPageResponseExtractionImageIdsParsedWithSingleId
  • CheckPageResponseExtractionImageIdsParsedWithMultipleIds
  • CheckPageResponseExtractionImageIdsDefaultsToEmptyListWhenEmptyArray
  • CheckPageResponseExtractionImageIdsDefaultsToEmptyListWhenFieldAbsent

Happy path — field present
5. Create a Doc Scan session that results in an IDV page resource containing an extraction_image_ids array (requires a live/sandbox environment that returns this field).
6. Call GetSession and navigate to Resources → IdDocumentResource → Pages[n].ExtractionImageIds.
7. Confirm the list contains the expected image ID strings (UUIDs).

Edge case — field absent
8. Call GetSession for a session whose page resources do not yet include extraction_image_ids (e.g., an in-progress session).
9. Confirm PageResponse.ExtractionImageIds is a non-null empty list rather than null.

Regression checks
10. Confirm existing PageResponse properties (CaptureMethod, Media, Frames) are still populated correctly after deserialization.
11. Run the full test suite and confirm no pre-existing tests were broken by the whitespace normalization changes.

Notes

  • ExtractionImageIds is deliberately initialized to new List<string>() so callers can safely iterate it without a null check, regardless of whether the API populates the field.
  • The property setter is private set (populated only via JSON deserialization), consistent with other read-only response properties in the model.
  • The whitespace normalization changes are purely cosmetic; no logic was altered in those files. Reviewers can use git diff -w development...HEAD to see only the functional change.
  • This adds a read-only surface — no breaking changes to existing consumers of PageResponse.

Related Jira: SDK-2787
Auto-generated by n8n + Claude CLI

@mehmet-yoti

Copy link
Copy Markdown
Contributor Author

🤖 Claude Code Review

Code Review Findings

The substantive change for SDK-2787 is a single new property on PageResponse plus four new tests. The vast majority of files in the diff (~82 files) contain only line-ending/whitespace churn with no logical change — confirmed via git diff --ignore-all-space, which reduces the real diff to just PageResponse.cs, GlobalSuppressions.cs, and CheckResponseTests.cs.

Critical

None

Major

None

Minor

  • src/Yoti.Auth/DocScan/Session/Retrieve/PageResponse.cs:21 — Setter accessibility inconsistent with sibling collection properties.
    The new property uses private set, while the other collection on the same class (Frames, line 18) and the established convention for initialized collection properties in this namespace use internal set (e.g. ResourceContainer.SupplementaryDocuments and SupplementaryDocResourceResponse.Pages, which are the closest analogues — both internal set and initialized to new List<>()). Newtonsoft.Json sets private setters fine, so deserialization works; the issue is consistency and testability — internal set (combined with InternalsVisibleTo, which this SDK uses for its test project) lets tests construct instances directly, whereas private set forces all test setup through JSON round-tripping.
    Suggested fix: align with the sibling pattern:

    [JsonProperty(PropertyName = "extraction_image_ids")]
    public List<string> ExtractionImageIds { get; internal set; } = new List<string>();
  • test/.../Check/CheckResponseTests.cs:194-265 — Explicit null JSON value not covered.
    The four new tests cover single id, multiple ids, empty array, and absent field. One gap: the "defaults to empty list" guarantee is not exercised for an explicit JSON null ("extraction_image_ids": null). With Newtonsoft's default settings, an explicit null token overwrites the property initializer, leaving the property null and defeating the never-null contract — most likely to cause NREs if the API can emit this.
    Suggested fix: add a test deserializing "extraction_image_ids": null and assert the expected behavior; if the contract is "never null," add NullValueHandling = NullValueHandling.Ignore to the JsonProperty attribute so the initializer is preserved:

    [JsonProperty(PropertyName = "extraction_image_ids", NullValueHandling = NullValueHandling.Ignore)]

Nit

  • src/Yoti.Auth/DocScan/Session/Retrieve/PageResponse.cs:23 — Missing trailing newline (\ No newline at end of file). Minor, but worth fixing to avoid spurious diffs.

  • Whitespace/line-ending churn across ~82 files. The diff is dominated by EOL changes unrelated to SDK-2787 (e.g. all RequestedWatchlist*, YotiClientEngineTests.cs with 608 changed lines, etc.). This makes the PR hard to review and risks masking real changes. Recommend ensuring .gitattributes/editor EOL settings match the repo so the PR contains only the three functional files.


What's done well: JSON property name extraction_image_ids and List<string> type correctly match the IDV API contract; new List<string>() default protects against null on the common absent-field path; tests are well-structured with deterministic fixtures and appropriate CollectionAssert.AreEqual (order-sensitive, correct for a list); the property is placed on PageResponse, the correct model.

Overall: Approved with comments — the feature is correct. Before merging, consider private setinternal set for consistency, add the explicit-null test + NullValueHandling.Ignore to fully guarantee the never-null contract, and strip unrelated whitespace churn from the PR.

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.

Pull request overview

Adds support in the Doc Scan retrieval models for deserializing the extraction_image_ids field on IDV page responses, with accompanying unit tests. The remainder of the PR is largely formatting-only (tab-to-spaces / whitespace normalization) across source, test, and example projects.

Changes:

  • Add PageResponse.ExtractionImageIds mapped to extraction_image_ids in JSON.
  • Add unit tests validating extraction_image_ids parsing and empty-list default behavior when absent/empty.
  • Normalize whitespace/indentation across many files (no intended behavioral changes).

Reviewed changes

Copilot reviewed 3 out of 85 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/Yoti.Auth.Tests/YotiClientEngineTests.cs Whitespace/indentation normalization only.
test/Yoti.Auth.Tests/TestTools/ShareSession.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/TestData/IdentityProfiles.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/ShareUrl/Policy/DynamicPolicyBuilderTests.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/ShareUrl/DynamicScenarioBuilderTests.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/DocScan/Session/Retrieve/GetSessionResultTests.cs Whitespace/indentation normalization only.
test/Yoti.Auth.Tests/DocScan/Session/Retrieve/Check/CheckResponseTests.cs Adds unit tests for PageResponse.ExtractionImageIds.
test/Yoti.Auth.Tests/DocScan/Session/Create/SessionSpecificationBuilderTests.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/DocScan/Session/Create/NotificationConfigTests.cs Formatting cleanup (spacing in initializers).
test/Yoti.Auth.Tests/DocScan/Session/Create/Check/RequestedWatchlistScreeningCheckBuilderTests.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/DocScan/DocScanClientTests.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/DigitalIdentityClientTests.cs Formatting cleanup only.
test/Yoti.Auth.Tests/DigitalIdentityClientEngineTests.cs Whitespace/indentation normalization only.
test/Yoti.Auth.Tests/DigitalIdentity/ShareSessionRequestBuilderTests.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/DigitalIdentity/RequirementNotMetDetails.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/DigitalIdentity/QrRequestBuilderTests.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/DigitalIdentity/Policy/DynamicPolicyBuilderTests.cs Removes trailing whitespace only.
test/Yoti.Auth.Tests/CryptoEngineTests.cs Removes trailing whitespace only.
src/Yoti.Auth/Web/RequestBuilder.cs Formatting cleanup only.
src/Yoti.Auth/ShareUrl/Policy/WantedAttributeBuilder.cs Removes trailing whitespace only.
src/Yoti.Auth/ShareUrl/Policy/DynamicPolicyBuilder.cs Removes trailing whitespace only.
src/Yoti.Auth/ShareUrl/Policy/DynamicPolicy.cs Fixes spacing in class declaration + whitespace cleanup.
src/Yoti.Auth/GlobalSuppressions.cs Splits combined suppression attributes into separate lines (formatting); highlights duplicated suppression entry.
src/Yoti.Auth/Exceptions/YotiProfileException.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Resource/LivenessResourceResponse.cs Trailing whitespace cleanup only.
src/Yoti.Auth/DocScan/Session/Retrieve/PageResponse.cs Adds ExtractionImageIds property mapped to extraction_image_ids.
src/Yoti.Auth/DocScan/Session/Retrieve/IdentityProfile/FailureReasonResponse.cs Removes trailing whitespace only.
src/Yoti.Auth/DocScan/Session/Retrieve/GetSessionResult.cs Removes trailing whitespace only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummaryReportBaseCheckResponse.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/WatchlistScreeningConfig.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/WatchlistAdvancedCaSearchConfigResponseYotiAccount.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/WatchlistAdvancedCaSearchConfigResponseCustomAccount.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/WatchlistAdvancedCaSearchConfigResponse.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/TypeListSourcesResponse.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/SearchProfileSourcesResponse.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/ReportResponseWithSummary.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/RawResults.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/ISearchConfig.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/FuzzyMatchingStrategyResponse.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/ExactMatchingStrategyResponse.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/CaSourcesResponse.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/WatchlistSummary/CaMatchingStrategyResponse.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/Check/ProfileCheckResponse.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Retrieve/AdvancedIdentityProfile/FailureReasonResponse.cs Formatting cleanup only.
src/Yoti.Auth/DocScan/Session/Create/SessionSpecificationBuilder.cs Removes trailing whitespace only.
src/Yoti.Auth/DocScan/Session/Create/SessionSpecification.cs Removes trailing whitespace only.
src/Yoti.Auth/DocScan/Session/Create/SdkConfigBuilder.cs Trailing whitespace cleanup only.
src/Yoti.Auth/DocScan/Session/Create/NotificationConfigBuilder.cs Trailing whitespace cleanup only.
src/Yoti.Auth/DocScan/Session/Create/Check/RequestedWatchlistScreeningCheckBuilder.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Create/Check/RequestedWatchlistAdvancedCaCheckBuilder.YotiAccount.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Create/Check/RequestedWatchlistAdvancedCaCheckBuilder.CustomAccount.cs Removes trailing whitespace only.
src/Yoti.Auth/DocScan/Session/Create/Check/RequestedWatchlistAdvancedCaCheckBuilder.cs Removes trailing whitespace only.
src/Yoti.Auth/DocScan/Session/Create/Check/RequestedFaceComparisonCheckBuilder.cs Removes trailing whitespace only.
src/Yoti.Auth/DocScan/Session/Create/Check/Advanced/RequestedWatchlistAdvancedCaConfigYotiAccount.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Create/Check/Advanced/RequestedWatchlistAdvancedCaConfigCustomAccount.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Create/Check/Advanced/RequestedTypeListSources.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Create/Check/Advanced/RequestedSearchProfileSources.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Create/Check/Advanced/RequestedFuzzyMatchingStrategy.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Create/Check/Advanced/RequestedCaSources.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/Session/Create/Check/Advanced/RequestedCaMatchingStrategy.cs Whitespace/indentation normalization only.
src/Yoti.Auth/DocScan/DocScanService.cs Formatting cleanup only.
src/Yoti.Auth/DigitalIdentityClientEngine.cs Formatting cleanup only.
src/Yoti.Auth/DigitalIdentityClient.cs Formatting cleanup only.
src/Yoti.Auth/DigitalIdentity/ShareSessionResult.cs Removes trailing whitespace only.
src/Yoti.Auth/DigitalIdentity/ShareSessionRequest.cs Formatting cleanup only.
src/Yoti.Auth/DigitalIdentity/QrRequestBuilder.cs Formatting cleanup only.
src/Yoti.Auth/DigitalIdentity/Policy/WantedAttributeBuilder.cs Removes trailing whitespace only.
src/Yoti.Auth/DigitalIdentity/Policy/PolicyBuilder.cs Removes trailing whitespace only.
src/Yoti.Auth/DigitalIdentity/Policy/Policy.cs Removes trailing whitespace only.
src/Yoti.Auth/DigitalIdentity/Policy/NotificationBuilder.cs Removes trailing whitespace only.
src/Yoti.Auth/DigitalIdentity/Policy/Notification.cs Removes trailing whitespace only.
src/Yoti.Auth/DigitalIdentity/Policy/AdvancedIdentityProfile.cs Removes trailing whitespace only.
src/Yoti.Auth/DigitalIdentity/ErrorReason.cs Removes trailing whitespace only.
src/Yoti.Auth/DigitalIdentity/ErrorDetails.cs Removes trailing whitespace only.
src/Yoti.Auth/DigitalIdentity/DigitalIdentityService.cs Formatting cleanup only.
src/Yoti.Auth/CryptoEngine.cs Formatting cleanup only.
src/Examples/Profile/CoreExample/Controllers/HomeController.cs Formatting cleanup only.
src/Examples/DocScan/DocScanExample/Models/DisplayHelper.cs Whitespace/indentation normalization only.
src/Examples/DocScan/DocScanExample/Controllers/IdentityProfileController.cs Removes trailing whitespace only.
src/Examples/DocScan/DocScanExample/Controllers/HomeController.cs Removes trailing whitespace only.
src/Examples/DocScan/DocScanExample/Controllers/DbsController.cs Removes trailing whitespace only.
src/Examples/DigitalIdentity/DigitalIdentity/Startup.cs Removes trailing whitespace only.
src/Examples/DigitalIdentity/DigitalIdentity/Controllers/SuccessController.cs Removes trailing whitespace only.
src/Examples/DigitalIdentity/DigitalIdentity/Controllers/HomeController.cs Removes trailing whitespace only.
src/Examples/DigitalIdentity/DigitalIdentity/Controllers/AdvancedIdentityShareController.cs Removes trailing whitespace only.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +20 to +21
[JsonProperty(PropertyName = "extraction_image_ids")]
public List<string> ExtractionImageIds { get; private set; } = new List<string>();
Comment on lines +28 to +29
[assembly: SuppressMessage("Usage", "CA2237:Mark ISerializable types with serializable", Justification = "[Serializable] not available in 'netstandard' target framework", Scope = "type", Target = "~T:Yoti.Auth.Exceptions.ExtraDataException")]
[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "Other switch cases can all be represented more concisely by the default case", Scope = "member", Target = "~M:Yoti.Auth.Web.Response.CreateExceptionFromStatusCode``1(System.Net.Http.HttpResponseMessage)")]
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.

2 participants