Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where JSDoc return was not generated if api route has no parameters #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 4 additions & 3 deletions src/gen/js/genOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ function renderDocDescription(op: ApiOperation) {

function renderDocParams(op: ApiOperation) {
const params = op.parameters
if (!params.length) return []

if (!params.length) {
return [renderDocReturn(op)]
}
const required = params.filter(param => param.required)
const optional = params.filter(param => !param.required)

Expand Down Expand Up @@ -152,7 +153,7 @@ function renderOptionalParamsSignature(op: ApiOperation, optional: ApiOperationP
function renderReturnSignature(op: ApiOperation, options: ClientOptions): string {
if (options.language !== 'ts') return ''
const response = getBestResponse(op)
return `: Promise<api.Response<${getTSParamType(response)}>>`
return `: Promise<${getTSParamType(response)}>`
}

function getParamSignature(param: ApiOperationParam, options: ClientOptions): string[] {
Expand Down