fix(schema): spell --schema flags and placeholders the way --help does - #86
Conversation
--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
| for _, q := range op.QueryParams { | ||
| doc.QueryParams = append(doc.QueryParams, SchemaQueryParam{ | ||
| Flag: "--" + slugify(q.Name), | ||
| Flag: "--" + canonicalName(q.Name), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
--schemastill rendered query-param flags and positional placeholders viaslugify()(--basemodelid,<modelid>) after #77/#80 moved flag registration, the usage line and the Arguments block tocanonicalName()(--base-model-id,<model-id>). So--schematold 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