From 7bfc279cfdc5c73ee2216cc6b5da291bb64f53b1 Mon Sep 17 00:00:00 2001 From: skyflow-bharti Date: Tue, 27 Oct 2026 15:30:41 +0530 Subject: [PATCH 1/2] SK-3175 update autogenerated code --- .../skyflow/detect/DeidentifyFileRequest.java | 4 ++++ .../detect/DeidentifyStringRequest.java | 3 ++- .../detect/internal/DetectRequestMapper.java | 21 ++++++++++++++++-- .../detect/internal/DetectValidations.java | 6 +++-- .../internal/DeidentifyFileMapperTests.java | 19 ++++++++++++++++ .../internal/DetectRequestMapperTests.java | 22 +++++++++++++++++++ docs/api_reference.md | 8 +++---- flowvault/README.md | 6 ++--- skyvault/README.md | 6 ++--- 9 files changed, 80 insertions(+), 15 deletions(-) diff --git a/common/src/main/java/com/skyflow/detect/DeidentifyFileRequest.java b/common/src/main/java/com/skyflow/detect/DeidentifyFileRequest.java index b91b3a76..e1d9e6fd 100644 --- a/common/src/main/java/com/skyflow/detect/DeidentifyFileRequest.java +++ b/common/src/main/java/com/skyflow/detect/DeidentifyFileRequest.java @@ -10,6 +10,10 @@ * *

Without {@code pollOptions} the call submits the run and returns its id. With {@code pollOptions} the * SDK polls the run and, on success for a file-based request, writes the outputs to disk. + * + *

