@@ -61,7 +61,6 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
6161
6262 const operations : IR . OperationObject [ ] = [ ] ;
6363
64- // Collect all operations using hey-api's forEach
6564 plugin . forEach (
6665 'operation' ,
6766 ( event ) => {
@@ -70,13 +69,11 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
7069 { order : 'declarations' } ,
7170 ) ;
7271
73- // Register external symbols for imports
7472 const symbolOc = plugin . symbol ( 'oc' , {
7573 exported : false ,
7674 external : '@orpc/contract' ,
7775 } ) ;
7876
79- // Create base contract symbol
8077 const baseSymbol = plugin . symbol ( 'base' , {
8178 exported : true ,
8279 meta : {
@@ -95,8 +92,6 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
9592 ) ;
9693 plugin . node ( baseNode ) ;
9794
98- // Create contract for each operation
99- // Store symbols for later use in contracts object
10095 const contractSymbols : Record < string , ReturnType < typeof plugin . symbol > > = { } ;
10196
10297 for ( const op of operations ) {
@@ -118,8 +113,6 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
118113 } ) ;
119114 contractSymbols [ op . id ] = contractSymbol ;
120115
121- // Build the route config object following Route interface order:
122- // method, path, operationId, summary, description, deprecated, tags, successStatus, successDescription
123116 const method = op . method . toUpperCase ( ) ;
124117 const routeConfig = $ . object ( )
125118 . prop ( 'method' , $ . literal ( method ) )
@@ -139,12 +132,9 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
139132 node . prop ( 'successStatus' , $ . literal ( successResponse . statusCode ! ) ) ,
140133 ) ;
141134
142- // Build the call chain: base.route({...}).input(...).output(...)
143135 let expression = $ ( baseSymbol ) . attr ( 'route' ) . call ( routeConfig ) ;
144136
145- // .input(dataSchema) if has input
146137 if ( hasInput ( op ) ) {
147- // Reference schema symbol dynamically from validator plugin
148138 const dataSymbol = plugin . referenceSymbol ( {
149139 category : 'schema' ,
150140 resource : 'operation' ,
@@ -157,10 +147,8 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
157147 }
158148 }
159149
160- // TODO: support outputStructure detailed
161- // .output(responseSchema) if has output
162150 if ( successResponse . hasOutput ) {
163- // Reference response schema symbol dynamically from validator plugin
151+ // TODO: support outputStructure detailed
164152 const responseSymbol = plugin . referenceSymbol ( {
165153 category : 'schema' ,
166154 resource : 'operation' ,
@@ -182,7 +170,6 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
182170 plugin . node ( contractNode ) ;
183171 }
184172
185- // Create contracts object export grouped by API path segment (in separate router file)
186173 const routerExportName = applyNaming ( 'router' , routerName ) ;
187174 const contractsSymbol = plugin . symbol ( routerExportName , {
188175 exported : true ,
@@ -193,7 +180,6 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
193180 } ,
194181 } ) ;
195182
196- // Group operations by group key
197183 const operationsByGroup = new Map < string , IR . OperationObject [ ] > ( ) ;
198184 for ( const op of operations ) {
199185 const groupKey = groupKeyBuilder ( op ) ;
@@ -203,7 +189,6 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
203189 operationsByGroup . get ( groupKey ) ! . push ( op ) ;
204190 }
205191
206- // Build nested contracts object
207192 const contractsObject = $ . object ( ) . pretty ( ) ;
208193 for ( const [ groupKey , groupOps ] of operationsByGroup ) {
209194 const groupObject = $ . object ( ) ;
@@ -224,8 +209,6 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => {
224209 . assign ( contractsObject ) ;
225210 plugin . node ( contractsNode ) ;
226211
227- // Create type export: export type Router = typeof router (in separate router file)
228- // Capitalize the router name for the type (e.g., 'router' → 'Router', 'contract' → 'Contract')
229212 const routerTypeName = toCase ( routerExportName , 'PascalCase' ) ;
230213 const routerTypeSymbol = plugin . symbol ( routerTypeName , {
231214 exported : true ,
0 commit comments