# Migrating to version 0.11.0

In preparation for a public launch, we intentionally introduced a number of breaking changes to make the SDK easier to use and understand. We hope to avoid breaking changes on this scale in the future.

### Rename schema fields `id`, `primary`, and `featured`

**Affects**: Packs that define an [object schema](../../../guides/advanced/schemas/#object).\
**Action Required**: Rename only.

To better reflect their meaning, we've renamed certain fields in the schema definition. Specifically:

- `id` --> `idProperty`
- `primary` --> `displayProperty`
- `featured` --> `featuredProperties`

Only the names of these fields have changed, and it there should be no impact on the functionality of your Pack.

```
let MovieSchema = coda.makeObjectSchema({
  properties: {
    title: { type: coda.ValueType.String },
    year: { type: coda.ValueType.Number },
    id: { type: coda.ValueType.String },
    // ...
  },
  idProperty: "id",
  displayProperty: "title",
  featuredProperties: ["year"],
  // ...
});
```

### Add `identityName` to dynamic sync tables

**Affects**: Packs that include a dynamic sync table.\
**Action Required**: Add new code.

Like regular sync tables, dynamic sync tables now require the `identityName` field to be set. This will be used along with the dynamic URL to set the identity of the table. You no longer need to set the `identity` field of the schema generated in the `getSchema` function, as it will be constructed for you automatically.

To avoid breaking user's existing tables, ensure you set the `identityName` field to the same value previously set in `identity.name`. If you were previously setting a different `identity.name` value depending on the `dynmaicUrl`, and your Pack uses references between dynamic sync tables, then this change will break those references. You users will need to remove the old tables from their docs and re-add them to restore the references.

```
pack.addDynamicSyncTable({
  name: "Tasks",
  description: "The tasks in the selected project.",
  identityName: "Tasks",
  // ...
});
```

### Rename `defaultValue` field of parameters

**Affects**: Packs that have a parameter with a [suggested value](../../../guides/basics/parameters/#suggested).\
**Action Required**: Rename only.

To better reflect its meaning, we've renamed the `defaultValue` field of parameter definitions:

- `defaultValue` --> `suggestedValue`

Only the name of the field has changed, and it there should be no impact on the functionality of your Pack.

```
coda.makeParameter({
  type: coda.ParameterType.Number,
  name: "days",
  description: "How many days of data to fetch.",
  suggestedValue: 30,
})
```

### Move `attribution` settings in schema

**Affects**: Packs that define a schema that includes [`attribution`](../../../guides/advanced/schemas/#attribution) information.\
**Action Required**: Slight refactor.

For compatibility with other changes, we've relocated the attribution definitions within a schema.

- `identity.attribution` --> `attribution`

Only the location of the field has changed, and it there should be no impact on the functionality of your Pack.

```
let TaskSchema = coda.makeObjectSchema({
  // ...
  attribution: [
    {
      type: coda.AttributionNodeType.Text,
      text: "Provided by Todoist",
    },
  ],
});
```

### Rename authentication option `SetEndpoint.getOptionsFormula`

**Affects**: Packs that [prompt users for an account-specific endpoint](../../../guides/basics/authentication/#setendpoint).\
**Action Required**: Rename only.

For consistency with the rest of the SDK we've renamed the `getOptionsFormula` of the [`SetEndpoint`](../../../reference/sdk/core/interfaces/SetEndpoint/) object:

- `getOptionsFormula` --> `getOptions`

Only the name of the field has changed, and it there should be no impact on the functionality of your Pack.

```
pack.setUserAuthentication({
  // ...
  postSetup: [{
    type: coda.PostSetupType.SetEndpoint,
    name: 'SelectEndpoint',
    description: 'Select the site to connect to:',
    getOptions: async function (context) {
      // ...
    },
  }],
});
```

### Use new `File` parameter type for files

**Affects**: Packs that accept files as parameters using the `Image` or `ImageArray` parameter types.\
**Action Required**: Slight refactor.

While previously there was no supported way to pass a non-image file as a parameter to a Pack formula, some developers may have noticed that using an `Image` or `ImageArray` parameter type would mostly work. We've now added a dedicated `File` and `FileArray` parameter for this purpose, and will eventually disable the previous loophole.

```
pack.addFormula({
  name: "FileSize",
  description: "Gets the file size of an file, in bytes.",
  parameters: [
    coda.makeParameter({
      type: coda.ParameterType.File,
      name: "file",
      description: "The file to operate on.",
    }),
  ],
  // ...
});
```

### Remove `varargsParameters` from sync tables

**Affects**: Packs that have erroneously set [`varargsParameters`](../../../guides/basics/parameters/#vararg) on a sync table.\
**Action Required**: Remove code.

Sync tables currently don't support [`varargsParameters`](../../../guides/basics/parameters/#vararg), as they aren't shown in the side panel. While we may fix this some day, for now we've introduced a validation rule to ensure they aren't set accidentally.

If any of your sync tables have `varargsParameters` set (unlikely) you'll need to remove them. Given that they weren't used anyway this should have no effect on your Pack's functionality.

### Set `networkDomain` on user authentication config (multi-domain only)

**Affects**: Packs that use multiple [network domains](../../../guides/basics/fetcher/#network-domains) (uncommon) and [per-user authentication](../../../guides/basics/authentication/#user).\
**Action Required**: Add new code.

Packs that make requests to multiple network domains and have per-user authentication (`setUserAuthentication`) must now specify which domain their authentication configuration applies to. This is done to prevent credentials from leaking from one service to another. Packs using system-wide authentication (`setSystemAuthentication`) are not affected.

For affected Packs, set the [`networkDomain`](../../../reference/sdk/core/interfaces/BaseAuthentication/#networkdomain) field of the authentication config to the domain it should apply to.

```
pack.addNetworkDomain("coda.io");
pack.addNetworkDomain("example.com");

pack.setUserAuthentication({
  // ...
  networkDomain: "coda.io",
});
```

### Remove manual HTTP response decompression

**Affects**: Packs that receive compressed HTTP responses and are manually decompressing them.\
**Action Required**: Remove code.

Some external services and APIs return their responses compressed to save network bandwidth. This is indicated by the `Content-Encoding` HTTP header, which specifies the type of compression used (typically gzip or deflate). While many other HTTP libraries automatically decompress these responses for you, the Fetcher was returning the response body still in a compressed form. This required you to install a library to manually decompress the content before you could use it.

As of this SDK version, the decompression will be done automatically for you. You'll have to remove any code that manually decompresses the responses.
