Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ArnabChatterjee20k
Copy link
Contributor

@ArnabChatterjee20k ArnabChatterjee20k commented Sep 5, 2025

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • Refactor
    • Updated generated SDK typings for arrays with unspecified item types to use broader defaults:
      • JavaScript/Node/Web/React Native/Deno: any[]
      • GraphQL: Json
      • Python: List[Any]
      • Go: []interface{}
    • Explicitly typed arrays remain unchanged; only the fallback typing was adjusted.
    • This change affects type hints only and does not modify runtime behavior or public APIs.

Copy link

coderabbitai bot commented Sep 5, 2025

Walkthrough

This change updates the default fallback type for array items across multiple SDK language generators when an inner item type is unspecified. Defaults shift from string-like to generic/unknown types: PHP/JS/TS targets (CLI, Deno, JS, Node, ReactNative, Web) switch from string[] to any[]; Go from []string to []interface{}; Python from List[str] to List[Any]; GraphQL from [String] to Json. Logic that uses a defined inner type (e.g., getTypeName(parameter['array']) variants) remains unchanged. No public API signatures were modified.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch spatial-type-queries

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

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/SDK/Language/GraphQL.php (1)

37-45: Inconsistent JSON scalar casing (Json vs JSON) will cause schema/type drift

TYPE_ARRAY fallback uses Json while TYPE_OBJECT returns JSON. Pick one. Given this change introduces Json, align object to Json for consistency.

-            case self::TYPE_OBJECT:
-                $type = 'JSON';
+            case self::TYPE_OBJECT:
+                $type = 'Json';
🧹 Nitpick comments (3)
src/SDK/Language/Web.php (1)

233-233: Consider unknown[] over any[] for stricter TS safety

If you want to avoid explicit-any warnings, prefer unknown[].

-                return 'any[]';
+                return 'unknown[]';
src/SDK/Language/CLI.php (1)

371-374: Array fallback changed to any[]: OK; consider unknown[] for safer typing

This widens types as intended and aligns with other generators. If you want stricter safety without losing flexibility, consider unknown[] instead of any[].

-                : 'any[]',
+                : 'unknown[]',
src/SDK/Language/Node.php (1)

45-49: Fallback to any[] accepted; consider unknown[] to avoid unsoundness

any[] matches the PR’s goal; if you want safer typings without restricting callers, unknown[] is a low-risk upgrade.

-                return 'any[]';
+                return 'unknown[]';
📜 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 9630aae and 649e4b5.

📒 Files selected for processing (9)
  • src/SDK/Language/CLI.php (1 hunks)
  • src/SDK/Language/Deno.php (1 hunks)
  • src/SDK/Language/Go.php (1 hunks)
  • src/SDK/Language/GraphQL.php (1 hunks)
  • src/SDK/Language/JS.php (1 hunks)
  • src/SDK/Language/Node.php (1 hunks)
  • src/SDK/Language/Python.php (1 hunks)
  • src/SDK/Language/ReactNative.php (1 hunks)
  • src/SDK/Language/Web.php (1 hunks)
🔇 Additional comments (8)
src/SDK/Language/Web.php (1)

233-233: TS fallback to any[]: LGTM

Consistent with the PR’s goal and other TS targets.

src/SDK/Language/JS.php (2)

146-146: JS/TS fallback to any[]: LGTM

Aligns behavior across JS-family generators.


143-147: JS-family array fallback uses any[] consistently; no string[] remains Snapshots and documentation should be updated accordingly.

src/SDK/Language/Deno.php (1)

149-152: Deno: any[] fallback: LGTM

Matches JS/Web targets; keeps behavior uniform.

src/SDK/Language/ReactNative.php (1)

151-151: ReactNative: any[] fallback: LGTM

Keeps RN aligned with Web/JS.

src/SDK/Language/Go.php (1)

155-158: Go: fallback to []interface{}: LGTM

Idiomatic for unknown element types and consistent with the PR’s intent.

src/SDK/Language/GraphQL.php (1)

37-43: Verify items.type for all array parameters
Untyped arrays (those without an explicit items.type) now map to GraphQL Json instead of a list type (e.g. [String]). Ensure every type: array in your OpenAPI specs includes an items.type to prevent breaking client expectations.

src/SDK/Language/Python.php (1)

245-249: No missing typing imports
The service.py.twig template already includes from typing import List, Dict, Any, covering both List and Any.

@abnegate abnegate merged commit 375a6c9 into master Sep 5, 2025
75 of 76 checks passed
@abnegate abnegate deleted the spatial-type-queries branch September 5, 2025 15: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