@@ -13,7 +13,6 @@ import {
1313} from './types' ;
1414import { ConstrainedObjectModel } from '@asyncapi/modelina' ;
1515import { collectProtocolDependencies } from './utils' ;
16- import { resetHttpCommonTypesState } from './protocols/http' ;
1716import {
1817 renderHttpFetchClient ,
1918 renderHttpCommonTypes
@@ -51,9 +50,6 @@ const HTTP_METHODS: HttpMethod[] = [
5150] ;
5251const METHODS_WITH_BODY : HttpMethod [ ] = [ 'post' , 'put' , 'patch' ] ;
5352
54- // Track whether common types have been generated
55- let httpCommonTypesGenerated = false ;
56-
5753/**
5854 * Generates TypeScript HTTP client channels from an OpenAPI document.
5955 * Only supports http_client protocol - other protocols are ignored for OpenAPI input.
@@ -76,10 +72,6 @@ export async function generateTypeScriptChannelsForOpenAPI(
7672 return ;
7773 }
7874
79- // Reset HTTP common types state
80- resetHttpCommonTypesState ( ) ;
81- httpCommonTypesGenerated = false ;
82-
8375 const { openapiDocument} = validateOpenAPIContext ( context ) ;
8476
8577 // Collect dependencies
@@ -93,11 +85,10 @@ export async function generateTypeScriptChannelsForOpenAPI(
9385 parameters
9486 ) ;
9587
96- // Generate common types once
97- if ( ! httpCommonTypesGenerated && renders . length > 0 ) {
88+ // Generate common types once (stateless check)
89+ if ( protocolCodeFunctions [ 'http_client' ] . length === 0 && renders . length > 0 ) {
9890 const commonTypesCode = renderHttpCommonTypes ( ) ;
9991 protocolCodeFunctions [ 'http_client' ] . unshift ( commonTypesCode ) ;
100- httpCommonTypesGenerated = true ;
10192 }
10293
10394 // Add renders to output
0 commit comments