-
-
Notifications
You must be signed in to change notification settings - Fork 127
chore: update to prisma 6.15 #2228
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
📝 WalkthroughWalkthroughAdded defensive null/undefined guards when iterating Prisma DMMF inputObjectTypes in multiple generators and bumped Prisma dependency version strings in an integration test from 6.14.x to 6.15.x. Changes are limited to guards, formatting, and string updates; no public API signatures changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Gen as Generator
participant DMMF as Prisma DMMF
participant Proc as Processing Loop
rect #E6F4EA
Note right of Gen: Previously may access\ninputObjectTypes.prisma directly
Gen->>DMMF: read schema.inputObjectTypes
DMMF-->>Gen: possible undefined
end
rect #FFF4E6
Note right of Proc: New guarded flow
Gen->>Proc: iterate (schema.inputObjectTypes.prisma ?? [])
Proc-->>Gen: zero or more inputObjectTypes
Gen->>Gen: process each inputObjectType safely
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
✨ 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: 0
🧹 Nitpick comments (1)
tests/integration/tests/cli/plugins.test.ts (1)
72-82: No leftover @prisma/[email protected] references; optional DRY refactor
Search returned no matches for(@prisma/client|prisma)@6\.14\.. You may still defineconst PRISMA_VER = '6.15.x';(after reading
ver) and update- '@prisma/[email protected]', + `@prisma/client@${PRISMA_VER}`,to centralize the Prisma version and prevent future drift.
📜 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 ignored due to path filters (10)
packages/plugins/trpc/tests/projects/nuxt-trpc-v10/package.jsonis excluded by!**/*.jsonpackages/plugins/trpc/tests/projects/nuxt-trpc-v11/package.jsonis excluded by!**/*.jsonpackages/plugins/trpc/tests/projects/t3-trpc-v11/package.jsonis excluded by!**/*.jsonpackages/runtime/package.jsonis excluded by!**/*.jsonpackages/schema/package.jsonis excluded by!**/*.jsonpackages/sdk/package.jsonis excluded by!**/*.jsonpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!**/*.yamltests/integration/test-run/package.jsonis excluded by!**/*.jsontests/integration/tests/frameworks/nextjs/test-project/package.jsonis excluded by!**/*.jsontests/integration/tests/frameworks/trpc/test-project/package.jsonis excluded by!**/*.json
📒 Files selected for processing (1)
tests/integration/tests/cli/plugins.test.ts(2 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). (4)
- GitHub Check: build-test (20.x)
- GitHub Check: dependency-review
- GitHub Check: OSSAR-Scan
- GitHub Check: build-test (20.x)
🔇 Additional comments (1)
tests/integration/tests/cli/plugins.test.ts (1)
85-94: Parametrize Prisma version and verify CI config
Apply within this hunk:- '[email protected]', + `prisma@${PRISMA_VER}`,Manually confirm your CI workflows use Node.js ≥ 18 and that no
[email protected]or@prisma/[email protected]pins remain.
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/schema/src/plugins/zod/generator.ts (1)
92-97: Guard is right; avoid locale-sensitive lowercasingThe nullish coalescing is correct.However
toLocaleLowerCase()on the exclude side vstoLowerCase()on the name side is inconsistent and can miscompare in certain locales (e.g., Turkish). Normalize withtoLowerCase()on both.-const inputObjectTypes = (prismaClientDmmf.schema.inputObjectTypes.prisma ?? []).filter( - (type) => - !excludeModels.some((e) => type.name.toLowerCase().startsWith(e.toLocaleLowerCase())) && - // exclude delegate aux related types - !type.name.toLowerCase().includes(DELEGATE_AUX_RELATION_PREFIX) -); +const inputObjectTypes = (prismaClientDmmf.schema.inputObjectTypes.prisma ?? []).filter( + (type) => { + const tn = type.name.toLowerCase(); + return ( + !excludeModels.some((e) => tn.startsWith(e.toLowerCase())) && + // exclude delegate aux related types + !tn.includes(DELEGATE_AUX_RELATION_PREFIX) + ); + } +);
🧹 Nitpick comments (4)
packages/schema/src/plugins/enhancer/enhance/index.ts (1)
573-575: Use path.join for cross-OS safetyHardcoded forward slashes can break on Windows. Prefer
path.jointo buildinternalfile paths.-const internalFilename = `${prismaClientDir}/internal/prismaNamespace.ts`; -const internalFilenameFixed = `${prismaClientDir}/internal/prismaNamespace-fixed.ts`; +const internalFilename = path.join(prismaClientDir, 'internal', 'prismaNamespace.ts'); +const internalFilenameFixed = path.join(prismaClientDir, 'internal', 'prismaNamespace-fixed.ts');packages/plugins/openapi/src/rpc-generator.ts (3)
777-795: Typed-JSON model field mapping: good improvement; ensure consistent coverageEnhancing
generateFieldto resolve Json fields to TypeDef schemas via the ZModel is solid for entity schemas. Consider extending similar mapping to input object types to align with Zod generator behavior, so OpenAPI inputs also reference the specific TypeDef instead of generic JSON.
892-900: Dead branch: TypeDef detection for scalar Json never triggers hereInside
typeDefFieldTypeToOpenAPISchema, the JSON branch checks for a TypeDef named exactly'Json'/'JSON', which won’t occur. Either drop the check or refactor input-type generation to pass contextual TypeDef info if you want typed-JSON for inputs as well.-// For scalar types, reuse the existing mapping logic -// Note: Json type is handled as empty schema for consistency -return match(type.type) - .with('Json', () => ({} as OAPI.SchemaObject)) +// For scalar types, reuse the existing mapping logic +// Json stays empty schema here; typed-JSON is handled elsewhere +return match(type.type) + .with('Json', () => ({} as OAPI.SchemaObject)) .otherwise((t) => { // Delegate to prismaTypeToOpenAPIType for all other scalar types return this.prismaTypeToOpenAPIType(String(t), false); });
925-933: Ineffective TypeDef probe for JSON; simplify
isTypeDefTypewill always be false becausetypeis'Json'|'JSON'. Simplify to always return{}here; keep typed-JSON handling ingenerateField(or refactor inputs as noted).- .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'), () => ({}))
📜 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 (3)
packages/plugins/openapi/src/rpc-generator.ts(6 hunks)packages/schema/src/plugins/enhancer/enhance/index.ts(2 hunks)packages/schema/src/plugins/zod/generator.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/plugins/openapi/src/rpc-generator.ts (2)
packages/runtime/src/local-helpers/upper-case-first.ts (1)
upperCaseFirst(1-3)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: dependency-review
- GitHub Check: build-test (20.x)
- GitHub Check: build-test (20.x)
- GitHub Check: OSSAR-Scan
- GitHub Check: build-test (20.x)
🔇 Additional comments (4)
packages/schema/src/plugins/enhancer/enhance/index.ts (1)
482-498: Good defensive guard on DMMF input types iterationUsing
(dmmf.schema.inputObjectTypes.prisma ?? [])prevents crashes when Prisma omitsprismainput types. LGTM.packages/plugins/openapi/src/rpc-generator.ts (3)
4-13: Import formatting changes are fineJust layout/style adjustments. No functional impact.
60-62: Safe fallback for missing Prisma input types
...(this.dmmf.schema.inputObjectTypes.prisma ?? [])avoids runtime errors on 6.15 whenprismais absent. Good.
662-668: Adding AST-only enums to components is correctCovers enums used only in TypeDefs. Looks good.
No description provided.