[pull] main from fern-api:main - #910
Merged
Merged
Conversation
Co-authored-by: rishabh.dhadda <rishabh.dhadda@postman.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ed (#17480) * fix(cli-generator): render API errors once, with the server body parsed Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(cli-generator): lift message out of nested detail bodies Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * feat(cli-generator): add --json and --human output shorthands Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(cli-generator): split error advice into help and expose docs_url in JSON Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(cli-generator): keep error.code an HTTP status and clip page-sized bodies Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * chore(cli-generator): clarify 429 reason note in changelog Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(cli-generator): stop repeating the message inside error.details Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(cli-generator): keep usage text out of error.message Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(cli-generator): drop the global --json shorthand and assert wire-test errors on stdout Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(cli-generator): stop fabricating statuses and repeating what the reader already knows Follow-up to the review of this PR, plus four bugs the review surfaced that predate it. Every fix was verified against a real generated CLI (ElevenLabs), not only the fixture. Error envelope - `error.code` is always the HTTP status. The `100..=599` filter only rejected out-of-range application codes, so `{"code": 200}` on a 500 still won and the envelope contradicted its own exit code. The body's code survives in `details`. - The lifted message is removed from `details` by path, not by value. A body whose second entry carried the same sentence as the first lost it entirely — the common multi-field validation shape, where it left problems unattributable to their `loc`. - Only clap's own blocks are split into message/help/usage. Applied to a validator's multi-line message it demoted the violations to `help` and left the bare header in `message`. - Non-JSON bodies are summarised rather than pasted in. A short HTML page is still multi-line markup, so the old byte-count clip never fired on it; the bytes move to `details.body`. Empty bodies and bare JSON strings/lists now yield a sentence instead of `""` or a status summary. - `--format jsonl` emits one line. NDJSON exists to be read a line at a time and a pretty-printed envelope put a bare `{` on the first one. Terminal output - The parsed body is rendered under the message, so a field-level failure names the field instead of hiding the `loc` in an envelope the reader cannot see. - Lines repeating the message, the reason, or an earlier line are dropped, and a sole wrapper object no longer prefixes every line. ElevenLabs echoes one token as `code`, `status` and `type`, turning a one-fact 404 into five lines. - A service-specific reason appears on the message line; one derived from the status stays hidden. Auth - A credential that cannot be read is no longer indistinguishable from one that was never stored. A denied keychain made the CLI send the request anonymously and surface whatever the API says to a stranger. Probing paths still degrade. - The "no credentials" hint fires on any failed status, not just 401/403. An API that answers 404 for an anonymous principal said nothing about `auth login`. This only annotates: the server, not the spec, decides whether auth was needed. - "Check for shadowing" appears only with two or more sources, since one source cannot shadow anything. - Credential hints no longer render a literal `<bin>` placeholder. Transport and dispatch - Failures that never reached a server report `networkError` with no `code`, instead of a fabricated 500 that invited a retry against an uncontacted host. The `source()` chain is walked so "Connection refused" survives. - A request that fails to build (a malformed `--base-url`) is a validation error, not an internal one. - `auth status` honors the global `--format`; `--json` stays as an alias. - `--help` with an explicit machine format emits the operation catalog, as the generated README has always documented. The piped default does not trigger it, so `--help | less` still shows help, and a path with no catalog entry falls back to prose rather than erroring. Co-Authored-By: Claude <noreply@anthropic.com> * fix(cli-generator): drop the dead print_error_json wrapper `print_error_json` wrote the JSON envelope to stdout unconditionally — a working copy of the double-output bug this release removes, left reachable under a name someone would reasonably reach for. Nothing called it: not the runtime, not the generator's emitted code, not any generated CLI. The only reference was its own no-panic test, which now drives `write_error_json` into a buffer instead of the real stdout and covers `Network` and `RawSentinel`, which it previously predated. Also fixes the intra-doc link on `write_error_json`, which still pointed at `ErrorDisplayContext::machine_readable` after that field became `format`. Unresolved rustdoc links in the crate go 17 -> 16; the remaining 16 are pre-existing and in files this PR does not touch. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: rishabh.dhadda <rishabh.dhadda@postman.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )