Skip to content

fix(schema): spell --schema flags and placeholders the way --help does - #86

Merged
ernestoongaro merged 2 commits into
mainfrom
fix/schema-canonical-names
Aug 28, 2026
Merged

fix(schema): spell --schema flags and placeholders the way --help does#86
ernestoongaro merged 2 commits into
mainfrom
fix/schema-canonical-names

Conversation

@ernestoongaro

Copy link
Copy Markdown
Collaborator

--schema still rendered query-param flags and positional placeholders via slugify() (--basemodelid, <modelid>) after #77/#80 moved flag registration, the usage line and the Arguments block to canonicalName() (--base-model-id, <model-id>). So --schema told agents a spelling that appears nowhere else in the CLI.

Before / after (omni models list --schema | jq '.queryParams[0].flag'): "--basemodelid""--base-model-id".

Two-line fix in internal/openapi/schema.go, plus the test that had been asserting the old spelling.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ei8UYaG1bW5PJhk93EaqzA

--schema still rendered query-param flags and positional placeholders with
slugify() ("--basemodelid", "<modelid>") after #77 and #80 moved the flag
registry, usage line and Arguments block to canonicalName()
("--base-model-id", "<model-id>"). An agent reading --schema was told a
flag name that no longer appears anywhere else in the CLI.

Use canonicalName in both places and assert the kebab-case spelling in the
bodyless-GET schema test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ei8UYaG1bW5PJhk93EaqzA
@ernestoongaro
ernestoongaro requested a review from dspangen August 28, 2026 12:59
Comment thread internal/openapi/schema.go Outdated
for _, q := range op.QueryParams {
doc.QueryParams = append(doc.QueryParams, SchemaQueryParam{
Flag: "--" + slugify(q.Name),
Flag: "--" + canonicalName(q.Name),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codex review [P2]: canonicalName(q.Name) still disagrees with the CLI when resolveQueryFlags renames collisions. For example, baseUrl is registered as --param-base-url, while this schema advertises the global --base-url; duplicate canonical names similarly require -2 suffixes. Please iterate over resolveQueryFlags(op) and emit qf.Name with fields from qf.Param. The current test only uses limit and severity, so it does not exercise this changed query-flag behavior.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch — fixed in 9a7e975: the schema now iterates resolveQueryFlags(op) and emits qf.Name, so baseUrl--param-base-url and duplicate canonical names get their -2 suffix. Added TestSchema_QueryFlagsReflectCollisionRenames, which covers both rename paths and asserts every advertised flag is actually registered on the command.

canonicalName alone still disagreed with the CLI when flag registration
renames a collision: a "baseUrl" param registers as --param-base-url (the
global --base-url is reserved) and a second param canonicalising to the
same name gets a -2 suffix. Iterate resolveQueryFlags(op) so --schema
advertises exactly the flags the command accepts, and add a test that
covers both rename paths and checks each advertised flag is registered.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ei8UYaG1bW5PJhk93EaqzA
@ernestoongaro
ernestoongaro merged commit 20bd77b into main Aug 28, 2026
2 checks passed
@ernestoongaro
ernestoongaro deleted the fix/schema-canonical-names branch August 28, 2026 14:07
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