Skip to content

feat(API): add linked_key field to key list responses #STRINGS-4425 - #1361

Merged
Mikko Karkee (Varpuspaavi) merged 3 commits into
mainfrom
openapi-sync/strings-app-pr-19356
Nov 5, 2026
Merged

Mikko Karkee (Varpuspaavi) merged 3 commits into
mainfrom
openapi-sync/strings-app-pr-19356

Conversation

@phrase-bot

@phrase-bot Phrase (phrase-bot) commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

This PR was generated by the openapi-apply agent in response to a
/openapi-sync apply request on
Phrase-Engineering/strings-app#19356.

What changed in the API

  • GET /api/v2/projects/{project_id}/keys now accepts an optional include_linked_keys boolean query parameter. When true, each key object in the response includes a linked_key field describing whether the key is a parent, a child, or unlinked in a key-link relationship.
  • POST /api/v2/projects/{project_id}/keys/search receives the same include_linked_keys parameter and the same linked_key field, since the search endpoint routes to the same index action.
  • Without the parameter (or with include_linked_keys=false), the linked_key field is omitted entirely from each key object — the response shape is unchanged from before this PR.

Source

Notes for reviewers

Pre-existing convention issue (not introduced by this PR): both paths/keys/index.yaml and paths/keys/search.yaml combine "$ref": "../../responses.yaml#/403" with a sibling description: on the 403 response. Per the conventions doc, $ref replaces the entire object and siblings are silently ignored. This was present before this change and is out of scope for this PR, but worth a follow-up to either drop the sibling description or write the 403 inline.


Opened automatically by the openapi-apply agent. Review the spec changes
against the linked strings-app PR; the agent does not vouch for correctness
beyond "the YAML parsed and the documented layout was followed."

Update: linked_key shape (nullable)

Real responses contain nulls when include_linked_keys=true:

  • not linked: linked_key: null
  • parent: {role: "parent", parent: null, children_count: N}
  • child: {role: "child", parent: {id, name}, children_count: null}

The spec now reflects that:

  • linked_key and its parent are named component schemas (translation_key_linked_key, translation_key_linked_key_parent) with nullable: true, referenced via plain $ref from translation_key. children_count is a nullable integer.
  • The Go generator emitted references to undefined Nullable<Model> types for nullable model fields. openapi-generator/templates/go/model.mustache now renders nullable model-typed fields as *Model. Primitives still use Nullable<Primitive>. Generated Go for the existing spec is byte-identical with and without the template change.
  • linked_key is on the shared translation_key schema, so it also appears (optional, absent unless requested) in the schemas used by GET/PATCH /keys/{id}, POST /keys and the screenshot marker responses. The app only returns it from the list and search endpoints; the field description says so.

Checked locally: make lint; Go generate + build + a JSON decode check (absent and null decode to nil); Java main + tests compile; TypeScript tsc; Python deserialization. Not confirmed: PHP/Ruby beyond what CI runs, and the response shape is taken from the strings-app PR description, not from a live API call.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

API changelog (oasdiff)

Doc-only edits (descriptions, examples) do not appear here.

11 changes: 0 error, 0 warning, 11 info
info	[new-optional-request-parameter] at doc/compiled.json
	in API GET /projects/{project_id}/keys
		added the new optional `query` request parameter `include_linked_keys`

info	[response-optional-property-added] at doc/compiled.json
	in API GET /projects/{project_id}/keys
		added the optional property `items/linked_key` to the response with the `200` status

info	[response-optional-property-added] at doc/compiled.json
	in API POST /projects/{project_id}/keys
		added the optional property `allOf[subschema #1: translation_key]/linked_key` to the response with the `201` status

info	[new-optional-request-parameter] at doc/compiled.json
	in API POST /projects/{project_id}/keys/search
		added the new optional `query` request parameter `include_linked_keys`

info	[response-optional-property-added] at doc/compiled.json
	in API POST /projects/{project_id}/keys/search
		added the optional property `items/linked_key` to the response with the `200` status

info	[response-optional-property-added] at doc/compiled.json
	in API GET /projects/{project_id}/keys/{id}
		added the optional property `allOf[subschema #1: translation_key]/linked_key` to the response with the `200` status

info	[response-optional-property-added] at doc/compiled.json
	in API PATCH /projects/{project_id}/keys/{id}
		added the optional property `allOf[subschema #1: translation_key]/linked_key` to the response with the `200` status

info	[response-optional-property-added] at doc/compiled.json
	in API GET /projects/{project_id}/screenshots/{id}/markers
		added the optional property `items/translation_key/linked_key` to the response with the `200` status

info	[response-optional-property-added] at doc/compiled.json
	in API PATCH /projects/{project_id}/screenshots/{screenshot_id}/markers
		added the optional property `translation_key/linked_key` to the response with the `200` status

info	[response-optional-property-added] at doc/compiled.json
	in API POST /projects/{project_id}/screenshots/{screenshot_id}/markers
		added the optional property `translation_key/linked_key` to the response with the `201` status

info	[response-optional-property-added] at doc/compiled.json
	in API GET /projects/{project_id}/screenshots/{screenshot_id}/markers/{id}
		added the optional property `translation_key/linked_key` to the response with the `200` status

@forelabs

Copy link
Copy Markdown
Member

It probably has an issue with optional attributes 🤔

…#STRINGS-4425

The Go generator emits references to undefined Nullable<Model> types for
nullable inline objects (linked_key, linked_key.parent). Remove nullable
from those two objects and keep the null semantics in the descriptions.

Also pass the new include_linked_keys argument in KeysApiTest for
keysList and keysSearch so the Java test sources compile.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… #STRINGS-4425

linked_key is null for unlinked keys and parent/children_count are null
for the opposite role, so restore nullable on the response schemas.

- Move linked_key and its parent into named components
  (translation_key_linked_key, translation_key_linked_key_parent) with
  nullable: true, referenced by a plain $ref from translation_key.
- Go template: render nullable model-typed fields as *Model instead of
  *Nullable<Model> (which is never defined). Primitives are unchanged;
  generated Go for the existing spec is byte-identical.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants