Skip to content

codegen: name POST /v3/videos/{video_id} edit - #456

Merged
somanshreddy merged 1 commit into
mainfrom
10-13-video_edit_command
Oct 13, 2026
Merged

somanshreddy merged 1 commit into
mainfrom
10-13-video_edit_command

Conversation

@somanshreddy

Copy link
Copy Markdown
Collaborator

Description

Part of PRINFRA-1487

The API has an Edit Video endpoint, POST /v3/videos/{video_id}. It edits an existing video's scenes and re-renders it under the same video_id. It's hidden from the CLI today (x-cli-visible: false). Codegen derives create for every POST, so once the endpoint is visible it would collide with POST /v3/videos, and make generate would fail with two endpoints map to "create".

This adds a nameOverrides entry naming it edit (heygen video edit <video-id>), following the send and generate overrides, plus examples for the command. Both have to land before the API makes the endpoint visible to the CLI. Otherwise the codegen sync PR that the flip triggers would fail on the collision.

An override and examples for an endpoint the spec hides generate nothing, so this changes no command today.

Testing

  • make generate against experiment-framework master's spec: gen/ is byte-identical with and without this change.
  • Against a copy of that spec with the edit endpoint visible: without this change, codegen fails on the create collision. With it, codegen generates video edit with a positional video-id, the required --idempotency-key header flag and -d. STRICT=1 no longer reports the endpoint as missing examples.
  • New TestGroupEndpoints_VideoEditDoesNotCollideWithCreate: both video POSTs visible give create and edit. Removing the override fails it.
  • make test and make lint pass.

@terencechotai2-commits terencechotai2-commits left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 8f29ef8. The override is right, and I ran both examples end to end.

Examples, run against a build where the endpoint is visible. I took experiment-framework master's external-api.json, dropped x-cli-visible: false from editVideoV3, ran make generate and built the binary.

  • heygen video edit --help shows <video-id> as positional, --idempotency-key and --edit-version as required flags, -d, and all three examples. No missing-examples warning for the endpoint.
  • I ran both examples against a local stub, with real ids in place of the placeholders and a UUID key:
    • narration change → POST /v3/videos/vid123, Idempotency-Key set, body {"edit_version","scenes":[{"id","script":[{"id","type":"text","text"}]}]};
    • scene delete → same path and header, body {"edit_version","actions":[{"type":"delete_scene","scene_id"}]}.
  • Both bodies match the API schema field for field:
    • EditVideoRequest requires only edit_version, and scenes / actions are independent.
    • ScenePatch requires id; script entries not listed stay unchanged, so a one-line patch is valid.
    • TextLinePatch requires id + type.
    • DeleteSceneAction requires type + scene_id.
    • All of these are additionalProperties: false, and neither example sends an extra key.
  • A UUID matches the key pattern ^[A-Za-z0-9_\-:.]{1,255}$.
  • edit_version and the line ids are fields of the scenes read (VideoScenesResponse), so the "take them from 'video scenes get'" hint holds.
  • Leaving out --idempotency-key fails locally with a usage error (exit 2).

Codegen:

  • go test ./codegen/... passes.
  • Removing the override fails TestGroupEndpoints_VideoEditDoesNotCollideWithCreate.

CI: govulncheck is red, and it isn't caused by this PR. It reports new net/http stdlib advisories (GO-2026-6610 … 6617) against go1.25.13, which this PR doesn't change. The last runs on main were 2026-10-08, before those advisories, so the next PR will hit the same failure until the toolchain is bumped. Everything else passes.

FYI, not caused by this PR: with -d and no edit_version in the JSON, the CLI sends the request even though --edit-version is listed as required. The API's 400 still catches it.

— tai2

@somanshreddy
somanshreddy enabled auto-merge (squash) October 13, 2026 11:17

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at 8f29ef86. This adds to tai2's review, which ran the examples against a stub.

I checked the generated output against experiment-framework master's openapi/external-api.json, with and without this PR:

  • Endpoint hidden (today): gen/ from this head and from main is identical (diff -r clean). It changes nothing until the flip.
  • Endpoint visible (x-cli-visible: true):
    • main fails: Add an entry to nameOverrides ... to disambiguate.
    • This head generates video edit with the required idempotency-key header flag, and both examples end up in the help text.
    • The only missing-examples warnings are the two unrelated /v3/models/images endpoints.
  • Examples vs the spec: EditVideoRequest requires only edit_version. ScenePatch needs id, TextLinePatch needs id + type: "text", and DeleteSceneAction needs type: "delete_scene" + scene_id. All of these are additionalProperties: false, and both example bodies use exactly those keys. Idempotency-Key is a required header (RequiredIdempotencyKey), so --idempotency-key is right in both.
  • Test: removing the override makes TestGroupEndpoints_VideoEditDoesNotCollideWithCreate fail.

Side note, not this PR: gen/ on main is already behind master's spec. Regenerating from it changes 7 files even with the edit endpoint hidden, so the next codegen sync PR will carry more than the flip.

Reuse: the existing nameOverrides mechanism, same shape as send / generate · Simpler: already minimal (one map entry, examples, one test).

— Rames

@somanshreddy
somanshreddy merged commit 517c3f4 into main Oct 13, 2026
8 of 9 checks passed
@somanshreddy
somanshreddy deleted the 10-13-video_edit_command branch October 13, 2026 18:02
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