feat(API): add key format annotations list endpoint #STRINGS-3028 - #1222
Conversation
API changelog (oasdiff)Doc-only edits (descriptions, examples) do not appear here. |
Regenerate doc/compiled.json so compare-output passes. Remove the `enum` constraint from `cldr_version` in the ICU skeleton endpoint to work around a typescript-fetch generator bug where inline enums inside inline request body schemas produce a reference to an undefined type (IcuSkeletonParametersCldrVersionEnum). Valid values are documented in the field description; server-side validation is unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Restore `cldr_version` enum values (removed in previous commit, which oasdiff flagged as breaking). Change the inline request body schema title from `icu/skeleton/parameters` to `icu_skeleton_parameters` so the TypeScript-fetch generator can correctly derive and emit the enum type declaration (the slash-based title caused the generator to reference IcuSkeletonParametersCldrVersionEnum without emitting its definition). Regenerate compiled.json with the project-installed swagger-cli to match CI output exactly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…build The TypeScript-fetch generator fails to emit the enum declaration for inline string enums inside inline request body schemas that also use oneOf (a known generator bug). Moving cldr_version to a named component schema (icu_skeleton_cldr_version) gives the generator a proper named type, which it handles correctly. Enum values are unchanged so oasdiff does not flag a breaking change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new key-scoped endpoint to list “format annotations” stored directly on a translation key, and wires the new schema/tag into the OpenAPI components and generated docs. It also refactors the ICU skeleton endpoint to reuse a shared schema for cldr_version.
Changes:
- Added GET
/projects/{project_id}/keys/{id}/format_annotationsreturning an array offormat_annotation. - Introduced
format_annotationschema and registered it inschemas.yaml. - Extracted ICU skeleton
cldr_versioninto a reusableskeleton_cldr_versionschema (and updated the ICU skeleton path to$refit).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| schemas/icu.yaml | Adds reusable skeleton_cldr_version enum schema for ICU skeleton construction. |
| schemas/format_annotation.yaml | Introduces new format_annotation object schema. |
| schemas.yaml | Registers new schemas (icu_skeleton_cldr_version, format_annotation) in components. |
| paths/key_format_annotations/index.yaml | Defines the new “list format annotations for a key” operation. |
| paths/icu/skeleton.yaml | Updates request schema title and reuses the new skeleton_cldr_version schema via $ref. |
| paths.yaml | Adds the new /projects/{project_id}/keys/{id}/format_annotations route entry. |
| main.yaml | Adds the new tag and includes it in x-tagGroups. |
| doc/compiled.json | Updates compiled OpenAPI output to reflect the spec changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Revert ICU skeleton schema title to icu/skeleton/parameters — consistent with all other request body schemas in the repo; the title change was an intermediate attempt that is no longer needed. Add missing pieces to the format annotations endpoint: - Rate-limit headers on the 200 response - 400 response - Scoped 403 description noting the required read scope Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| skeleton_cldr_version: | ||
| type: string | ||
| description: >- | ||
| Pluralization rule set to apply when constructing skeletons. | ||
| Accepted values are `legacy` and `cldr_41`. Defaults to | ||
| `legacy` when omitted. | ||
| enum: | ||
| - legacy | ||
| - cldr_41 | ||
| example: cldr_41 |
There was a problem hiding this comment.
Franca Winter (@francawinter) where is this from? 👀
There was a problem hiding this comment.
claude: Added by us to fix a pre-existing TypeScript CI failure. Moved to separate PR: #1223
| icu_skeleton_cldr_version: | ||
| "$ref": schemas/icu.yaml#/skeleton_cldr_version |
There was a problem hiding this comment.
this should be unrelated
There was a problem hiding this comment.
claude: Agreed, unrelated to the new endpoint. Moved to separate PR #1223
| Only annotations stored directly on the key are returned. Annotations stored on the | ||
| key's translations (per locale) are excluded. | ||
|
|
||
| Results are ordered by insertion order (ascending by internal ID) and capped at 1,000 | ||
| entries. When a key has more than 1,000 stored annotations, only the first 1,000 are | ||
| returned without an error or any indication that the list was truncated. |
There was a problem hiding this comment.
Franca Winter (@francawinter) i think this should be rephrased a bit. to remove the translations part, the order and error part
There was a problem hiding this comment.
claude: Fixed in 607b55e — removed the translations/per-locale note, the ordering detail, and the truncation wording. Description is now two sentences.
| The public file format name that produced this annotation. Possible values include | ||
| `arb`, `xliff_2`, `xlf`, `xml`, `ts`, and `strings_catalog`. Internal-only format | ||
| variants (such as `xliff_jobsync`) are never returned; they are collapsed to their | ||
| public equivalent (for example, `xliff_jobsync` is reported as `xliff_2`). |
There was a problem hiding this comment.
i don't think we should document specific formats here. this can get quickly out of date
There was a problem hiding this comment.
claude: Fixed in 6fd5dcf — removed the format list entirely.
| The original file-format snippet captured when the key was imported, returned | ||
| byte-for-byte without transformation, reformatting, or additional escaping. | ||
| May contain multi-line content. |
There was a problem hiding this comment.
feels a bit overly verbose and byte-for-byte seems a odd way to say we return the original representation
There was a problem hiding this comment.
claude: Fixed in 607b55e — changed to "Returned as-is, may contain multi-line content."
Rewrite endpoint and schema descriptions to match existing style: shorter sentences, no internal implementation detail, plain English. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The TypeScript generator fix for the icu/skeleton endpoint is unrelated to the format annotations endpoint. Extracted to its own PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This PR was generated by the
openapi-applyagent in response to a/openapi-sync applyrequest onPhrase-Engineering/strings-app#18256.
What changed in the API
readOAuth scope.Source
Notes for reviewers
swagger-cli validate main.yamlpassed cleanly with no warnings.Key Format Annotationstag was added tomain.yamland wired into theCore Resourcesx-tagGroups section (immediately afterKeys). If a different grouping is preferred, adjustx-tagGroupsinmain.yamlbefore merging.security:block that appeared in the proposal — the scheme names (basicAuthentication,oAuth2) do not match the repo's security schemes (Token,Basic), and security is inherited from the root level, consistent with all other key-scoped operations.x-cli-version: "2.5"is included as proposed; confirm whether this endpoint should have a different CLI version or none at all.Opened automatically by the
openapi-applyagent. Review the spec changesagainst the linked strings-app PR; the agent does not vouch for correctness
beyond "the YAML parsed and the documented layout was followed."
Will look like this: