Skip to content

Conversation

ymc9
Copy link
Member

@ymc9 ymc9 commented Aug 17, 2025

No description provided.

Copy link
Contributor

coderabbitai bot commented Aug 17, 2025

📝 Walkthrough

Walkthrough

Version bump and changelog updates for JetBrains IDE package. OpenAPI plugin adds AST TypeDef/enum support, conditional inclusion of @@openapi.ignore, and extended tests. TanStack Query plugin adjusts Angular generator typings/imports and runtime to support function-based args resolution. Integration tests update Prisma versions.

Changes

Cohort / File(s) Summary
JetBrains IDE metadata
packages/ide/jetbrains/CHANGELOG.md, packages/ide/jetbrains/build.gradle.kts
Added changelog entries; bumped version 2.18.0 → 2.18.1.
OpenAPI plugin core
packages/plugins/openapi/src/generator-base.ts, packages/plugins/openapi/src/rpc-generator.ts
Added includeOpenApiIgnored option to model inclusion; implemented AST TypeDef/enum support, TypeDef components, TypeDef-aware field mapping, and JSON-TypeDef resolution.
OpenAPI tests
packages/plugins/openapi/tests/openapi-rpc.test.ts
Added tests for complex nested TypeDefs across OpenAPI 3.0/3.1; included model fields using @JSON with TypeDefs; note duplicated test block.
TanStack Query plugin (Angular)
packages/plugins/tanstack-query/src/generator.ts, packages/plugins/tanstack-query/src/runtime-v5/angular.ts
Generator: for Angular, args can be a value or function; updated Angular import source to experimental package. Runtime: added AnyFn/isFn, resolved function args in useModelQuery/useInfiniteModelQuery, adjusted returns and imports.
Integration tests
tests/integration/tests/cli/plugins.test.ts
Bumped @prisma/client and prisma to 6.14.x.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant OpenAPIGeneratorBase
  participant AST
  participant RPCGenerator
  participant OpenAPI

  User->>OpenAPIGeneratorBase: generate(spec, options{ includeOpenApiIgnored })
  OpenAPIGeneratorBase->>AST: load models/enums/typedefs
  OpenAPIGeneratorBase->>OpenAPIGeneratorBase: filter models by @@openapi.ignore (if false)
  OpenAPIGeneratorBase->>RPCGenerator: generateComponents(models, enums, typedefs)
  RPCGenerator->>OpenAPI: add model schemas
  RPCGenerator->>OpenAPI: add TypeDef schemas
  RPCGenerator->>OpenAPI: add missing AST enums
  RPCGenerator->>OpenAPI: map fields (JSON→TypeDef ref if applicable)
  OpenAPI-->>User: OpenAPI document
Loading
sequenceDiagram
  participant Component
  participant useModelQuery
  participant Helpers as isFn/makeUrl
  participant TanStack as injectQuery
  Component->>useModelQuery: args (value or () => value), options
  useModelQuery->>Helpers: isFn(args)
  Helpers-->>useModelQuery: resolvedArgs
  useModelQuery->>Helpers: makeUrl(resolvedArgs)
  useModelQuery->>TanStack: injectQuery({ queryKey(resolvedArgs), queryFn(url) })
  TanStack-->>Component: Query object
Loading
sequenceDiagram
  participant Component
  participant useInfiniteModelQuery
  participant Helpers as isFn/makeUrl
  participant TanStack as injectInfiniteQuery
  Component->>useInfiniteModelQuery: args (value or () => value), options
  useInfiniteModelQuery->>Helpers: isFn(args)
  Helpers-->>useInfiniteModelQuery: resolvedArgs
  useInfiniteModelQuery->>TanStack: injectInfiniteQuery({ initialPageParam: resolvedArgs, queryKey(resolvedArgs), queryFn(pageParam) -> makeUrl(pageParam ?? resolvedArgs) })
  TanStack-->>Component: Infinite Query object
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

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

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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 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: 2

🔭 Outside diff range comments (1)
packages/plugins/tanstack-query/src/generator.ts (1)

679-683: Add peerDependencies for @tanstack/angular-query-experimental

We verified imports of @tanstack/angular-query-experimental in

  • packages/plugins/tanstack-query/src/generator.ts
  • packages/plugins/tanstack-query/scripts/postbuild.js
  • packages/plugins/tanstack-query/tests/plugin.test.ts

—but found no declaration of this package in any peerDependencies or devDependencies under packages. Without it, downstream consumers will be missing the types at build time.

