# SetSchemaResponse

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/app/SetSchemaResponse.java+class:androidx.appsearch.app.SetSchemaResponse) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
class SetSchemaResponse
```

<br />

*** ** * ** ***

The response class of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)`

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse` objects. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure` The class represents a post-migrated `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` that failed to be saved by `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)`. |

| ### Public functions |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse#getDeletedTypes()()` Returns a `https://developer.android.com/reference/java/util/Set.html` of deleted schema types. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse#getIncompatibleTypes()()` Returns a `https://developer.android.com/reference/java/util/Set.html` of schema type whose new definitions set in the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call were incompatible with the pre-existing schema. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse#getMigratedTypes()()` Returns a `https://developer.android.com/reference/java/util/Set.html` of schema type that were migrated by the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse#getMigrationFailures()()` Returns a `https://developer.android.com/reference/java/util/List.html` of all failed `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure`. |

## Public functions

### getDeletedTypes

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun getDeletedTypes(): (Mutable)Set<String!>
```

Returns a `https://developer.android.com/reference/java/util/Set.html` of deleted schema types.

A "deleted" type is a schema type that was previously a part of the database schema but was not present in the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaRequest` object provided in the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call.

Documents for a deleted type are removed from the database.

### getIncompatibleTypes

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun getIncompatibleTypes(): (Mutable)Set<String!>
```

Returns a `https://developer.android.com/reference/java/util/Set.html` of schema type whose new definitions set in the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call were incompatible with the pre-existing schema.

If a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/Migrator` is provided for this type and the migration is success triggered. The type will also appear in `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse#getMigratedTypes()`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaRequest` |   |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` |   |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaRequest.Builder#setForceOverride(boolean)` |   |

### getMigratedTypes

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun getMigratedTypes(): (Mutable)Set<String!>
```

Returns a `https://developer.android.com/reference/java/util/Set.html` of schema type that were migrated by the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call.

A "migrated" type is a schema type that has triggered a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/Migrator` instance to migrate documents of the schema type to another schema type, or to another version of the schema type.

If a document fails to be migrated, a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure` will be generated for that document.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/Migrator` |   |

### getMigrationFailures

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
fun getMigrationFailures(): (Mutable)List<SetSchemaResponse.MigrationFailure!>
```

Returns a `https://developer.android.com/reference/java/util/List.html` of all failed `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure`.

A `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure` will be generated if the system trying to save a post-migrated `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` but fail.

`https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure` contains the namespace, id and schemaType of the post-migrated `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` and the error reason. Mostly it will be mismatch the schema it migrated to.