# REST Resource: projects.locations.corpora.dataSchemas

- [Resource: DataSchema](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchema)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchema.SCHEMA_REPRESENTATION)
- [DataSchemaDetails](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchemaDetails)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchemaDetails.SCHEMA_REPRESENTATION)
- [DataType](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataType)
- [ProtoAnyConfig](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#ProtoAnyConfig)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#ProtoAnyConfig.SCHEMA_REPRESENTATION)
- [ListConfig](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#ListConfig)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#ListConfig.SCHEMA_REPRESENTATION)
- [CustomizedStructConfig](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#CustomizedStructConfig)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#CustomizedStructConfig.SCHEMA_REPRESENTATION)
- [Granularity](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#Granularity)
- [SearchStrategy](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#SearchStrategy)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#SearchStrategy.SCHEMA_REPRESENTATION)
- [SearchStrategyType](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#SearchStrategyType)
- [Methods](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#METHODS_SUMMARY)

## Resource: DataSchema

Data schema indicates how the user specified annotation is interpreted in the system.

| JSON representation |
|---|
| ``` { "name": string, "key": string, "schemaDetails": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchemaDetails`) } } ``` |

| Fields ||
|---|---|
| `name` | `string` Resource name of the data schema in the form of: `projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{dataSchema}` where {dataSchema} part should be the same as the `key` field below. |
| `key` | `string` Required. The key of this data schema. This key should be matching the key of user specified annotation and unique inside corpus. This value can be up to 63 characters, and valid characters are /\[a-z\]\[0-9\]-/. The first character must be a letter, the last could be a letter or a number. |
| `schemaDetails` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchemaDetails`)`` The schema details mapping to the key. |

## DataSchemaDetails

Data schema details indicates the data type and the data struct corresponding to the key of user specified annotation.

| JSON representation |
|---|
| ``` { "type": enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataType`), "protoAnyConfig": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#ProtoAnyConfig`) }, "listConfig": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#ListConfig`) }, "customizedStructConfig": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#CustomizedStructConfig`) }, "granularity": enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#Granularity`), "searchStrategy": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#SearchStrategy`) } } ``` |

| Fields ||
|---|---|
| `type` | ``enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataType`)`` Type of the annotation. |
| `protoAnyConfig` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#ProtoAnyConfig`)`` Config for protobuf any type. |
| `listConfig` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#ListConfig`)`` Config for List data type. |
| `customizedStructConfig` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#CustomizedStructConfig`)`` Config for CustomizedStruct data type. |
| `granularity` | ``enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#Granularity`)`` The granularity associated with this DataSchema. |
| `searchStrategy` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#SearchStrategy`)`` The search strategy to be applied on the `key` above. |

## DataType

Data type of the annotation.

| Enums ||
|---|---|
| `DATA_TYPE_UNSPECIFIED` | Unspecified type. |
| `INTEGER` | Integer type. Allowed search strategies: - DataSchema.SearchStrategy.NO_SEARCH, - DataSchema.SearchStrategy.EXACT_SEARCH. Supports query by IntRangeArray. |
| `FLOAT` | Float type. Allowed search strategies: - DataSchema.SearchStrategy.NO_SEARCH, - DataSchema.SearchStrategy.EXACT_SEARCH. Supports query by FloatRangeArray. |
| `STRING` | String type. Allowed search strategies: - DataSchema.SearchStrategy.NO_SEARCH, - DataSchema.SearchStrategy.EXACT_SEARCH, - DataSchema.SearchStrategy.SMART_SEARCH. |
| `DATETIME` | Supported formats: %Y-%m-%dT%H:%M:%E\*S%E\*z (absl::RFC3339_full) %Y-%m-%dT%H:%M:%E\*S %Y-%m-%dT%H:%M%E\*z %Y-%m-%dT%H:%M %Y-%m-%dT%H%E\*z %Y-%m-%dT%H %Y-%m-%d%E\*z %Y-%m-%d %Y-%m %Y Allowed search strategies: - DataSchema.SearchStrategy.NO_SEARCH, - DataSchema.SearchStrategy.EXACT_SEARCH. Supports query by DateTimeRangeArray. |
| `GEO_COORDINATE` | Geo coordinate type. Allowed search strategies: - DataSchema.SearchStrategy.NO_SEARCH, - DataSchema.SearchStrategy.EXACT_SEARCH. Supports query by GeoLocationArray. |
| `PROTO_ANY` | Type to pass any proto as available in annotations.proto. Only use internally. Available proto types and its corresponding search behavior: - ImageObjectDetectionPredictionResult, allows SMART_SEARCH on displayNames and NO_SEARCH. - ClassificationPredictionResult, allows SMART_SEARCH on displayNames and NO_SEARCH. - ImageSegmentationPredictionResult, allows NO_SEARCH. - VideoActionRecognitionPredictionResult, allows SMART_SEARCH on displayName and NO_SEARCH. - VideoObjectTrackingPredictionResult, allows SMART_SEARCH on displayName and NO_SEARCH. - VideoClassificationPredictionResult, allows SMART_SEARCH on displayName and NO_SEARCH. - OccupancyCountingPredictionResult, allows EXACT_SEARCH on stats.full_frame_count.count and NO_SEARCH. - ObjectDetectionPredictionResult, allows SMART_SEARCH on identifiedBoxes.entity.label_string and NO_SEARCH. |
| `BOOLEAN` | Boolean type. Allowed search strategies: - DataSchema.SearchStrategy.NO_SEARCH, - DataSchema.SearchStrategy.EXACT_SEARCH. |
| `LIST` | List type. - Each element in the list must be of the exact same data schema; otherwise, they are invalid arguments. - List level cannot set search strategy. Leaf node level can do. - Elements cannot be another list (no list of list). - Elements can be CUSTOMIZED_STRUCT, and max number of layers is 10. |
| `CUSTOMIZED_STRUCT` | Struct type. - SearchStrategy: \* Data Schema that's CUSTOMIZED_STRUCT cannot set search strategy. \* Leaf-node elements allow setting search strategy based on element's SearchStrategy restriction. - Nested layer restrictions: \* Data Schema that's CUSTOMIZED_STRUCT allows its fields to be of CUSTOMIZED_STRUCT as well, but the overall layers restriction is 10. |

## ProtoAnyConfig

The configuration for `PROTO_ANY` data type.

| JSON representation |
|---|
| ``` { "typeUri": string } ``` |

| Fields ||
|---|---|
| `typeUri` | `string` The type URI of the proto message. |

## ListConfig

The configuration for `LIST` data type.

| JSON representation |
|---|
| ``` { "valueSchema": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchemaDetails`) } } ``` |

| Fields ||
|---|---|
| `valueSchema` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchemaDetails`)`` The value's data schema in the list. |

