@kubb/plugin-oas
Version:
OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.
17 lines (14 loc) • 567 B
text/typescript
import transformers from '@kubb/core/transformers'
import { URLPath } from '@kubb/core/utils'
import type { Operation } from '@kubb/oas'
export function getComments(operation: Operation): string[] {
return [
operation.getDescription() && `@description ${operation.getDescription()}`,
operation.getSummary() && `@summary ${operation.getSummary()}`,
operation.path && `{@link ${new URLPath(operation.path).URL}}`,
operation.isDeprecated() && '@deprecated',
]
.filter(Boolean)
.map((text) => transformers.trim(text))
.filter(Boolean)
}