Skip to content

fix: describe plain-text --body correctly in command metadata - #506

Merged
petebacondarwin merged 2 commits into
mainfrom
cjol/metadata-text-plain-body
Nov 4, 2026
Merged

petebacondarwin merged 2 commits into
mainfrom
cjol/metadata-text-plain-body

Conversation

@cjol

@cjol cjol commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Command metadata used by cf tools describes every --body as raw JSON,
even for endpoints that send plain text. For bodies whose media types are
all text/plain, reuse the description shown by --help, including for
parameterized media types such as text/plain;charset=UTF-8. When the
schema provides no description, both help and metadata use plain-text
wording instead of asking for JSON.

Keep the existing metadata wording for JSON, application/octet-stream,
and mixed-media bodies. At the pinned OpenAPI version, regeneration updates
the help and metadata for cf analytics-engine sql query and cf logs query.
This keeps the fix scoped to plain-text bodies, replacing the broader #505.

Validation:

  • pnpm check passes, including generation, builds, type checks, lint, and formatting.
  • All 433 generator plugin tests pass across 20 files.
  • The 14 body-description regression cases cover metadata and actual generated
    help, parameterized media types, missing and empty descriptions, mixed content
    types, and unchanged JSON/binary metadata.

_meta/commands.json hardcoded "Raw JSON request body" for every --body,
so cf tools schemas told callers to send JSON to text/plain endpoints
such as zaraz workflow update. For text/plain-only bodies, metadata now
uses the same description as --help. Other bodies are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@506

commit: c1427a3

@ask-bonk

ask-bonk Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

1 inline suggestion posted.

github run

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 280.5 ms 4.1 ms 274.3 ms 286.1 ms
base 284.5 ms 8.8 ms 276.2 ms 306.6 ms

Δ (PR vs base): ↓ -4.0 ms (-1.4%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

@cjol
cjol marked this pull request as ready for review November 4, 2026 12:15
@cjol
cjol requested a review from a team as a code owner November 4, 2026 12:15
@cjol
cjol requested a review from edmundhung November 4, 2026 12:15

@clanky-the-clanker clanky-the-clanker Bot 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.

Superseded by the review of c1427a39.

This review, of b941fcec

💬 Approved with comments — The fix is correct and tested. The only finding is a misplaced doc comment (SUGGESTION).

Findings: 1 suggestion (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 suggestion

The fix is correct and tested. One doc comment now sits above the wrong declaration.

Recommendation: 💬 Optional Nits

  • [SUGGESTION] Doc comment /** generateBuilderLines. */ now attaches to JSON_BODY_DESCRIPTION instead of builderLines. (packages/cli/generator/plugin/emit/builder.ts:26)
View full review
  • packages/cli/generator/plugin/emit/builder.ts:26: the /** generateBuilderLines. */ comment used to sit directly above builderLines. The new exports were inserted between the comment and the function, so it now documents JSON_BODY_DESCRIPTION.

✅ All other checks passed

📝 Documentation: ✅ LGTM

The changeset is a patch with an imperative title. It correctly says metadata now matches --help for text/plain bodies.


Reviewed commit: b941fcec

@ask-bonk

ask-bonk Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@clanky-the-clanker clanky-the-clanker Bot 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.

✅ Approved — The fix is correct, scoped to plain-text bodies, and covered by tests. The earlier doc-comment note is fixed and nothing else was found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

No security concerns.


📖 AGENTS.md: ✅ LGTM

The existing AGENTS.md guidance covers this change. No update is needed.


📋 Code Quality: ✅ LGTM

  • isPlainTextBody treats a body as plain text only when every request content type starts with text/plain. This matches how the generator already classifies plain-text bodies.
  • --help and the metadata both get the description from bodyOptionDescription. JSON, binary and mixed-media bodies keep JSON_BODY_DESCRIPTION.
  • The regenerated outputs change only the --body description.
  • /** generateBuilderLines. */ sits directly above builderLines again.

⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The changeset is a patch with an imperative title, and its body matches the change.


Reviewed commit: c1427a39

@petebacondarwin
petebacondarwin added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 707e9ac Nov 4, 2026
12 checks passed
@petebacondarwin
petebacondarwin deleted the cjol/metadata-text-plain-body branch November 4, 2026 21:39
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.

2 participants