-
Notifications
You must be signed in to change notification settings - Fork 188
fix: remove delete param logic from methods #1181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughRemoved code in the Node, React Native, and Web service templates that previously deleted read-only properties from object-typed method parameters before constructing requests. The change eliminates the iteration over read-only attributes and the corresponding deletions, resulting in full object parameters being sent without sanitization. Payload construction, API path resolution, headers, and request logic remain unchanged. No exported or public entity signatures were modified. Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (3)
💤 Files with no reviewable changes (3)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
templates/react-native/src/models.ts.twig
(1 hunks)templates/web/src/models.ts.twig
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: build (8.3, Python312)
- GitHub Check: build (8.3, Python311)
- GitHub Check: build (8.3, PHP80)
- GitHub Check: build (8.3, KotlinJava11)
- GitHub Check: build (8.3, KotlinJava17)
- GitHub Check: build (8.3, Go118)
- GitHub Check: build (8.3, FlutterBeta)
- GitHub Check: build (8.3, DotNet80)
- GitHub Check: build (8.3, DartBeta)
- GitHub Check: build (8.3, DotNet60)
- GitHub Check: build (8.3, Deno1193)
- GitHub Check: build (8.3, DartStable)
- GitHub Check: build (8.3, Android5Java17)
- GitHub Check: build (8.3, Android14Java17)
🔇 Additional comments (1)
templates/web/src/models.ts.twig (1)
17-17
: Verify intent of removingreadonly
and guard with a feature flag
Droppingreadonly
weakens immutability guarantees and is a breaking type change; initial regex scans found no downstream usages, but absence of evidence isn’t proof—manually confirm impact on consumers. If intentional, document as breaking and add anemitReadonlyModels
guard:- {{ property.name }}{% if not property.required %}?{% endif %}: {{ property | getSubSchema(spec) | raw }}; + {% if emitReadonlyModels is not defined or emitReadonlyModels %}{% if property.readOnly %}readonly {% endif %}{% endif %}{{ property.name }}{% if not property.required %}?{% endif %}: {{ property | getSubSchema(spec) | raw }};
* {{ property.description }} | ||
*/ | ||
{% if property.readOnly %}readonly {% endif %}{{ property.name }}{% if not property.required %}?{% endif %}: {{ property | getSubSchema(spec) | raw }}; | ||
{{ property.name }}{% if not property.required %}?{% endif %}: {{ property | getSubSchema(spec) | raw }}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same breaking change for RN models; consider configurable or dual-type export
Mirrors the Web template risk. Either guard with a flag or export a writable alias while retaining immutable models for responses.
Option A (flagged, same as Web):
- {{ property.name }}{% if not property.required %}?{% endif %}: {{ property | getSubSchema(spec) | raw }};
+ {% if emitReadonlyModels is not defined or emitReadonlyModels %}{% if property.readOnly %}readonly {% endif %}{% endif %}{{ property.name }}{% if not property.required %}?{% endif %}: {{ property | getSubSchema(spec) | raw }};
Option B (keep immutable models and add writable mapped types outside this loop):
// helper once per file
type Mutable<T> = { -readonly [K in keyof T]: T[K] };
// downstream SDKs can use: Mutable<Models.User>
🤖 Prompt for AI Agents
templates/react-native/src/models.ts.twig around line 14: the generated RN
models are immutable-only which can break downstream SDKs; add a configurable
option or provide writable aliases. Add a single helper type once per file, e.g.
a Mutable<T> mapped type, and after the model declarations emit writable aliases
(export type Mutable<ModelName> = Mutable<ModelName>) for each model;
alternatively honor a template flag (e.g., generateMutableModels) to switch the
property generation to writable instead of readonly. Ensure the helper is
emitted once at the top and the aliases are emitted after the model loop so
consumers can opt-in to mutable variants without changing the main immutable
types.
84e7808
to
8e7d544
Compare
What does this PR do?
we dont need to remove readonly params manually
Test Plan
Related PRs and Issues
Have you read the Contributing Guidelines on issues?
yes.
Summary by CodeRabbit