Skip to content

Fix enum collision names, multipart JSON parts, and operation deprecation - #98

Merged
lightsofapollo merged 6 commits into
mainfrom
integrate/pr93-pr94-pr97
Oct 3, 2026
Merged

lightsofapollo merged 6 commits into
mainfrom
integrate/pr93-pr94-pr97

Conversation

@lightsofapollo

@lightsofapollo lightsofapollo commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Combine the reviewed enum naming, multipart JSON encoding, and operation deprecation changes from #93, #94, and #97. Colliding enum variants use camel-case numbered names, multipart object fields are sent as JSON parts with declared content types, and deprecated client operations warn their callers.

The deprecation regression test now passes --color=never to its child Cargo command. CI sets CARGO_TERM_COLOR=always, which previously inserted ANSI escapes into the diagnostics and caused the test to count zero deprecation errors despite the expected two being present.

The branch preserves the original PR commits, reconciles the changelog, and regenerates the combined corpus manifest. #96 is excluded pending its nullable file-array and helper/model naming fixes, documented in #96 (comment).

Validation: CARGO_TERM_COLOR=always cargo nextest run --profile ci --all-features passes all 718 tests (6 skipped), including generated multipart clients/servers and WebAssembly compilation. Formatting, Clippy with warnings denied, 7 doctests (3 ignored), and documentation with warnings denied pass. The corpus manifest was regenerated across all 56 pinned specifications (224 generated files); GitHub's corpus-diff gate also passes. The unchanged deprecation test failed with CI color enabled, and the one-line child-Cargo color override fixes it.

iamralch and others added 6 commits October 3, 2026 07:06
Enum values whose names collide once converted to an identifier were
numbered with an underscore: `"amber-strict"` and `"amber+strict"` were
`AmberStrict` and `AmberStrict_2`. rustc's `non_camel_case_types` lint
accepts an underscore only between two characters without case, so
every such variant warned.

Schema and parameter enums now share `numbered_variant_name`, which
appends the number directly (`AmberStrict2`) and keeps the underscore
only after a digit, where dropping it would run two numbers together
(`"v1"` and `"V1"` are `V1` and `V1_2`).

The corpus moves for 11 specs, by renames only: no public item appears
or disappears.

Fixes #89
A multipart field that wasn't binary or a scalar made the generated
method return `HttpError::Config` before sending anything, so any
operation with an object field couldn't be called. Cloudflare's KV
write with metadata, Images upload and Pages deployments are among them.

Following OpenAPI's encoding defaults, a field that is an object, a
union of objects or arbitrary JSON is now one part, serialized with
serde_json and typed `application/json`.

`encoding.<field>.contentType` is now carried into the analysis. When it
names a single media type, that is the part's type, whatever the field
holds: `image/png` on a binary field, `text/plain; charset=utf-8` on a
string, another JSON type on an object. A comma-separated list, or a
range such as `image/*`, is the set the server accepts, so the part
gets none. Parts with neither a filename nor a content type are emitted
as before.

Arrays, including arrays of files, are still rejected. They are the
second half of #87.

Across the corpus, the generated methods that return this error go from
64 to 36, all of them array fields.

Refs #87
`Operation.deprecated` was parsed and then dropped: `OperationInfo` had
no field for it, so `generate_operation_doc_comment`'s promise to mark
the method `#[deprecated]` was never kept, and T13's acceptance
criterion stayed open.

`OperationInfo.deprecated` carries it now, and every client method
generated for a deprecated operation is `#[deprecated]`, its transport
variants and builder entry point included. A builder's `send` calls the
method on the caller's behalf, who was warned at the entry point, so it
allows the deprecation rather than warning in the generated code.

The corpus moves for the 24 specs with deprecated operations, by 735
`#[deprecated]` lines and nothing else.

Fixes #95
@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openapi-to-rust Ready Ready Preview Oct 3, 2026 1:26pm UTC

Request Review

@lightsofapollo lightsofapollo changed the title Unify enum naming, multipart JSON parts, and deprecated operations Fix enum collision names, multipart JSON parts, and operation deprecation Oct 3, 2026
@lightsofapollo
lightsofapollo merged commit 977d087 into main Oct 3, 2026
@lightsofapollo
lightsofapollo deleted the integrate/pr93-pr94-pr97 branch October 3, 2026 13:43

This branch was successfully deployed

1 active deployment
Preview — ae5dd14e Deployed Oct 3, 2026 by vercel[bot]
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