docs: Prisma Next contract authoring (data contract, PSL, TS builder, artifacts)#8024
Conversation
Add a Data contract group under orm/next with four pages: - The data contract: concept overview, authoring modes, artifacts - Author in PSL: schema syntax incl. named types, enums, value objects, relations, inheritance, and extension types - Author in TypeScript: the defineContract builder API, fields, relations, storage mapping, and purity rules - The emitted artifacts: contract.json/contract.d.ts anatomy, deterministic emission, and the content hashes Also link the new section from the Prisma Next overview cards. All examples are taken from or verified against the prisma-next repository (examples/prisma-next-demo and the authoring packages). Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (3)
WalkthroughThis PR adds a new “Contract authoring” docs section for Prisma Next, covering the data contract, PSL and TypeScript authoring, emitted artifacts, capabilities, and related navigation/support updates. ChangesContract authoring documentation
Estimated code review effort: 2 (Simple) | ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
🍈 Lychee Link Check Report68 links: ✅ All links are working!Full Statistics Table
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Restructure the section from orm/next/contract to the ticket's URLs under /next/contract-authoring and complete the required page set: - Move and rename the four pages to the-data-contract, psl-syntax, typescript-schema-builder, and the-contract-artifact - Add the fifth page, capabilities, documenting the implemented behavior: capabilities are derived from target/adapter/extension pack declarations at emit time, gate contract build (e.g. scalar lists on SQLite) and query building (assertCapability errors), and are not probed from the live database - Add the contract-vs-schema terminology note and the three-jobs framing to the first page - Add PostgreSQL/MongoDB tabs where authoring differs (config, full examples, ID mapping), with MongoDB examples verified against prisma-next (mongo-demo, authoring side-by-side suite) - Correct the profileHash row on the artifact page: per current code it covers target/family, not the capability subset - Add the five temporary redirects from Prisma 7 schema URLs listed in the ticket (permanent: false) - Wire the section into the Getting Started sidebar and revert the orm/next nav entries from the previous layout Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
… section Per review: - The five pages move from the getting-started tree to the ORM Next version tree: content/docs/orm/next/contract-authoring, served at /orm/next/contract-authoring/*, registered as a Contract Authoring section between Data Modeling and Fundamentals. The getting-started meta change is reverted. - The vercel.json redirects are reverted and parked, commented out, in the shared "Prisma Next URL cutover (DR-8687)" block in next.config.mjs with /orm/next destinations. They ship when the docs go GA, not now. - Cross-links into the merged sections: data modeling and Fundamentals from the data-contract page, relational/MongoDB modeling from the PSL relations syntax, Using extensions from capabilities. All internal links updated to the new paths (markdown and card hrefs). - Every page ends with the standard "Prompt your coding agent" section pointing at the Prisma Next skills, with prompts scoped to the page (prisma-next-contract). - Per-page Early Access notes removed for consistency with the other orm/next sections (the tree carries the badge); cspell terms added. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… teaches Live validation confirmed the page's enum syntax (member values compile and the applied column carries the documented CHECK constraint) and both TypeScript builder examples (the full PostgreSQL contract with the pgvector pack emits and initializes against a live Prisma Postgres database; the MongoDB contract emits). The agent prompt that referenced namespaces, which this page does not teach, now asks for a composite unique constraint instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Pushed the restructure and a live-validation pass. 174cea9: the five pages move to 517526c + validation: every substantive claim on these pages was exercised against live databases:
Validation on the branch: types clean, links 0 errors, cspell clean. Merge-ready once reviewed. |
Style and coherence pass across the Prisma Next tree: - The data contract page opens plainly: what the contract is, a blog example, then the package-lock analogy, instead of a definition paragraph doing three jobs at once. Capabilities opens with the problem (databases differ) before the mechanism. The artifact page gets a one-sentence lead before its reference table. - psl-syntax now uses the same framing as the merged data modeling section: "Base models and variants" instead of "Model inheritance", the variant prose covers both storage layouts (with and without @@Map) and links the page that teaches choosing between them, and value objects link the embed-or-reference decision on MongoDB. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Style and coherence pass (b8690d5), reviewed as a reader navigating the whole Prisma Next tree. Openings now teach before they define: the data contract page starts with what the file is and a blog example before the package-lock analogy; capabilities starts with the problem (databases differ) before the mechanism; the artifact page gets a one-sentence lead before its reference table. Cross-section consistency: psl-syntax now uses the merged data modeling section's framing (Base models and variants, not Model inheritance), its variant prose covers both storage layouts and links the page that teaches choosing between them, and value objects link the embed-or-reference decision. Validation on the branch stays green: types, links, cspell. |
- Lead the data contract page with a tiny PSL example and frame PSL as the preferred authoring surface with the TypeScript builder as an escape hatch for composed or programmatically assembled schemas - Drop the editor-type-checking criterion from the TS-vs-PSL comparison; PSL gets the same real-time feedback from the language server, so it is not a differentiator - Fix wording: contract source, not schema source - Move the complete PSL example above the config section so the syntax page opens with schema code Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
Overview
Adds the Contract authoring section to the Prisma Next docs under
/docs/next/contract-authoring, per the ticket's page plan: the data contract concept, PSL authoring, the TypeScript schema builder, the contract artifact, and capabilities.Linear: DR-8680
Pages
/next/contract-authoring/the-data-contract/next/contract-authoring/psl-syntaxcontract.prisma: models, namedtypes, enums with@@type, value objects, relations,@@discriminator/@@baseinheritance, extension types; PostgreSQL/MongoDB tabs where syntax differs (config, full example, ID mapping)/next/contract-authoring/typescript-schema-builderdefineContract: composed helpers, fields, enums, relations, storage mapping, purity rules, when to choose TS over PSL; PostgreSQL/MongoDB tabs/next/contract-authoring/the-contract-artifactcontract.jsonanatomy,contract.d.ts, deterministic emission, the hashes, runtime consumption, version control/next/contract-authoring/capabilitiesAlso: sidebar group under "Prisma Next" in Getting Started, a card on the Prisma Next overview page, and the five temporary redirects from the ticket (
permanent: falseinapps/docs/vercel.json).Accuracy notes (deviations from the ticket, verified against product source)
E_CAPABILITY_*codes (those exist only in internal architecture docs). The real gates are (1) contract-build diagnostics (e.g. scalar lists on SQLite) and (2) query-build-time errors (distinctOn() requires capability postgres.distinctOn). The page documents the implemented behavior; capability keys are copied from the adapter/pack descriptor metadata.profileHashcurrently covers target/family only (the SQL authoring path hashes an empty capability subset), so the artifact page does not claim capability changes move it.@hint(was:), the contract ESLint plugin, theauthoring:config key.prisma-next(examples/prisma-next-demo,examples/mongo-demo, authoring side-by-side suite). MongoDB TS examples use the@prisma-next/mongo/contract-builderfacade.Not done here (flagged per ticket)
/docs/orm/prisma-schema/overview/generatorsleft in place (no clean equivalent; ticket suggests possibly pointing to CLIcontract emitlater).Verification
pnpm lint:links: 0 errors (594 files);pnpm audit:redirectspasses with the 5 new entriesSummary by CodeRabbit