Skip to content

fix(openapi): unwrap boxed schema refs and strip embedded JSON-schema docs#154

Merged
hardbyte merged 4 commits into
mainfrom
fix/openapi-box-unwrapping
May 14, 2026
Merged

fix(openapi): unwrap boxed schema refs and strip embedded JSON-schema docs#154
hardbyte merged 4 commits into
mainfrom
fix/openapi-box-unwrapping

Conversation

@hardbyte
Copy link
Copy Markdown
Contributor

@hardbyte hardbyte commented May 13, 2026

Summary

Three closely related OpenAPI codegen fixes pulled from the fix/openapi-box-unwrapping branch:

  • Unwrap transparent pointer wrappers at the root of a type reference. Previously, a function taking or returning Box<TreeNode> emitted a $ref to #/components/schemas/Box<TreeNode> — a name nothing in the spec ever registered. We now resolve the primitive's fallback (Box<T>T, similarly Rc<T>, Arc<T>, Cow<T>, ...) before emitting the ref, so the schema points at the real component.
  • Gate the unwrap to primitives whose fallback is one of their own generic parameters. The first pass of the fix fired for any primitive with a fallback and collapsed chrono::DateTime, HashSet<T>, and usize/isize to their wire equivalents — losing format: date-time, uniqueItems: true, and the per-type schema component. Restricting to transparent passthroughs keeps the richer representations intact.
  • Strip embedded `
    DetailsJSON schema` blocks from descriptions. Doc comments authored alongside types frequently embed an example JSON-schema snippet for human readers. That snippet was leaking into the generated spec's info/paths/schemas descriptions; the new `sanitize_description` helper removes the `
    ` block and trims trailing whitespace.

hardbyte and others added 4 commits May 14, 2026 08:07
Restrict primitive_fallback_type_ref to primitives whose fallback is just
one of their own generic parameters (Box<T>, Rc<T>, Arc<T>, Cow<T>, ...).
Otherwise unwrapping fired for any primitive with a fallback and collapsed
chrono::DateTime, HashSet<T>, usize/isize down to their wire representation,
losing OpenAPI format/uniqueItems metadata that downstream consumers rely on.
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@github-actions
Copy link
Copy Markdown

📖 Documentation Preview: https://reflectapi-docs-preview-pr-154.partly.workers.dev

Updated automatically from commit 0a538c4

@hardbyte hardbyte merged commit defa090 into main May 14, 2026
6 checks passed
@hardbyte hardbyte deleted the fix/openapi-box-unwrapping branch May 14, 2026 02:22
@hardbyte hardbyte mentioned this pull request May 14, 2026
4 tasks
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.

1 participant