Please update your plugin manifest:

• packages/plugins/tanstack-query/package.json

--- a/packages/plugins/tanstack-query/package.json
+++ b/packages/plugins/tanstack-query/package.json
@@ "peerDependencies": {
-  // existing dependencies
+  "@tanstack/angular-query-experimental": "^5.84.0",
 }

If your local build or tests also require it, add the same entry under devDependencies.

🧹 Nitpick comments (5)
packages/ide/jetbrains/CHANGELOG.md (1)

7-8: Changelog entry added under Unreleased

The fix note is clear and scoped. If you cut a 2.18.1 release, consider moving this from Unreleased into the 2.18.1 section for a permanent record.

packages/plugins/openapi/src/generator-base.ts (1)

18-21: New includeOpenApiIgnored option: behavior and defaults make sense

  • Default remains backward compatible (models with @@openapi.ignore are excluded).
  • Opt-in flag includes them while still honoring @@ignore via getDataModels()’s default filter.

Consider adding a short doc comment in the option list (README or plugin docs) to surface this knob.

If you want, I can draft the docs snippet for this option.

packages/plugins/tanstack-query/src/generator.ts (1)

120-124: Angular: allow function-based args type — aligns with runtime resolution

Unioning args to also accept () => args matches the new runtime that resolves function-based inputs. This should unblock reactive/computed args patterns.

Minor: consider documenting this in the generator README (Angular section) so users know they can pass a thunk for args.

packages/plugins/openapi/src/rpc-generator.ts (2)

913-919: Dead check for TypeDef on JSON path; simplify or route through callers

In prismaTypeToOpenAPIType, type is literally 'JSON' or 'Json', so the isTypeDefType probe will never succeed. Returning {} for JSON here is sufficient; TypeDef-aware JSON mapping is already handled by generateField and generateTypeDefField.

Apply this diff:

-            .with(P.union('JSON', 'Json'), () => {
-                // For Json fields, check if there's a specific TypeDef reference
-                // Otherwise, return empty schema for arbitrary JSON
-                const isTypeDefType = this.model.declarations.some(d => isTypeDef(d) && d.name === type);
-                return isTypeDefType ? this.ref(type, false) : {};
-            })
+            .with(P.union('JSON', 'Json'), () => ({} as OAPI.SchemaObject))

797-825: Optional: mirror TypeDef-aware JSON mapping in inputs

Currently, inputs render JSON as {} even when the corresponding model field is @JSON TypeDef. If you want parity for create/update payloads, consider detecting the owning model from the input type’s name (e.g., /^(\w+)(Create|Update)(Many)?Input$/), finding the ZModel field by name, and emitting a $ref to the TypeDef in generateInputComponent for those JSON fields.

Happy to draft a targeted refactor if you want to tackle this in this PR or a follow-up.

📜 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 d8a90cd and 94a6dc2.

⛔ Files ignored due to path filters (22)
  • package.json is excluded by !**/*.json
  • packages/ide/jetbrains/package.json is excluded by !**/*.json
  • packages/language/package.json is excluded by !**/*.json
  • packages/misc/redwood/package.json is excluded by !**/*.json
  • packages/plugins/openapi/package.json is excluded by !**/*.json
  • packages/plugins/openapi/tests/baseline/rpc-type-coverage-3.0.0.baseline.yaml is excluded by !**/*.yaml
  • packages/plugins/openapi/tests/baseline/rpc-type-coverage-3.1.0.baseline.yaml is excluded by !**/*.yaml
  • packages/plugins/swr/package.json is excluded by !**/*.json
  • packages/plugins/tanstack-query/package.json is excluded by !**/*.json
  • packages/plugins/trpc/package.json is excluded by !**/*.json
  • packages/plugins/trpc/tests/projects/nuxt-trpc-v10/package.json is excluded by !**/*.json
  • packages/plugins/trpc/tests/projects/nuxt-trpc-v11/package.json is excluded by !**/*.json
  • packages/plugins/trpc/tests/projects/t3-trpc-v11/package.json is excluded by !**/*.json
  • packages/runtime/package.json is excluded by !**/*.json
  • packages/schema/package.json is excluded by !**/*.json
  • packages/sdk/package.json is excluded by !**/*.json
  • packages/server/package.json is excluded by !**/*.json
  • packages/testtools/package.json is excluded by !**/*.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !**/*.yaml
  • tests/integration/test-run/package.json is excluded by !**/*.json
  • tests/integration/tests/frameworks/nextjs/test-project/package.json is excluded by !**/*.json
  • tests/integration/tests/frameworks/trpc/test-project/package.json is excluded by !**/*.json
