Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Settings API - Specify handling of null values when patching settings (
Browse files Browse the repository at this point in the history
…#202)

* Specify behavior when patching a setting with partial values and null values.

- Partial value: the setting is unchanged.
- null value: the setting is reset to default.

* Settings: Update error messages to accept the null value
  • Loading branch information
dureuill committed Nov 29, 2022
1 parent 928c424 commit 3eb3d16
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
12 changes: 8 additions & 4 deletions text/0117-typo-tolerance-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,14 @@ See [Summarized `task` Object for `202 Accepted`](0060-tasks-api.md#summarized-t
- 🔴 Sending a different Content-Type than `application/json` returns an [invalid_content_type](0061-error-format-and-definitions.md#invalid_content_type) error.
- 🔴 Sending an empty payload returns a [missing_payload](0061-error-format-and-definitions.md#missing_payload) error.
- 🔴 Sending an invalid JSON payload returns a [malformed_payload](0061-error-format-and-definitions.md#malformed_payload) error.
- 🔴 Sending a value with a different type than `Boolean` for the `enabled` field returns an [bad_request](0061-error-format-and-definitions.md#bad_request) error.
- 🔴 Sending a value with a different type than `Array of String` for the `disableOnAttributes` field returns an [bad_request](0061-error-format-and-definitions.md#bad_request) error.
- 🔴 Sending a value with a different type than `Array of String` for the `disableOnWords` field returns an [bad_request](0061-error-format-and-definitions.md#bad_request) error.
- 🔴 Sending a value with a different type than `Integer` for `minWordSizeForTypos` object fields returns an [bad_request](0061-error-format-and-definitions.md#bad_request) error.
- 🔴 Sending a value different from `null` or with a different type than `Boolean` for the `enabled` field returns a
[bad_request](0061-error-format-and-definitions.md#bad_request) error.
- 🔴 Sending a value different from `null` or with a different type than `Array of String` for the `disableOnAttributes`
field returns a [bad_request](0061-error-format-and-definitions.md#bad_request) error.
- 🔴 Sending a value different from `null` or with a different type than `Array of String` for the `disableOnWords` field
returns a [bad_request](0061-error-format-and-definitions.md#bad_request) error.
- 🔴 Sending a value different from `null` or with a different type than `Integer` for `minWordSizeForTypos` object fields
returns a [bad_request](0061-error-format-and-definitions.md#bad_request) error.

###### 3.2.2.2.2.1. Async Errors

Expand Down
9 changes: 5 additions & 4 deletions text/0123-settings-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ Modify the settings of a Meilisearch index.
| `stopWords` | Array of String / `null` | false |
| `synonyms` | Object / `null` | false |
| `distinctAttribute` | String / `null` | false |
| `typoTolerance` | Object | false |
| `pagination` | Object | false |
| `faceting` | Object | false |
| `typoTolerance` | Object / `null` | false |
| `pagination` | Object / `null` | false |
| `faceting` | Object / `null` | false |

The request payload accepts partial definitions.
- The request payload accepts partial definitions, the value of missing fields will remain unchanged.
- The request payload accepts the `null` value for any setting, which will reset the setting to its default value.

##### 3.2.2.2. Response Definition

Expand Down
3 changes: 2 additions & 1 deletion text/157-faceting-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ See [Summarized `task` Object for `202 Accepted`](0060-tasks-api.md#summarized-t
- 🔴 Sending a different Content-Type than `application/json` returns an [invalid_content_type](0061-error-format-and-definitions.md#invalid_content_type) error.
- 🔴 Sending an empty payload returns a [missing_payload](0061-error-format-and-definitions.md#missing_payload) error.
- 🔴 Sending an invalid JSON payload returns a [malformed_payload](0061-error-format-and-definitions.md#malformed_payload) error.
- 🔴 Sending a value with a different type than `Integer` for the `maxValuesPerFacet` field returns an [bad_request](0061-error-format-and-definitions.md#bad_request) error.
- 🔴 Sending a value different from `null` or with a different type than `Integer` for the `maxValuesPerFacet` field returns
a [bad_request](0061-error-format-and-definitions.md#bad_request) error.

###### 3.2.2.2.2.1. Async Errors

Expand Down
3 changes: 2 additions & 1 deletion text/157-pagination-setting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ See [Summarized `task` Object for `202 Accepted`](0060-tasks-api.md#summarized-t
- 🔴 Sending a different Content-Type than `application/json` returns an [invalid_content_type](0061-error-format-and-definitions.md#invalid_content_type) error.
- 🔴 Sending an empty payload returns a [missing_payload](0061-error-format-and-definitions.md#missing_payload) error.
- 🔴 Sending an invalid JSON payload returns a [malformed_payload](0061-error-format-and-definitions.md#malformed_payload) error.
- 🔴 Sending a value with a different type than `Integer` for the `maxTotalHits` field returns an [bad_request](0061-error-format-and-definitions.md#bad_request) error.
- 🔴 Sending a value different from `null` or with a different type than `Integer` for the `maxTotalHits` field returns a
[bad_request](0061-error-format-and-definitions.md#bad_request) error.

###### 3.2.2.2.2.1. Async Errors

Expand Down

0 comments on commit 3eb3d16

Please sign in to comment.