From 2e104726d042fabd56e1a6c469e7cc4d8ffcba6c Mon Sep 17 00:00:00 2001 From: kahirokunn Date: Wed, 1 May 2024 14:51:49 +0900 Subject: [PATCH] feat: If args is not used, the args argument is not included. --- packages/kubekit-codegen/package.json | 2 +- packages/kubekit-codegen/src/codegen.ts | 31 +- packages/kubekit-codegen/src/generate.ts | 520 ++++++++---------- .../test/__snapshots__/cli.test.ts.snap | 4 +- .../generateEndpoints.test.ts.snap | 17 +- 5 files changed, 252 insertions(+), 322 deletions(-) diff --git a/packages/kubekit-codegen/package.json b/packages/kubekit-codegen/package.json index e019f81f..013f2621 100644 --- a/packages/kubekit-codegen/package.json +++ b/packages/kubekit-codegen/package.json @@ -1,6 +1,6 @@ { "name": "@kubekit/codegen", - "version": "0.0.15", + "version": "0.0.18", "main": "lib/index.js", "types": "lib/index.d.ts", "author": "kahirokunn", diff --git a/packages/kubekit-codegen/src/codegen.ts b/packages/kubekit-codegen/src/codegen.ts index 41cafda7..a6802d30 100644 --- a/packages/kubekit-codegen/src/codegen.ts +++ b/packages/kubekit-codegen/src/codegen.ts @@ -79,6 +79,7 @@ export function generateEndpointDefinition({ queryFn, isListWatch, isListOrWatch, + isUnusedArgs, }: { operationName: string; Response: ts.TypeReferenceNode; @@ -86,8 +87,12 @@ export function generateEndpointDefinition({ queryFn: ts.ObjectLiteralExpression; isListWatch: boolean; isListOrWatch: boolean; + isUnusedArgs: boolean; }) { - const CustomizedResponse = factory.createTypeReferenceNode(factory.createIdentifier(isListOrWatch ? "MinimumRequiredList" : "MinimumRequiredGet"), [Response]) + const CustomizedResponse = factory.createTypeReferenceNode( + factory.createIdentifier(isListOrWatch ? 'MinimumRequiredList' : 'MinimumRequiredGet'), + [Response] + ); if (!isListWatch) { return [ factory.createVariableStatement( @@ -102,14 +107,18 @@ export function generateEndpointDefinition({ undefined, undefined, [ - factory.createParameterDeclaration( - undefined, - undefined, - factory.createIdentifier('args'), - undefined, - QueryArg, - undefined - ), + ...(isUnusedArgs + ? [] + : [ + factory.createParameterDeclaration( + undefined, + undefined, + factory.createIdentifier('args'), + undefined, + QueryArg, + undefined + ), + ]), factory.createParameterDeclaration( undefined, undefined, @@ -165,9 +174,7 @@ export function generateEndpointDefinition({ undefined ), ], - factory.createTypeReferenceNode(factory.createIdentifier('Promise'), [ - CustomizedResponse - ]), + factory.createTypeReferenceNode(factory.createIdentifier('Promise'), [CustomizedResponse]), undefined ), factory.createFunctionDeclaration( diff --git a/packages/kubekit-codegen/src/generate.ts b/packages/kubekit-codegen/src/generate.ts index 224aa7de..4bbb8468 100644 --- a/packages/kubekit-codegen/src/generate.ts +++ b/packages/kubekit-codegen/src/generate.ts @@ -270,8 +270,7 @@ export async function generateApi( }; const queryArgValues = Object.values(queryArg); - const isListOrWatch = - operationName.startsWith("list") || operationName.startsWith("watch") + const isListOrWatch = operationName.startsWith('list') || operationName.startsWith('watch'); const isListWatch = !path.includes('/watch/') && verb.toUpperCase() === 'GET' && @@ -318,11 +317,13 @@ export async function generateApi( ).name ); + const { queryFn, isUnusedArgs } = generateQueryFn({ operationDefinition, queryArg }); return generateEndpointDefinition({ operationName, Response: ResponseTypeName, QueryArg, - queryFn: generateQueryFn({ operationDefinition, queryArg }), + isUnusedArgs, + queryFn, isListWatch, isListOrWatch, }); @@ -337,33 +338,94 @@ export async function generateApi( }) { const { path, verb } = operationDefinition; + let isUnusedArgs = true; const bodyParameter = Object.values(queryArg).find((def) => def.origin === 'body'); - const rootObject = factory.createIdentifier('args'); + if (bodyParameter) { + isUnusedArgs = false + } + + const argsObject = factory.createIdentifier('args'); function pickParams(paramIn: string) { return Object.values(queryArg).filter((def) => def.origin === 'param' && def.param.in === paramIn); } function createObjectLiteralProperty(parameters: QueryArgDefinition[], propertyName: string) { - return parameters.length === 0 - ? undefined - : factory.createPropertyAssignment( - factory.createIdentifier(propertyName), - factory.createObjectLiteralExpression( - parameters.map( - (param) => createPropertyAssignment(param.originalName, accessProperty(rootObject, param.name)), - true + if (parameters.length === 0) { + return undefined; + } + isUnusedArgs = false; + return factory.createPropertyAssignment( + factory.createIdentifier(propertyName), + factory.createObjectLiteralExpression( + parameters.map( + (param) => createPropertyAssignment(param.originalName, accessProperty(argsObject, param.name)), + true + ) + ) + ); + } + + function generatePathExpression( + path: string, + pathParameters: QueryArgDefinition[], + rootObject: ts.Identifier, + strict: boolean + ) { + const expressions: Array<[string, string]> = []; + + const head = path.replace(/\{(.*?)\}(.*?)(?=\{|$)/g, (_, expression, literal) => { + let param = pathParameters.find((p) => p.originalName === expression); + if (!param) { + if (strict) { + throw new Error(`path parameter ${expression} does not seem to be defined in '${path}'!`); + } + param = { + origin: 'param', + name: expression, + originalName: expression, + type: factory.createToken(ts.SyntaxKind.StringKeyword), + required: true, + param: { + name: expression, + in: 'path', + description: 'The name that needs to be deleted', + required: true, + schema: { type: 'string' }, + }, + }; + pathParameters.push(param); + } + + if (pathParameters.length > 0) { + isUnusedArgs = false; + } + + expressions.push([param.name, literal]); + return ''; + }); + + return expressions.length + ? factory.createTemplateExpression( + factory.createTemplateHead(head), + expressions.map(([prop, literal], index) => + factory.createTemplateSpan( + accessProperty(rootObject, prop), + index === expressions.length - 1 + ? factory.createTemplateTail(literal) + : factory.createTemplateMiddle(literal) ) ) - ); + ) + : factory.createNoSubstitutionTemplateLiteral(head); } - return factory.createObjectLiteralExpression( + const queryFn = factory.createObjectLiteralExpression( [ factory.createPropertyAssignment( factory.createIdentifier('path'), - generatePathExpression(path, pickParams('path'), rootObject, strict) + generatePathExpression(path, pickParams('path'), argsObject, strict) ), verb.toUpperCase() === 'GET' ? undefined @@ -376,11 +438,11 @@ export async function generateApi( : [ factory.createPropertyAssignment( factory.createIdentifier('body'), - factory.createPropertyAccessExpression(rootObject, factory.createIdentifier(bodyParameter.name)) + factory.createPropertyAccessExpression(argsObject, factory.createIdentifier(bodyParameter.name)) ), factory.createPropertyAssignment( factory.createIdentifier('contentType'), - factory.createPropertyAccessExpression(rootObject, factory.createIdentifier('contentType')) + factory.createPropertyAccessExpression(argsObject, factory.createIdentifier('contentType')) ), ]), createObjectLiteralProperty(pickParams('cookie'), 'cookies'), @@ -388,7 +450,11 @@ export async function generateApi( createObjectLiteralProperty(pickParams('query'), 'params'), ].filter(removeUndefined), false - ); + ) + return { + isUnusedArgs, + queryFn, + }; } } @@ -398,55 +464,6 @@ function accessProperty(rootObject: ts.Identifier, propertyName: string) { : factory.createElementAccessExpression(rootObject, factory.createStringLiteral(propertyName)); } -function generatePathExpression( - path: string, - pathParameters: QueryArgDefinition[], - rootObject: ts.Identifier, - strict: boolean -) { - const expressions: Array<[string, string]> = []; - - const head = path.replace(/\{(.*?)\}(.*?)(?=\{|$)/g, (_, expression, literal) => { - let param = pathParameters.find((p) => p.originalName === expression); - if (!param) { - if (strict) { - throw new Error(`path parameter ${expression} does not seem to be defined in '${path}'!`); - } - param = { - origin: 'param', - name: expression, - originalName: expression, - type: factory.createToken(ts.SyntaxKind.StringKeyword), - required: true, - param: { - name: expression, - in: 'path', - description: 'The name that needs to be deleted', - required: true, - schema: { type: 'string' }, - }, - }; - pathParameters.push(param); - } - expressions.push([param.name, literal]); - return ''; - }); - - return expressions.length - ? factory.createTemplateExpression( - factory.createTemplateHead(head), - expressions.map(([prop, literal], index) => - factory.createTemplateSpan( - accessProperty(rootObject, prop), - index === expressions.length - 1 - ? factory.createTemplateTail(literal) - : factory.createTemplateMiddle(literal) - ) - ) - ) - : factory.createNoSubstitutionTemplateLiteral(head); -} - type QueryArgDefinition = { name: string; originalName: string; @@ -516,298 +533,207 @@ function getBodyNode(bodies: { [contentType: string]: ts.TypeNode }): ts.TypeNod const buildInTypes = [ factory.createTypeAliasDeclaration( undefined, - factory.createIdentifier("Id"), - [factory.createTypeParameterDeclaration( - undefined, - factory.createIdentifier("T"), - undefined, - undefined - )], + factory.createIdentifier('Id'), + [factory.createTypeParameterDeclaration(undefined, factory.createIdentifier('T'), undefined, undefined)], factory.createIntersectionTypeNode([ factory.createMappedTypeNode( undefined, factory.createTypeParameterDeclaration( undefined, - factory.createIdentifier("K"), + factory.createIdentifier('K'), factory.createTypeOperatorNode( ts.SyntaxKind.KeyOfKeyword, - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ) + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined) ), undefined ), undefined, undefined, factory.createIndexedAccessTypeNode( - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ), - factory.createTypeReferenceNode( - factory.createIdentifier("K"), - undefined - ) + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), + factory.createTypeReferenceNode(factory.createIdentifier('K'), undefined) ), - undefined, + undefined ), - factory.createTypeLiteralNode([]) + factory.createTypeLiteralNode([]), ]) ), factory.createTypeAliasDeclaration( undefined, - factory.createIdentifier("NoWatch"), - [factory.createTypeParameterDeclaration( - undefined, - factory.createIdentifier("T"), - undefined, - undefined - )], + factory.createIdentifier('NoWatch'), + [factory.createTypeParameterDeclaration(undefined, factory.createIdentifier('T'), undefined, undefined)], factory.createIntersectionTypeNode([ - factory.createTypeReferenceNode( - factory.createIdentifier("Omit"), - [ - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ), - factory.createLiteralTypeNode(factory.createStringLiteral("watch")) - ] - ), - factory.createTypeLiteralNode([factory.createPropertySignature( - undefined, - factory.createIdentifier("watch"), - factory.createToken(ts.SyntaxKind.QuestionToken), - factory.createLiteralTypeNode(factory.createFalse()) - )]) + factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [ + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), + factory.createLiteralTypeNode(factory.createStringLiteral('watch')), + ]), + factory.createTypeLiteralNode([ + factory.createPropertySignature( + undefined, + factory.createIdentifier('watch'), + factory.createToken(ts.SyntaxKind.QuestionToken), + factory.createLiteralTypeNode(factory.createFalse()) + ), + ]), ]) ), factory.createTypeAliasDeclaration( undefined, - factory.createIdentifier("PartialRequired"), + factory.createIdentifier('PartialRequired'), [ + factory.createTypeParameterDeclaration(undefined, factory.createIdentifier('T'), undefined, undefined), factory.createTypeParameterDeclaration( undefined, - factory.createIdentifier("T"), - undefined, - undefined - ), - factory.createTypeParameterDeclaration( - undefined, - factory.createIdentifier("K"), + factory.createIdentifier('K'), factory.createTypeOperatorNode( ts.SyntaxKind.KeyOfKeyword, - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ) + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined) ), undefined - ) + ), ], - factory.createTypeReferenceNode( - factory.createIdentifier("Id"), - [factory.createIntersectionTypeNode([ - factory.createTypeReferenceNode( - factory.createIdentifier("Required"), - [factory.createTypeReferenceNode( - factory.createIdentifier("Pick"), - [ - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ), - factory.createTypeReferenceNode( - factory.createIdentifier("K"), - undefined - ) - ] - )] - ), - factory.createTypeReferenceNode( - factory.createIdentifier("Omit"), - [ - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ), - factory.createTypeReferenceNode( - factory.createIdentifier("K"), - undefined - ) - ] - ) - ])] - ) + factory.createTypeReferenceNode(factory.createIdentifier('Id'), [ + factory.createIntersectionTypeNode([ + factory.createTypeReferenceNode(factory.createIdentifier('Required'), [ + factory.createTypeReferenceNode(factory.createIdentifier('Pick'), [ + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), + factory.createTypeReferenceNode(factory.createIdentifier('K'), undefined), + ]), + ]), + factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [ + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), + factory.createTypeReferenceNode(factory.createIdentifier('K'), undefined), + ]), + ]), + ]) ), factory.createTypeAliasDeclaration( undefined, - factory.createIdentifier("MinimumRequiredGet"), - [factory.createTypeParameterDeclaration( - undefined, - factory.createIdentifier("T"), - undefined, - undefined - )], - factory.createTypeReferenceNode( - factory.createIdentifier("Id"), - [factory.createConditionalTypeNode( - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ), + factory.createIdentifier('MinimumRequiredGet'), + [factory.createTypeParameterDeclaration(undefined, factory.createIdentifier('T'), undefined, undefined)], + factory.createTypeReferenceNode(factory.createIdentifier('Id'), [ + factory.createConditionalTypeNode( + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), factory.createTypeLiteralNode([ factory.createPropertySignature( undefined, - factory.createIdentifier("metadata"), + factory.createIdentifier('metadata'), factory.createToken(ts.SyntaxKind.QuestionToken), factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword) ), factory.createPropertySignature( undefined, - factory.createIdentifier("apiVersion"), + factory.createIdentifier('apiVersion'), factory.createToken(ts.SyntaxKind.QuestionToken), factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword) ), factory.createPropertySignature( undefined, - factory.createIdentifier("kind"), + factory.createIdentifier('kind'), factory.createToken(ts.SyntaxKind.QuestionToken), factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword) - ) + ), ]), factory.createIntersectionTypeNode([ - factory.createTypeReferenceNode( - factory.createIdentifier("Omit"), - [ - factory.createTypeReferenceNode( - factory.createIdentifier("PartialRequired"), - [ - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ), - factory.createUnionTypeNode([ - factory.createLiteralTypeNode(factory.createStringLiteral("metadata")), - factory.createLiteralTypeNode(factory.createStringLiteral("apiVersion")), - factory.createLiteralTypeNode(factory.createStringLiteral("kind")) - ]) - ] - ), - factory.createLiteralTypeNode(factory.createStringLiteral("metadata")) - ] - ), - factory.createTypeLiteralNode([factory.createPropertySignature( - undefined, - factory.createIdentifier("metadata"), - undefined, - factory.createTypeReferenceNode( - factory.createIdentifier("PartialRequired"), - [ + factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [ + factory.createTypeReferenceNode(factory.createIdentifier('PartialRequired'), [ + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), + factory.createUnionTypeNode([ + factory.createLiteralTypeNode(factory.createStringLiteral('metadata')), + factory.createLiteralTypeNode(factory.createStringLiteral('apiVersion')), + factory.createLiteralTypeNode(factory.createStringLiteral('kind')), + ]), + ]), + factory.createLiteralTypeNode(factory.createStringLiteral('metadata')), + ]), + factory.createTypeLiteralNode([ + factory.createPropertySignature( + undefined, + factory.createIdentifier('metadata'), + undefined, + factory.createTypeReferenceNode(factory.createIdentifier('PartialRequired'), [ factory.createIndexedAccessTypeNode( - factory.createTypeReferenceNode( - factory.createIdentifier("Required"), - [factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - )] - ), - factory.createLiteralTypeNode(factory.createStringLiteral("metadata")) + factory.createTypeReferenceNode(factory.createIdentifier('Required'), [ + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), + ]), + factory.createLiteralTypeNode(factory.createStringLiteral('metadata')) ), factory.createUnionTypeNode([ - factory.createLiteralTypeNode(factory.createStringLiteral("name")), - factory.createLiteralTypeNode(factory.createStringLiteral("namespace")), - factory.createLiteralTypeNode(factory.createStringLiteral("creationTimestamp")), - factory.createLiteralTypeNode(factory.createStringLiteral("resourceVersion")) - ]) - ] - ) - )]) + factory.createLiteralTypeNode(factory.createStringLiteral('name')), + factory.createLiteralTypeNode(factory.createStringLiteral('namespace')), + factory.createLiteralTypeNode(factory.createStringLiteral('creationTimestamp')), + factory.createLiteralTypeNode(factory.createStringLiteral('resourceVersion')), + ]), + ]) + ), + ]), ]), - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ) - )] - ) + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined) + ), + ]) ), factory.createTypeAliasDeclaration( undefined, - factory.createIdentifier("MinimumRequiredList"), - [factory.createTypeParameterDeclaration( - undefined, - factory.createIdentifier("T"), - undefined, - undefined - )], - factory.createTypeReferenceNode( - factory.createIdentifier("Id"), - [factory.createConditionalTypeNode( - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ), - factory.createTypeLiteralNode([factory.createPropertySignature( - undefined, - factory.createIdentifier("items"), - undefined, - factory.createArrayTypeNode(factory.createTypeLiteralNode([ - factory.createPropertySignature( - undefined, - factory.createIdentifier("metadata"), - factory.createToken(ts.SyntaxKind.QuestionToken), - factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword) - ), + factory.createIdentifier('MinimumRequiredList'), + [factory.createTypeParameterDeclaration(undefined, factory.createIdentifier('T'), undefined, undefined)], + factory.createTypeReferenceNode(factory.createIdentifier('Id'), [ + factory.createConditionalTypeNode( + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), + factory.createTypeLiteralNode([ + factory.createPropertySignature( + undefined, + factory.createIdentifier('items'), + undefined, + factory.createArrayTypeNode( + factory.createTypeLiteralNode([ + factory.createPropertySignature( + undefined, + factory.createIdentifier('metadata'), + factory.createToken(ts.SyntaxKind.QuestionToken), + factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword) + ), + factory.createPropertySignature( + undefined, + factory.createIdentifier('apiVersion'), + factory.createToken(ts.SyntaxKind.QuestionToken), + factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword) + ), + factory.createPropertySignature( + undefined, + factory.createIdentifier('kind'), + factory.createToken(ts.SyntaxKind.QuestionToken), + factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword) + ), + ]) + ) + ), + ]), + factory.createIntersectionTypeNode([ + factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [ + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), + factory.createLiteralTypeNode(factory.createStringLiteral('items')), + ]), + factory.createTypeLiteralNode([ factory.createPropertySignature( undefined, - factory.createIdentifier("apiVersion"), - factory.createToken(ts.SyntaxKind.QuestionToken), - factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword) - ), - factory.createPropertySignature( + factory.createIdentifier('items'), undefined, - factory.createIdentifier("kind"), - factory.createToken(ts.SyntaxKind.QuestionToken), - factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword) - ) - ])) - )]), - factory.createIntersectionTypeNode([ - factory.createTypeReferenceNode( - factory.createIdentifier("Omit"), - [ - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ), - factory.createLiteralTypeNode(factory.createStringLiteral("items")) - ] - ), - factory.createTypeLiteralNode([factory.createPropertySignature( - undefined, - factory.createIdentifier("items"), - undefined, - factory.createArrayTypeNode(factory.createTypeReferenceNode( - factory.createIdentifier("MinimumRequiredGet"), - [factory.createIndexedAccessTypeNode( - factory.createIndexedAccessTypeNode( - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined + factory.createArrayTypeNode( + factory.createTypeReferenceNode(factory.createIdentifier('MinimumRequiredGet'), [ + factory.createIndexedAccessTypeNode( + factory.createIndexedAccessTypeNode( + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined), + factory.createLiteralTypeNode(factory.createStringLiteral('items')) + ), + factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword) ), - factory.createLiteralTypeNode(factory.createStringLiteral("items")) - ), - factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword) - )] - )) - )]) + ]) + ) + ), + ]), ]), - factory.createTypeReferenceNode( - factory.createIdentifier("T"), - undefined - ) - )] - ) - ) + factory.createTypeReferenceNode(factory.createIdentifier('T'), undefined) + ), + ]) + ), ]; diff --git a/packages/kubekit-codegen/test/__snapshots__/cli.test.ts.snap b/packages/kubekit-codegen/test/__snapshots__/cli.test.ts.snap index 70c6b609..f784b60b 100644 --- a/packages/kubekit-codegen/test/__snapshots__/cli.test.ts.snap +++ b/packages/kubekit-codegen/test/__snapshots__/cli.test.ts.snap @@ -36,7 +36,7 @@ type MinimumRequiredList = Id< } : T >; -export const getCoreV1ApiResources = (args: GetCoreV1ApiResourcesApiArg, options?: Options) => { +export const getCoreV1ApiResources = (options?: Options) => { return apiClient>({ path: \`/api/v1/\` }, options); }; export function listCoreV1ComponentStatus( @@ -13099,7 +13099,7 @@ type MinimumRequiredList = Id< } : T >; -export const getCoreV1ApiResources = (args: GetCoreV1ApiResourcesApiArg, options?: Options) => { +export const getCoreV1ApiResources = (options?: Options) => { return apiClient>({ path: \`/api/v1/\` }, options); }; export function listCoreV1ComponentStatus( diff --git a/packages/kubekit-codegen/test/__snapshots__/generateEndpoints.test.ts.snap b/packages/kubekit-codegen/test/__snapshots__/generateEndpoints.test.ts.snap index d2929e16..8ddb87ed 100644 --- a/packages/kubekit-codegen/test/__snapshots__/generateEndpoints.test.ts.snap +++ b/packages/kubekit-codegen/test/__snapshots__/generateEndpoints.test.ts.snap @@ -45,10 +45,7 @@ type MinimumRequiredList = Id< } : T >; -export const getHealthcheck = ( - args: GetHealthcheckApiArg, - options?: Options -) => { +export const getHealthcheck = (options?: Options) => { return apiClient>( { path: \`/healthcheck\` }, options @@ -135,7 +132,7 @@ export const uploadFile = (args: UploadFileApiArg, options?: Options) => { options ); }; -export const getInventory = (args: GetInventoryApiArg, options?: Options) => { +export const getInventory = (options?: Options) => { return apiClient>( { path: \`/store/inventory\` }, options @@ -198,7 +195,7 @@ export const loginUser = (args: LoginUserApiArg, options?: Options) => { options ); }; -export const logoutUser = (args: LogoutUserApiArg, options?: Options) => { +export const logoutUser = (options?: Options) => { return apiClient>( { path: \`/user/logout\` }, options @@ -920,7 +917,7 @@ export const uploadFile = (args: UploadFileApiArg, options?: Options) => { options ); }; -export const getInventory = (args: GetInventoryApiArg, options?: Options) => { +export const getInventory = (options?: Options) => { return apiClient>( { path: \`/store/inventory\` }, options @@ -983,7 +980,7 @@ export const loginUser = (args: LoginUserApiArg, options?: Options) => { options ); }; -export const logoutUser = (args: LogoutUserApiArg, options?: Options) => { +export const logoutUser = (options?: Options) => { return apiClient>( { path: \`/user/logout\` }, options @@ -1434,7 +1431,7 @@ export const uploadFile = (args: UploadFileApiArg, options?: Options) => { options ); }; -export const getInventory = (args: GetInventoryApiArg, options?: Options) => { +export const getInventory = (options?: Options) => { return apiClient>( { path: \`/store/inventory\` }, options @@ -1497,7 +1494,7 @@ export const loginUser = (args: LoginUserApiArg, options?: Options) => { options ); }; -export const logoutUser = (args: LogoutUserApiArg, options?: Options) => { +export const logoutUser = (options?: Options) => { return apiClient>( { path: \`/user/logout\` }, options