📒 Files selected for processing (8)
  • packages/ide/jetbrains/CHANGELOG.md (1 hunks)
  • packages/ide/jetbrains/build.gradle.kts (1 hunks)
  • packages/plugins/openapi/src/generator-base.ts (1 hunks)
  • packages/plugins/openapi/src/rpc-generator.ts (6 hunks)
  • packages/plugins/openapi/tests/openapi-rpc.test.ts (3 hunks)
  • packages/plugins/tanstack-query/src/generator.ts (2 hunks)
  • packages/plugins/tanstack-query/src/runtime-v5/angular.ts (3 hunks)
  • tests/integration/tests/cli/plugins.test.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
packages/plugins/openapi/src/generator-base.ts (1)
packages/sdk/src/utils.ts (2)
  • getDataModels (46-53)
  • hasAttribute (134-139)
packages/plugins/openapi/tests/openapi-rpc.test.ts (2)
packages/testtools/src/schema.ts (2)
  • loadZModelAndDmmf (396-428)
  • normalizePath (72-74)
packages/plugins/openapi/src/rpc-generator.ts (1)
  • generate (46-106)
packages/plugins/openapi/src/rpc-generator.ts (1)
packages/language/src/ast.ts (1)
  • DataModel (56-66)
⏰ 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). (5)
  • GitHub Check: build-test (20.x)
  • GitHub Check: dependency-review
  • GitHub Check: build-test (20.x)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: build-test (20.x)
🔇 Additional comments (11)
packages/ide/jetbrains/build.gradle.kts (1)

12-12: Version bump looks good

Bumped to 2.18.1 without functional changes. Matches the PR scope.

If you rely on JetBrains Changelog plugin to render Unreleased as notes, you’re set. Otherwise, confirm the CHANGELOG has a 2.18.1 section before publishing.

tests/integration/tests/cli/plugins.test.ts (1)

78-79: Prisma 6.14.x bump: confirm CI Node version & engines constraints

I don’t see any Node version setup in .github/workflows nor any engines fields in your package.json. Please ensure:

  • Your CI pipeline is running a Node version supported by Prisma 6.14.x.
  • Any engines entry in package.json (if added) does not conflict with that Node version.

This applies to the bump at tests/integration/tests/cli/plugins.test.ts (lines 78–79 and 85–89).

packages/ide/jetbrains/CHANGELOG.md (1)

9-12: Historical section addition is fine

Adding the 2.17.0 entry improves history clarity.

packages/plugins/tanstack-query/src/runtime-v5/angular.ts (2)

30-32: Nice addition: simple, explicit dynamic-args detection

Adding AnyFn and isFn cleanly enables function-based args resolution without polluting call sites.


79-86: Arg resolution timing looks correct

Resolving args inside the injectQuery/injectInfiniteQuery factory ensures the key and URL are computed at injection time. Good alignment with function-based args design.

packages/plugins/openapi/src/rpc-generator.ts (4)

652-661: Good coverage for AST-only enums

Including enums from the AST (when absent in DMMF) prevents missing component refs for TypeDefs that use them.


668-672: Emitting TypeDefs as first-class components is the right call

Generating TypeDef schemas (and doing so before inputs) enables stable cross-referencing from models and other TypeDefs.


753-756: Passing modelName into generateField enables TypeDef-aware JSON mapping

This provides the necessary context to correctly map Json fields that are actually @JSON TypeDefs on the corresponding ZModel field.


768-783: Correctly mapping Json fields referencing TypeDefs

The lookup against the ZModel to detect @JSON TypeDef references, and returning a $ref wrapped with optional/array semantics, is the correct behavior.

packages/plugins/openapi/tests/openapi-rpc.test.ts (2)

380-383: Solid extension of type coverage

Adding a simple TypeDef (Meta) and testing @JSON mapping plus plain Json helps validate both specialized and generic JSON paths.


420-519: Excellent end-to-end validation of complex TypeDef graphs

The assertions cover nested refs, enum inclusion, array relationships, and spec-version-specific nullable JSON representation. This gives strong confidence in the new generator behavior.

@ymc9 ymc9 merged commit 789e772 into main Aug 17, 2025
14 checks passed
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.

4 participants