Repository navigation
fix: keep object shape under conditional allOf; stop double-printing error sources - #113
Merged
lightsofapollo merged 2 commits intoOct 29, 2026
Merged
Conversation
…error sources #111: an object schema whose allOf held only if/then/else rules collapsed to serde_json::Value, untagging any discriminated oneOf it was a branch of. The allOf shortcuts ignored the owner's own properties, so a single untyped or $ref member replaced the whole schema (Cloudflare and gcore lost required and optional fields this way). Conditional-only members no longer shape the composed type, owners with their own properties keep their object shape, and branch_resolves_to_object treats such owners as objects. #112: error variants wrapping a source via #[from] also formatted it with {0}, so chain reporters printed every cause twice. Generated HttpError and StreamingError, plus this crate's error types, now leave the source out of their messages. The CLI and wasm playground render the full chain with the new error::error_chain helper. Closes #111 Closes #112 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lightsofapollo
deleted the
fix/111-112-allof-conditionals-error-sources
branch
October 29, 2026 21:05
This was referenced Oct 29, 2026
This branch was successfully deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #111
Closes #112
#111 — conditional
allOfturned objects intoserde_json::ValueRoot cause:
analyze_allof_compositioncollapsed a single-memberallOfto that member without checking the owner's owntype: object/properties. A loneif/thenmember is untyped, soCatbecameserde_json::Value;branch_resolves_to_objectthen saw a non-object branch and untaggedPet.The same blind spot hit
{type: object, properties: {...}, allOf: [$ref Base]}: it becamepub type X = Base, silently dropping the owner's fields. This affects real specs: e.g. CloudflareDnsRecordsDnsRecordBatchPatchlost its requiredid, and gcoreDirectoryItemlostitem_type/items_count.Fix:
allOfmembers holding onlyif/then/else(+ annotations) are value rules, not shape, and are dropped from composition.propertiesalways keeps its object shape.branch_resolves_to_objecttreats anallOfowner withtype: objector own properties as an object.The issue's spec now generates byte-identical output to the same spec without the
allOf.#112 — error chains printed causes twice
Root cause:
#[from]variants also formatted the source with{0}. Fixed in generatedHttpError::{Network, Middleware}andStreamingError::Json, plus this crate'sGeneratorError,HttpErrorandserveredit errors. The CLI and wasm playground printed only the top-levelDisplay, so they now render the chain via a newerror::error_chainhelper (no lost context).Behavior change: callers printing a generated
HttpErrorwith plain{}now see e.g.Network error; walksource()(or use a chain reporter) for the cause. Noted in CHANGELOG.Tests
tests/allof_conditional_member_test.rs— issue repro, inline branch, owner props +$ref, owner props + untyped member,$ref+ conditional alias, and generated-code equality vs. the spec without the rule. All 5 fail onmain.tests/error_source_display_test.rs— syn-parses every generated file (client, SSE/streaming) and the crate's own error modules and fails on any variant that formats its#[from]/#[source]field; plus a chain rendering check. Fails onmain.--profile ci --all-features) + doctests.scripts/gen-diff.sh main: 56 specs change; 54 only in error message text, cloudflare + gcore also gain the dropped fields above.spec-compile.sh cloudflare gcorepasses compile + round trip.examples/generated/(linked in double logging when printing error chains #112) regenerated; it was stale beyond this change.🤖 Generated with Claude Code