{@code configurationId} and {@code configuration} are both optional and are sent exactly as supplied. + * With neither set, the SDK sends a configuration that carries only the vault id, so the server applies + * the vault's defaults. */ public final class DeidentifyFileRequest { private final DataSourceType dataSource; diff --git a/common/src/main/java/com/skyflow/detect/DeidentifyStringRequest.java b/common/src/main/java/com/skyflow/detect/DeidentifyStringRequest.java index bde84343..f5bb22c4 100644 --- a/common/src/main/java/com/skyflow/detect/DeidentifyStringRequest.java +++ b/common/src/main/java/com/skyflow/detect/DeidentifyStringRequest.java @@ -2,7 +2,8 @@ /** * Request for {@code deidentifyString}. configurationId and configuration are both optional and are sent - * exactly as supplied; the server applies its own rules for their combination. + * exactly as supplied; the server applies its own rules for their combination. With neither set, the SDK + * sends a configuration that carries only the vault id, so the server applies the vault's defaults. */ public final class DeidentifyStringRequest { private final String text; diff --git a/common/src/main/java/com/skyflow/detect/internal/DetectRequestMapper.java b/common/src/main/java/com/skyflow/detect/internal/DetectRequestMapper.java index 8461eddb..c11a9bab 100644 --- a/common/src/main/java/com/skyflow/detect/internal/DetectRequestMapper.java +++ b/common/src/main/java/com/skyflow/detect/internal/DetectRequestMapper.java @@ -74,12 +74,22 @@ public static DeidentifyStringRequestV2 toDeidentifyStringRequest(DeidentifyStri if (request.getConfigurationId() != null) { builder.configurationId(request.getConfigurationId()); } - if (request.getConfiguration() != null) { + if (sendsConfiguration(request.getConfigurationId(), request.getConfiguration())) { builder.configuration(toDetectConfig(request.getConfiguration(), vaultId)); } return builder.build(); } + /** + * The API needs either a configuration id or a configuration, and the vault id travels inside the + * configuration. An inline configuration is always sent; with neither field set the SDK still sends a + * configuration holding only the vault id, so the server applies the vault's defaults instead of + * rejecting the request. When only an id is set nothing else is sent. + */ + static boolean sendsConfiguration(String configurationId, DetectConfiguration configuration) { + return configuration != null || configurationId == null; + } + /** * Builds the submit request. For file-based requests this reads and base64-encodes the file and infers * the format from its extension when none was given. @@ -107,7 +117,7 @@ public static DeidentifyFileRequestV2 toDeidentifyFileRequest(DeidentifyFileRequ if (request.getConfigurationId() != null) { builder.configurationId(request.getConfigurationId()); } - if (request.getConfiguration() != null) { + if (sendsConfiguration(request.getConfigurationId(), request.getConfiguration())) { builder.configuration(toDetectConfig(request.getConfiguration(), vaultId)); } return builder.build(); @@ -158,8 +168,15 @@ public static DetectGuardrailsRequestV2 toCheckGuardrailsRequest(CheckGuardrails return builder.build(); } + /** + * @param configuration the inline configuration, or {@code null} to send a configuration that carries + * only the vault id + */ public static DetectConfigV2 toDetectConfig(DetectConfiguration configuration, String vaultId) { DetectConfigV2._FinalStage builder = DetectConfigV2.builder().vaultId(vaultId); + if (configuration == null) { + return builder.build(); + } if (configuration.getName() != null) { builder.name(configuration.getName()); } diff --git a/common/src/main/java/com/skyflow/detect/internal/DetectValidations.java b/common/src/main/java/com/skyflow/detect/internal/DetectValidations.java index 6836dcff..e7b19364 100644 --- a/common/src/main/java/com/skyflow/detect/internal/DetectValidations.java +++ b/common/src/main/java/com/skyflow/detect/internal/DetectValidations.java @@ -30,7 +30,8 @@ public static void validateDeidentifyStringRequest(DeidentifyStringRequest reque if (isBlank(request.getText())) { throw invalid(ErrorLogs.INVALID_TEXT_IN_DEIDENTIFY_STRING, BaseErrorMessage.InvalidTextInDeidentifyString); } - // configurationId and configuration are both optional on the API and are passed through as given. + // configurationId and configuration are both optional on the API and are passed through as given; + // with neither set the mapper sends a configuration carrying only the vault id. } public static void validateDeidentifyFileRequest(DeidentifyFileRequest request) throws SkyflowException { @@ -52,7 +53,8 @@ public static void validateDeidentifyFileRequest(DeidentifyFileRequest request) throw invalid(ErrorLogs.INVALID_VALUE_IN_DEIDENTIFY_FILE, BaseErrorMessage.InvalidValueInDeidentifyFile); } } - // configurationId and configuration are both optional on the API and are passed through as given. + // configurationId and configuration are both optional on the API and are passed through as given; + // with neither set the mapper sends a configuration carrying only the vault id. validatePollOptions(request.getPollOptions()); if (request.getPollOptions() == null && !isBlank(request.getOutputDirectory())) { throw invalid(ErrorLogs.OUTPUT_DIRECTORY_WITHOUT_POLL_OPTIONS, BaseErrorMessage.OutputDirectoryWithoutPollOptions); diff --git a/common/src/test/java/com/skyflow/detect/internal/DeidentifyFileMapperTests.java b/common/src/test/java/com/skyflow/detect/internal/DeidentifyFileMapperTests.java index be54cb49..d6fa068e 100644 --- a/common/src/test/java/com/skyflow/detect/internal/DeidentifyFileMapperTests.java +++ b/common/src/test/java/com/skyflow/detect/internal/DeidentifyFileMapperTests.java @@ -57,6 +57,25 @@ public void dataFormatIsSentLowerCase() throws Exception { Assert.assertTrue(wire(api).contains("\"dataFormat\":\"pdf\"")); } + @Test + public void noConfigurationSendsVaultIdOnlyConfiguration() throws Exception { + DeidentifyFileRequestV2 api = DetectRequestMapper.toDeidentifyFileRequest(DeidentifyFileRequest.builder() + .dataSource(DataSourceType.BASE64).value("aGVsbG8=").build(), "vault-1"); + Assert.assertFalse(api.getConfigurationId().isPresent()); + Assert.assertEquals("vault-1", api.getConfiguration().get().getVaultId()); + Assert.assertFalse(api.getConfiguration().get().getDetect().isPresent()); + String json = ObjectMappers.JSON_MAPPER.writeValueAsString(api); + Assert.assertTrue(json, json.contains("\"configuration\":{\"vaultId\":\"vault-1\"}")); + } + + @Test + public void storedConfigurationIdSendsNoConfiguration() throws Exception { + DeidentifyFileRequestV2 api = DetectRequestMapper.toDeidentifyFileRequest(DeidentifyFileRequest.builder() + .dataSource(DataSourceType.BASE64).value("aGVsbG8=").configurationId("cfg-1").build(), "vault-1"); + Assert.assertEquals("cfg-1", api.getConfigurationId().get()); + Assert.assertFalse(api.getConfiguration().isPresent()); + } + @Test public void inlineConfigurationGetsVaultId() throws Exception { DeidentifyFileRequestV2 api = DetectRequestMapper.toDeidentifyFileRequest(DeidentifyFileRequest.builder() diff --git a/common/src/test/java/com/skyflow/detect/internal/DetectRequestMapperTests.java b/common/src/test/java/com/skyflow/detect/internal/DetectRequestMapperTests.java index a805f103..8786e0d5 100644 --- a/common/src/test/java/com/skyflow/detect/internal/DetectRequestMapperTests.java +++ b/common/src/test/java/com/skyflow/detect/internal/DetectRequestMapperTests.java @@ -45,6 +45,28 @@ public void storedConfigurationSendsOnlyTextAndId() throws Exception { Assert.assertFalse(json, json.contains("\"configuration\":")); } + @Test + public void noConfigurationSendsVaultIdOnlyConfiguration() throws Exception { + DeidentifyStringRequestV2 mapped = DetectRequestMapper.toDeidentifyStringRequest( + DeidentifyStringRequest.builder().text("hello").build(), "vault-1"); + Assert.assertFalse(mapped.getConfigurationId().isPresent()); + DetectConfigV2 config = mapped.getConfiguration().get(); + Assert.assertEquals("vault-1", config.getVaultId()); + Assert.assertFalse(config.getDetect().isPresent()); + Assert.assertFalse(config.getName().isPresent()); + String json = ObjectMappers.JSON_MAPPER.writeValueAsString(mapped); + Assert.assertTrue(json, json.contains("\"configuration\":{\"vaultId\":\"vault-1\"}")); + } + + @Test + public void storedConfigurationIdAlongsideInlineConfigurationSendsBothAsGiven() throws Exception { + DeidentifyStringRequestV2 mapped = DetectRequestMapper.toDeidentifyStringRequest( + DeidentifyStringRequest.builder().text("hello").configurationId("cfg-1") + .configuration(DetectConfiguration.builder().build()).build(), "vault-1"); + Assert.assertEquals("cfg-1", mapped.getConfigurationId().get()); + Assert.assertEquals("vault-1", mapped.getConfiguration().get().getVaultId()); + } + @Test public void inlineConfigurationIsScopedToVaultAndFullyMapped() throws Exception { DetectConfiguration configuration = DetectConfiguration.builder() diff --git a/docs/api_reference.md b/docs/api_reference.md index 2141f893..426a1f3d 100644 --- a/docs/api_reference.md +++ b/docs/api_reference.md @@ -233,8 +233,8 @@ Parameters listed with their defaults as defined in the builders. | Builder method | Default | Description | |----------------|---------|-------------| | `text(String)` | _(required)_ | Text to de-identify. | -| `configurationId(String)` | `null` | Id of a Detect configuration created through the management API. | -| `configuration(DetectConfiguration)` | `null` | Inline configuration. See [`DetectConfiguration`](#detectconfiguration).| +| `configurationId(String)` | `null` | Id of a Detect configuration created through the management API. Sending it together with `configuration` is rejected by the API. | +| `configuration(DetectConfiguration)` | `null` | Inline configuration. See [`DetectConfiguration`](#detectconfiguration). With neither this nor `configurationId` set, the SDK sends only the vault id and the server applies the vault's defaults. | ### `DeidentifyFileRequest` @@ -247,8 +247,8 @@ Parameters listed with their defaults as defined in the builders. | `file(File)` | `null` | Local file; read and base64-encoded when sent, `dataSource` set to `BASE64`. | | `filePath(String)` | `null` | Same as `file(File)`, from a path. | | `dataFormat(FileDataFormat)` | inferred from the extension | File format. See [`FileDataFormat`](#filedataformat). | -| `configurationId(String)` | `null` | Id of a stored Detect configuration. | -| `configuration(DetectConfiguration)` | `null` | Inline configuration. See [`DetectConfiguration`](#detectconfiguration). | +| `configurationId(String)` | `null` | Id of a stored Detect configuration. Sending it together with `configuration` is rejected by the API. | +| `configuration(DetectConfiguration)` | `null` | Inline configuration. See [`DetectConfiguration`](#detectconfiguration). With neither this nor `configurationId` set, the SDK sends only the vault id and the server applies the vault's defaults. | | `pollOptions(PollOptions)` | `null` | Poll the run after submitting. `null` submits only and returns the run id. See [`PollOptions`](#polloptions). | | `outputDirectory(String)` | working directory | Where outputs are written on success. Requires `pollOptions` and a local file; setting it without `pollOptions` fails client-side validation. | diff --git a/flowvault/README.md b/flowvault/README.md index 894a21c3..48f37775 100644 --- a/flowvault/README.md +++ b/flowvault/README.md @@ -1647,13 +1647,13 @@ Detect configurations are created in Studio or through the management API. The S ## Before you start - **Role.** The service account needs the Detect Invoker, Detect Manager or Vault Owner role on the vault. Detect Invoker can de-identify data and write vault tokens into the vault; Detect Manager adds the ability to create, update and delete Detect configurations. Re-identifying values stored as `VAULT_TOKEN` is governed like detokenization: the caller also needs a policy that grants the Detokenization action on the destination, unless it is a Vault Owner. Detect Invoker or Detect Manager alone is not enough. -- **Configuration.** `configurationId` is the id of a Detect configuration created through the management API; the SDK does not create, update or delete them. The alternative is an inline `DetectConfiguration` passed as `configuration` (see [Detect configuration](#detect-configuration)). +- **Configuration.** `configurationId` is the id of a Detect configuration created through the management API; the SDK does not create, update or delete them. The alternative is an inline `DetectConfiguration` passed as `configuration` (see [Detect configuration](#detect-configuration)). Both are optional: with neither set the SDK sends only the vault id and the run uses the vault's default Detect settings. Sending both is rejected by the API with HTTP 400. - **Destination for vault tokens.** An entity de-identified with `VAULT_TOKEN` stores its value in the token group named by `destination`. That token group must already exist in the vault; Detect writes into it but does not create it. - **API reference.** Every Detect request, response and configuration class is listed in the [API reference](../docs/api_reference.md#detect-api). ## Deidentify string -`DeidentifyStringRequest` takes the text plus exactly one of `configurationId` (a stored Detect configuration) or `configuration` (an inline `DetectConfiguration`). Both fields are sent exactly as supplied and the server rejects a request that has neither or both (see [Before you start](#before-you-start)). For an inline configuration the SDK fills the vault id from the controller. +`DeidentifyStringRequest` takes the text plus, optionally, `configurationId` (a stored Detect configuration) or `configuration` (an inline `DetectConfiguration`). Both are sent exactly as supplied. With neither set the SDK sends only the vault id and the server applies the vault's defaults; sending both is rejected by the API (see [Before you start](#before-you-start)). The SDK fills the vault id into the configuration from the controller. ```java import com.skyflow.detect.*; @@ -1762,7 +1762,7 @@ File de-identification is asynchronous on the API: the submit call returns a run - **Submit only** (default): one call, returns `getRunId()`. `getStatus()` is `null` and nothing is written to disk. Retrieve the result later with [`getRun`](#get-run). - **Submit and poll**: set `pollOptions`. The SDK polls the run with exponential backoff (1, 2, 4, 8, 16, then 32 seconds between lookups) until it is `SUCCESS`, `FAILED` or `UNKNOWN`, or until `waitTime` (default 60 s, max 300) or `maxAttempts` (default 23, max 23) is used up. If the budget runs out the response carries the run id with `IN_PROGRESS` or `QUEUED` so you can resume with `getRun`. -The file is supplied in one of three ways: `dataSource` plus `value` (`BASE64` content, a `SKYFLOW_ID`, or a `PRESIGNED_URL`), or `file(File)` / `filePath(String)`, which read and encode a local file and infer `dataFormat` from its extension. Supply exactly one of `value`, `file` or `filePath`, and exactly one of `configurationId` or an inline `configuration`; the server rejects neither-or-both (see [Before you start](#before-you-start)). +The file is supplied in one of three ways: `dataSource` plus `value` (`BASE64` content, a `SKYFLOW_ID`, or a `PRESIGNED_URL`), or `file(File)` / `filePath(String)`, which read and encode a local file and infer `dataFormat` from its extension. Supply exactly one of `value`, `file` or `filePath`. `configurationId` and `configuration` follow the same rules as for strings: both optional, sent as supplied, vault defaults when neither is set, and both together rejected by the API (see [Before you start](#before-you-start)). `dataFormat` accepts every `FileDataFormat`: `BMP`, `CSV`, `DCM`, `DOC`, `DOCX`, `GIF`, `JPEG`, `JPG`, `JSON`, `JSONL`, `MP3`, `PDF`, `PNG`, `PPT`, `PPTX`, `TIF`, `TIFF`, `TXT`, `WAV`, `XLS`, `XLSX`, `XML` and `ZIP`. The `VAULT_TOKEN` de-identification type is supported only for `TXT`, `CSV`, `JSON`, `JSONL`, `XML`, `DOCX`, `XLSX` and `PPTX`. diff --git a/skyvault/README.md b/skyvault/README.md index 9a5db651..99260df5 100644 --- a/skyvault/README.md +++ b/skyvault/README.md @@ -1680,13 +1680,13 @@ Detect configurations are created in Studio or through the management API. The S ## Before you start - **Role.** The service account needs the Detect Invoker, Detect Manager or Vault Owner role on the vault. Detect Invoker can de-identify data and write vault tokens into the vault; Detect Manager adds the ability to create, update and delete Detect configurations. Re-identifying values stored as `VAULT_TOKEN` is governed like detokenization: the caller also needs a policy that grants the Detokenization action on the destination table and columns, unless it is a Vault Owner. Detect Invoker or Detect Manager alone is not enough. -- **Configuration.** `configurationId` is the id of a Detect configuration created through the management API; the SDK does not create, update or delete them. The alternative is an inline `DetectConfiguration` passed as `configuration` (see [Detect configuration](#detect-configuration)). +- **Configuration.** `configurationId` is the id of a Detect configuration created through the management API; the SDK does not create, update or delete them. The alternative is an inline `DetectConfiguration` passed as `configuration` (see [Detect configuration](#detect-configuration)). Both are optional: with neither set the SDK sends only the vault id and the run uses the vault's default Detect settings. Sending both is rejected by the API with HTTP 400. - **Destination for vault tokens.** An entity de-identified with `VAULT_TOKEN` stores its value in the `table.column` named by `destination`. That table and column must already exist in the vault; Detect writes into them but does not create them. - **API reference.** Every Detect request, response and configuration class is listed in the [API reference](../docs/api_reference.md#detect-api). ## Deidentify string -`DeidentifyStringRequest` takes the text plus exactly one of `configurationId` (a stored Detect configuration) or `configuration` (an inline `DetectConfiguration`). Both fields are sent exactly as supplied. For an inline configuration the SDK fills the vault id from the controller. +`DeidentifyStringRequest` takes the text plus, optionally, `configurationId` (a stored Detect configuration) or `configuration` (an inline `DetectConfiguration`). Both are sent exactly as supplied. With neither set the SDK sends only the vault id and the server applies the vault's defaults; sending both is rejected by the API (see [Before you start](#before-you-start)). The SDK fills the vault id into the configuration from the controller. ```java import com.skyflow.detect.*; @@ -1795,7 +1795,7 @@ File de-identification is asynchronous on the API: the submit call returns a run - **Submit only** (default): one call, returns `getRunId()`. `getStatus()` is `null` and nothing is written to disk. Retrieve the result later with [`getRun`](#get-run). - **Submit and poll**: set `pollOptions`. The SDK polls the run with exponential backoff (1, 2, 4, 8, 16, then 32 seconds between lookups) until it is `SUCCESS`, `FAILED` or `UNKNOWN`, or until `waitTime` (default 60 s, max 300) or `maxAttempts` (default 23, max 23) is used up. If the budget runs out the response carries the run id with `IN_PROGRESS` or `QUEUED` so you can resume with `getRun`. -The file is supplied in one of three ways: `dataSource` plus `value` (`BASE64` content, a `SKYFLOW_ID`, or a `PRESIGNED_URL`), or `file(File)` / `filePath(String)`, which read and encode a local file and infer `dataFormat` from its extension. Supply exactly one of `value`, `file` or `filePath`. Either `configurationId` or an inline `configuration` is passed through as given. +The file is supplied in one of three ways: `dataSource` plus `value` (`BASE64` content, a `SKYFLOW_ID`, or a `PRESIGNED_URL`), or `file(File)` / `filePath(String)`, which read and encode a local file and infer `dataFormat` from its extension. Supply exactly one of `value`, `file` or `filePath`. `configurationId` and `configuration` follow the same rules as for strings: both optional, sent as supplied, vault defaults when neither is set, and both together rejected by the API (see [Before you start](#before-you-start)). `dataFormat` accepts every `FileDataFormat`: `BMP`, `CSV`, `DCM`, `DOC`, `DOCX`, `GIF`, `JPEG`, `JPG`, `JSON`, `JSONL`, `MP3`, `PDF`, `PNG`, `PPT`, `PPTX`, `TIF`, `TIFF`, `TXT`, `WAV`, `XLS`, `XLSX`, `XML` and `ZIP`. The `VAULT_TOKEN` de-identification type is supported only for `TXT`, `CSV`, `JSON`, `JSONL`, `XML`, `DOCX`, `XLSX` and `PPTX`. From 272628257a09b0517f61f27be4fe5fa353f76b30 Mon Sep 17 00:00:00 2001 From: skyflow-bharti Date: Tue, 27 Oct 2026 10:01:16 +0000 Subject: [PATCH 2/2] [AUTOMATED] Private Release 1.2.0-dev-7bfc279c --- flowvault/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flowvault/pom.xml b/flowvault/pom.xml index 3a276101..75b0d4d7 100644 --- a/flowvault/pom.xml +++ b/flowvault/pom.xml @@ -12,7 +12,7 @@ skyflow-flowvault-java - 1.2.0-dev.d4140366 + 1.2.0-dev.7bfc279c jar ${project.groupId}:${project.artifactId} Skyflow FlowVault SDK for the Java programming language