# Struct Mask (StructMaskGenerator)

The [Struct Mask](/app/generation/generators/generator-reference/struct-mask.md) generator applies selected generators to specific StructFields within a StructType in a Spark database.

## Link object structure <a href="#generator-api-struct-mask-link-object" id="generator-api-struct-mask-link-object"></a>

For the Struct Mask generator, there is a link object for each path expression value to assign a sub-generator to.

The generator does not itself support consistency or differential privacy.

The `metadata` object is populated from the [`JsonMaskMetadata`](https://app.tonic.ai/apidocs/index.html#/models/JsonMaskMetadata) object, and includes:

* `pathExpression`, which is the expression that identifies the value to apply the sub-generator to.
* The types of values to apply the sub-generator to.
* The `subGeneratorMetadata` object, which identifies and configures the selected sub-generator.

{% code overflow="wrap" %}

```json
{
  "schema": "string",
  "table": "string",
  "column": "string"
  "metadata": {
    "generatorId": "StructMaskGenerator",
    "customValueProcessor": "string" //If custom value processor applied
    "pathExpression": "string",
    "jsonFilterTypes": [ enum ],
    "subGeneratorMetadata": {
      "presetId": "string",
      "generatorId": "string",
      //Metadata for the selected sub-generator
      "customValueProcessor": "string",  //If custom value processor applied to the sub-generator
    }
}
```

{% endcode %}

## Example replacement <a href="#generator-api-struct-mask-replacement" id="generator-api-struct-mask-replacement"></a>

In the following example replacement for the StructMask generator:

* The value at the path expression `$.address.city` is assigned the Address generator. The generator is configured to produce a city value. Consistency is disabled.
* The value at the path expression `$.address.zip` is also assigned the Address generator. The generator is configured to produce a zip code value. Consistency is disabled.

```json
{
  "name": "value",
  "schema": "",
  "table": "simple_struct",
  "links": [
    {
      "schema": "",
      "table": "simple_struct",
      "column": "value",
      "metadata": {
        "generatorId": "StructMaskGenerator",
        "presetId": "StructMaskGenerator",
        "pathExpression": "$.address.city",
        "jsonFilterTypes": [
          0
        ],
        "subGeneratorMetadata": {
          "presetId": "AddressGenerator",
          "generatorId": "AddressGenerator",
          "addressType": "City",
          "isConsistent": false
        }
      }
    },
    {
      "schema": "",
      "table": "simple_struct",
      "column": "value",
      "metadata": {
        "generatorId": "StructMaskGenerator",
        "presetId": "StructMaskGenerator",
        "pathExpression": "$.address.zip",
        "jsonFilterTypes": [
          0
        ],
        "subGeneratorMetadata": {
          "presetId": "AddressGenerator",
          "generatorId": "AddressGenerator",
          "addressType": "ZipCode",
          "isConsistent": false
        }
      }
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/app/api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-struct-mask.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
