Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/codegen/generators/typescript/channels/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {getMessageTypeAndModule} from './utils';
import {pascalCase} from '../utils';
import {createMissingInputDocumentError} from '../../../errors';
import {resolveImportExtension} from '../../../utils';
import {extractSecuritySchemes} from '../../../inputs/openapi/security';

type OpenAPIDocument =
| OpenAPIV3.Document
Expand Down Expand Up @@ -75,6 +76,9 @@ export async function generateTypeScriptChannelsForOpenAPI(

const {openapiDocument} = validateOpenAPIContext(context);

// Extract security schemes from the OpenAPI document
const securitySchemes = extractSecuritySchemes(openapiDocument);

// Collect dependencies
const deps = protocolDependencies['http_client'];
const importExtension = resolveImportExtension(
Expand All @@ -98,8 +102,9 @@ export async function generateTypeScriptChannelsForOpenAPI(
);

// Generate common types once (stateless check)
// Pass security schemes to generate only relevant auth types
if (protocolCodeFunctions['http_client'].length === 0 && renders.length > 0) {
const commonTypesCode = renderHttpCommonTypes();
const commonTypesCode = renderHttpCommonTypes(securitySchemes);
protocolCodeFunctions['http_client'].unshift(commonTypesCode);
}

Expand Down
Loading