var J=Object.defineProperty;var K=(D)=>D;function M(D,E){this[D]=K.bind(null,E)}var Q=(D,E)=>{for(var G in E)J(D,G,{get:E[G],enumerable:!0,configurable:!0,set:M.bind(E,G)})};var T=(D,E)=>()=>(D&&(E=D(D=0)),E);import{openapiAlternativeBrief as F}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as N}from"@contractspec/lib.content-gen/seo";import{CodeBlock as H}from"@contractspec/lib.design-system";import I from"@contractspec/lib.ui-link";import{ChevronRight as P}from"lucide-react";import{jsx as q,jsxs as w}from"react/jsx-runtime";var _=new N().optimize(F);function $(){return w("div",{className:"space-y-8",children:[w("div",{className:"space-y-3",children:[q("h1",{className:"font-bold text-4xl",children:F.title}),q("p",{className:"text-lg text-muted-foreground",children:F.summary})]}),w("div",{className:"card-subtle space-y-4 p-6",children:[q("h2",{className:"font-bold text-2xl",children:"OpenAPI Limitations"}),q("ul",{className:"space-y-2 text-muted-foreground text-sm",children:F.problems.map((D,E)=>q("li",{children:D},E))})]}),w("div",{className:"card-subtle space-y-4 p-6",children:[q("h2",{className:"font-bold text-2xl",children:"ContractSpec Advantages"}),q("ul",{className:"space-y-2 text-muted-foreground text-sm",children:F.solutions.map((D,E)=>q("li",{children:D},E))})]}),w("div",{className:"space-y-6",children:[w("div",{className:"space-y-3",children:[q("h2",{className:"font-bold text-2xl",children:"Comparison: OpenAPI vs ContractSpec"}),q("p",{className:"text-muted-foreground text-sm",children:"Key differences between OpenAPI documentation and ContractSpec executable contracts."}),w("div",{className:"grid gap-6 md:grid-cols-2",children:[w("div",{className:"card-subtle space-y-3 p-4",children:[q("h3",{className:"font-semibold text-lg",children:"OpenAPI"}),w("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[q("li",{children:"• Documentation specification only"}),q("li",{children:"• No runtime validation"}),q("li",{children:"• Manual code generation"}),q("li",{children:"• Type safety requires tools"}),q("li",{children:"• Separate schemas from documentation"})]})]}),w("div",{className:"card-subtle space-y-3 p-4",children:[q("h3",{className:"font-semibold text-lg",children:"ContractSpec"}),w("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[q("li",{children:"• Executable contracts"}),q("li",{children:"• Built-in runtime validation"}),q("li",{children:"• Automatic code generation"}),q("li",{children:"• Type-safe by default"}),q("li",{children:"• Unified spec and implementation"})]})]})]})]}),w("div",{className:"space-y-3",children:[q("h2",{className:"font-bold text-2xl",children:"Export from Contracts"}),q("p",{className:"text-muted-foreground text-sm",children:"Generate OpenAPI documentation from ContractSpec for existing tooling."}),q(H,{language:"bash",filename:"export-openapi",code:`# From ContractSpec contracts
contractspec openapi export \\
  --registry ./src/contracts/registry.ts \\
  --format yaml \\
  --out ./openapi.yaml

# Compare: Manual OpenAPI vs Generated
# Manual: Write OpenAPI by hand, maintain separately
# Generated: Single source of truth, always in sync`})]}),w("div",{className:"space-y-3",children:[q("h2",{className:"font-bold text-2xl",children:"Beyond Documentation"}),q("p",{className:"text-muted-foreground text-sm",children:"ContractSpec provides more than just API documentation."}),q(H,{language:"typescript",filename:"multi-output-example.ts",code:`// One contract, multiple outputs
import { UserApiContract } from './contracts/user-api.contract';

// Generated outputs
export const outputs = {
  // API documentation (OpenAPI)
  openapi: UserApiContract.toOpenAPI(),
  
  // Client SDKs (TypeScript, Python, etc.)
  clients: UserApiContract.generateClients({
    languages: ['typescript', 'python', 'go'],
  }),
  
  // Database schemas (Prisma, Drizzle)
  database: UserApiContract.toDatabase({
    adapter: 'prisma',
  }),
  
  // API handlers (Express, Fastify, Next.js)
  handlers: UserApiContract.toHandlers({
    framework: 'express',
  }),
  
  // Validation middleware
  validation: UserApiContract.toValidation({
    library: 'zod',
  }),
  
  // Type definitions
  types: UserApiContract.toTypescript(),
};`})]})]}),w("div",{className:"flex items-center gap-4 pt-4",children:[w(I,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Generate from Contracts ",q(P,{size:16})]}),q(I,{href:"/docs/intent/generate-client-from-schema",className:"btn-ghost",children:"Client Generation"})]})]})}export{_ as metadata,$ as OpenapiAlternativePage};
