Prepend #/components/schemas/ to typebox references while building schema#337
Prepend #/components/schemas/ to typebox references while building schema#337StratusFearMe21 wants to merge 2 commits into
#/components/schemas/ to typebox references while building schema#337Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough
ChangesTypeBox Ref & Recursive Enum Normalization
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openapi.ts`:
- Around line 651-652: The current check only converts top-level Ref nodes
(schema[Kind] === 'Ref' && schema.$ref) via toRef, but does not traverse
composition schemas (TypeBox Union/Intersect/Discriminator or schemas with
anyOf/allOf/oneOf/not) so nested $ref values remain unnormalized; update the
normalization path that contains schema[Kind] and the toRef call to recursively
walk composition properties (anyOf/allOf/oneOf/not and discriminator mappings)
and replace any nested schema objects with toRef(schema.$ref) where schema[Kind]
=== 'Ref', and ensure Union/Intersect/Discriminator handling code invokes this
traversal so all internal refs are normalized consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
|
Thanks for catching that CodeRabbit. My solution was to just iterate through the entire object generically. The function itself stops iteration of the schema is not of type 'object', and only makes modifications to the schema if |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openapi.ts`:
- Around line 655-659: The code mutates the input _schema by assigning into
schema when iterating; instead create a cloned structure (e.g., deep
clone/structuredClone or a shallow copy of top-level entries and recursively map
nested objects) and run enumToOpenApi on the clone so the original _schema is
not modified; locate the block using _schema, schema and enumToOpenApi and
replace the in-place assignment with transformation into and return of a new
cloned object.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
26c4ea9 to
18b395b
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
This PR fixes the bug described in #310 by crawling the TypeBox schema during the
enumToOpenApistep, finding instances of references, and callingtoRefon them. Absolutely love what you guys are doing, keep up the great work!Summary by CodeRabbit