From fb80cdcd9aa159c83bac233696eca8684c8c8726 Mon Sep 17 00:00:00 2001 From: Lui Lui <40736418+lui01212@users.noreply.github.com> Date: Sun, 31 Dec 2023 10:00:00 +0700 Subject: [PATCH] docs: name the autocomplete input limit in client.md Both clients refuse autocomplete text of more than maxInputCodePoints code points before they normalise it. client.md did not say so, and normalisation can turn long text into short text, so a client written from the spec alone would send q=FC for 70 spaces after FC. Signed-off-by: Lui Lui <40736418+lui01212@users.noreply.github.com> --- client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.md b/client.md index 4d47ed6..b9f2644 100644 --- a/client.md +++ b/client.md @@ -109,7 +109,7 @@ A client ignores a field that this contract does not use, in a lookup, a reverse - A `lng` that is not finite or is outside -180 to 180. The scenario `reverse-invalid-lng` tests it. - A `maxDistanceM` below 0 or above 250. The OpenAPI file gives the range 0 to 250. NIPOST's OpenAPI file says that the gateway cuts a larger value to 250 without a sign. Gatepost did not test this, so the client rejects it. It does not return a result for another radius. The scenarios `reverse-invalid-max-distance` and `reverse-invalid-negative-distance` test it. The scenarios `reverse-max-distance-zero` and `reverse-max-distance-250` test that both limits pass. - The client writes each number in the query in its shortest decimal form, with no exponent and no trailing zero: `lat=9`, not `lat=9.0` and not `lat=9e0`. A negative zero is written `0`. A small value is written in full: `0.0000001`, not `1e-7`. Languages print numbers in different forms, so one fixed form gives every client the same query for the same input. The mock server compares numbers by value, so it also accepts `9.0`. The scenarios `reverse-plain-decimal` and `reverse-whole-number` test this rule. -- `autocomplete` normalises its text with the core. Empty text, text of more than 11 characters, and text with a character other than A to Z and 0 to 9 raise `invalid_input`, and the client sends no request. The gateway does not answer an empty `q`. The request sends the normalised text: `q=FC01Z`. The scenarios `autocomplete-empty-input`, `autocomplete-too-long`, `autocomplete-bad-character` and `autocomplete-district` test this rule. +- `autocomplete` normalises its text with the core. Text of more than `maxInputCodePoints` code points (64 in `data/format.json`) raises `invalid_input` before the client normalises it, and the client sends no request. Empty text, text of more than 11 characters, and text with a character other than A to Z and 0 to 9 raise `invalid_input`, and the client sends no request. The gateway does not answer an empty `q`. The request sends the normalised text: `q=FC01Z`. The scenarios `autocomplete-empty-input`, `autocomplete-too-long`, `autocomplete-bad-character` and `autocomplete-district` test this rule. ## Errors