From 681484140cc334267cf2b083a3a4424f7f06251f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=C2=A0Charv=C3=A1t?= Date: Sat, 1 Aug 2026 18:46:41 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(glossary):=20expose=20exactMat?= =?UTF-8?q?ch=20on=20glossary=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Features - Add `exactMatch` to `GlossaryRecord` (required) and to `GlossaryCreateRequest` / `GlossaryUpdateRequest` (optional; the public API defaults it to `true` when omitted) ## Tests - Assert `exactMatch` is read back in `api.glossary.list` - Cover the provided-on-write path in `api.glossary.update` The public glossary endpoint (server-publicapi / PubApiGlossary) always returns exactMatch and accepts it on write; the client was missing it. `lang` is intentionally left as a locale string — that matches the public payload (the numeric langId belongs to the internal API). Co-Authored-By: Claude Opus 4.8 (1M context) --- src/types/glossary-create-request.ts | 6 ++++++ src/types/glossary-record.ts | 5 +++++ src/types/glossary-update-request.ts | 6 ++++++ tests/fixtures/full-project/glossary.json | 3 ++- tests/specs/glossary.spec.ts | 4 +++- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/types/glossary-create-request.ts b/src/types/glossary-create-request.ts index 80a5f4b..8832a69 100644 --- a/src/types/glossary-create-request.ts +++ b/src/types/glossary-create-request.ts @@ -22,6 +22,12 @@ export type GlossaryCreateRequest = { */ caseSensitive: boolean; + /** + * Whether the term must match exactly (as opposed to matching any inflected form). + * Defaults to `true` server-side when omitted. + */ + exactMatch?: boolean; + /** * Contains an array of the term and it’s translations. */ diff --git a/src/types/glossary-record.ts b/src/types/glossary-record.ts index c3b74f2..f29d7e7 100644 --- a/src/types/glossary-record.ts +++ b/src/types/glossary-record.ts @@ -21,6 +21,11 @@ export type GlossaryRecord = { */ caseSensitive: boolean; + /** + * Whether the term must match exactly (as opposed to matching any inflected form). + */ + exactMatch: boolean; + /** * Contains an array of the term and it’s translations. */ diff --git a/src/types/glossary-update-request.ts b/src/types/glossary-update-request.ts index 200b9c0..8e486bb 100644 --- a/src/types/glossary-update-request.ts +++ b/src/types/glossary-update-request.ts @@ -28,6 +28,12 @@ export type GlossaryUpdateRequest = { */ caseSensitive: boolean; + /** + * Whether the term must match exactly (as opposed to matching any inflected form). + * Defaults to `true` server-side when omitted. + */ + exactMatch?: boolean; + /** * Contains an array of the term and it’s translations. */ diff --git a/tests/fixtures/full-project/glossary.json b/tests/fixtures/full-project/glossary.json index dd77317..d77c1a3 100644 --- a/tests/fixtures/full-project/glossary.json +++ b/tests/fixtures/full-project/glossary.json @@ -10,7 +10,8 @@ ], "description": "A screen used for displaying visual output from a computer.", "translateTerm": false, - "caseSensitive": false + "caseSensitive": false, + "exactMatch": true } ] } diff --git a/tests/specs/glossary.spec.ts b/tests/specs/glossary.spec.ts index 381b8d1..859ad2c 100644 --- a/tests/specs/glossary.spec.ts +++ b/tests/specs/glossary.spec.ts @@ -32,6 +32,7 @@ describe('Glossary', (): void => { expect(firstRecord.description).toBe( 'A screen used for displaying visual output from a computer.', ); + expect(firstRecord.exactMatch).toBe(true); }); test('api.glossary.find', async (): Promise => { @@ -94,6 +95,7 @@ describe('Glossary', (): void => { description: 'Exceptional term description', caseSensitive: true, translateTerm: true, + exactMatch: false, term: [{ lang: 'en', term: 'Exceptional term' }], }; const spy: MockInstance = vi.spyOn(globalThis, 'fetch'); @@ -102,7 +104,7 @@ describe('Glossary', (): void => { expect(spy).toHaveBeenCalledWith( 'https://api.localazy.com/projects/_a0000000000000000001/glossary/_a0000000000000000001', { - body: '{"description":"Exceptional term description","caseSensitive":true,"translateTerm":true,"term":[{"lang":"en","term":"Exceptional term"}]}', + body: '{"description":"Exceptional term description","caseSensitive":true,"translateTerm":true,"exactMatch":false,"term":[{"lang":"en","term":"Exceptional term"}]}', headers: { Accept: 'application/json', Authorization: `Bearer ${getToken()}`,