## CustomizedStructConfig

The configuration for `CUSTOMIZED_STRUCT` data type.

| JSON representation |
|---|
| ``` { "fieldSchemas": { string: { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchemaDetails`) }, ... } } ``` |

| Fields ||
|---|---|
| `fieldSchemas` | ``map (key: string, value: object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#DataSchemaDetails`))`` Direct child elements data schemas. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |

## Granularity

The granularity of annotations under this DataSchema.

| Enums ||
|---|---|
| `GRANULARITY_UNSPECIFIED` | Unspecified granularity. |
| `GRANULARITY_ASSET_LEVEL` | Asset-level granularity (annotations must not contain partition info). |
| `GRANULARITY_PARTITION_LEVEL` | Partition-level granularity (annotations must contain partition info). |

## SearchStrategy

The search strategy for annotations value of the `key`.

| JSON representation |
|---|
| ``` { "searchStrategyType": enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#SearchStrategyType`) } ``` |

| Fields ||
|---|---|
| `searchStrategyType` | ``enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas#SearchStrategyType`)`` The type of search strategy to be applied on the `key` above. The allowed `searchStrategyType` is different for different data types, which is documented in the DataSchemaDetails.DataType. Specifying unsupported `searchStrategyType` for data types will result in INVALID_ARGUMENT error. |

## SearchStrategyType

The types of search strategies to be applied on the annotation key.

| Enums ||
|---|---|
| `NO_SEARCH` | Annotatation values of the `key` above will not be searchable. |
| `EXACT_SEARCH` | When searching with `key`, the value must be exactly as the annotation value that has been ingested. |
| `SMART_SEARCH` | When searching with `key`, Warehouse will perform broad search based on semantic of the annotation value. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas/create` | Creates data schema inside corpus. |
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas/delete` | Deletes data schema inside corpus. |
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas/get` | Gets data schema inside corpus. |
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas/list` | Lists a list of data schemas inside corpus. |
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1alpha1/projects.locations.corpora.dataSchemas/patch` | Updates data schema inside corpus. |