Skip to content

parseParamTag

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/libs/parser-core/src/openapi/doc-annotations.ts

Read a @param line across the four conventions that share the @ syntax but disagree on where the name sits:

JSDoc @param {string} projectId The project id PHPDoc @param string $projectId The project id Javadoc @param projectId The project id swaggo @Param projectId path string true "The project id"

Returning null rather than guessing matters: a mis-read line would attach one parameter's prose to a different parameter, which is worse than leaving both undocumented.

Signature

ts
function parseParamTag(rest: string): { name: string; description: string } | null

Parameters

NameType
reststring

Returns: { name: string; description: string } | null

Was this page helpful?

Download as PDF