Skip to content

Conversation

ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Sep 3, 2025

What does this PR do?

Screenshot 2025-09-03 at 11 29 41 AM

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

  • New Features
    • Generated clients (Web, React Native, Node) now send object parameters as-is; read-only attributes are no longer removed before requests.
    • Ensures full object payloads are preserved during API calls.
  • Notes
    • No changes to public API signatures.

Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

Walkthrough

Removed 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

  • ItzNotABug
  • abnegate

📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 84e7808 and 8e7d544.

📒 Files selected for processing (3)
  • templates/node/src/services/template.ts.twig (0 hunks)
  • templates/react-native/src/services/template.ts.twig (0 hunks)
  • templates/web/src/services/template.ts.twig (0 hunks)
💤 Files with no reviewable changes (3)
  • templates/web/src/services/template.ts.twig
  • templates/react-native/src/services/template.ts.twig
  • templates/node/src/services/template.ts.twig
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-readonly

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 3ad8053 and 84e7808.

📒 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 removing readonly and guard with a feature flag
Dropping readonly 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 an emitReadonlyModels 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 }};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

@ChiragAgg5k ChiragAgg5k changed the title fix: remove readonly from models fix: remove delete param logic from methods Sep 3, 2025
@abnegate abnegate merged commit f8fbc4b into master Sep 3, 2025
39 checks passed
@abnegate abnegate deleted the fix-readonly branch September 3, 2025 06:50
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