@@ -266,31 +266,47 @@ export function schemaToOpenAPI(
266266 const emptyBlock : Block = { description : '' , tags : [ ] , source : [ ] , problems : [ ] } ;
267267 const jsdoc = parseCommentBlock ( schema . comment ?? emptyBlock ) ;
268268
269- const defaultValue = jsdoc ?. tags ?. default ?? schema . default ;
270- const example = jsdoc ?. tags ?. example ?? schema . example ;
271- const maxLength = jsdoc ?. tags ?. maxLength ?? schema . maxLength ;
272- const minLength = jsdoc ?. tags ?. minLength ?? schema . minLength ;
273- const pattern = jsdoc ?. tags ?. pattern ?? schema . pattern ;
274- const minimum = jsdoc ?. tags ?. minimum ?? schema . maximum ;
275- const maximum = jsdoc ?. tags ?. maximum ?? schema . minimum ;
276- const minItems = jsdoc ?. tags ?. minItems ?? schema . minItems ;
277- const maxItems = jsdoc ?. tags ?. maxItems ?? schema . maxItems ;
278- const minProperties = jsdoc ?. tags ?. minProperties ?? schema . minProperties ;
279- const maxProperties = jsdoc ?. tags ?. maxProperties ?? schema . maxProperties ;
280- const exclusiveMinimum = jsdoc ?. tags ?. exclusiveMinimum ?? schema . exclusiveMinimum ;
281- const exclusiveMaximum = jsdoc ?. tags ?. exclusiveMaximum ?? schema . exclusiveMaximum ;
282- const multipleOf = jsdoc ?. tags ?. multipleOf ?? schema . multipleOf ;
283- const uniqueItems = jsdoc ?. tags ?. uniqueItems ?? schema . uniqueItems ;
284- const readOnly = jsdoc ?. tags ?. readOnly ?? schema . readOnly ;
285- const writeOnly = jsdoc ?. tags ?. writeOnly ?? schema . writeOnly ;
286- const format = jsdoc ?. tags ?. format ?? schema . format ?? schema . format ;
287- const title = jsdoc ?. tags ?. title ?? schema . title ;
269+ // Use Block.tags directly for combined comments to preserve tags from all schemas
270+ const blockTags =
271+ schema . comment ?. tags ?. reduce (
272+ ( acc , tag ) => {
273+ const tagName = tag . tag . replace ( / ^ @ / , '' ) ;
274+ acc [ tagName ] = `${ tag . name } ${ tag . description } ` . trim ( ) ;
275+ return acc ;
276+ } ,
277+ { } as Record < string , string > ,
278+ ) ?? { } ;
279+ const tags = { ...blockTags , ...jsdoc ?. tags } ;
280+
281+ const defaultValue = tags ?. default ?? schema . default ;
282+ const example = tags ?. example ?? schema . example ;
283+ const maxLength = tags ?. maxLength ?? schema . maxLength ;
284+ const minLength = tags ?. minLength ?? schema . minLength ;
285+ const pattern = tags ?. pattern ?? schema . pattern ;
286+ const minimum = tags ?. minimum ?? schema . maximum ;
287+ const maximum = tags ?. maximum ?? schema . minimum ;
288+ const minItems = tags ?. minItems ?? schema . minItems ;
289+ const maxItems = tags ?. maxItems ?? schema . maxItems ;
290+ const minProperties = tags ?. minProperties ?? schema . minProperties ;
291+ const maxProperties = tags ?. maxProperties ?? schema . maxProperties ;
292+ const exclusiveMinimum = tags ?. exclusiveMinimum ?? schema . exclusiveMinimum ;
293+ const exclusiveMaximum = tags ?. exclusiveMaximum ?? schema . exclusiveMaximum ;
294+ const multipleOf = tags ?. multipleOf ?? schema . multipleOf ;
295+ const uniqueItems = tags ?. uniqueItems ?? schema . uniqueItems ;
296+ const readOnly = tags ?. readOnly ?? schema . readOnly ;
297+ const writeOnly = tags ?. writeOnly ?? schema . writeOnly ;
298+ const format = tags ?. format ?? schema . format ;
299+ const title = tags ?. title ?? schema . title ;
288300
289301 const keys = Object . keys ( jsdoc ?. tags || { } ) ;
290302
291303 const deprecated = keys . includes ( 'deprecated' ) || ! ! schema . deprecated ;
292304 const isPrivate = keys . includes ( 'private' ) ;
293- const description = schema . comment ?. description ?? schema . description ;
305+ // Combine summary and description for markdown support
306+ const description =
307+ jsdoc ?. summary && jsdoc ?. description
308+ ? `${ jsdoc . summary . trim ( ) } \n\n${ jsdoc . description . trim ( ) } `
309+ : jsdoc ?. summary ?. trim ( ) ?? jsdoc ?. description ?. trim ( ) ?? schema . description ;
294310
295311 const defaultOpenAPIObject = {
296312 ...( defaultValue ? { default : parseField ( schema , defaultValue ) } : { } ) ,
@@ -390,11 +406,22 @@ function routeToOpenAPI(route: Route): [string, string, OpenAPIV3.OperationObjec
390406 delete schema [ 'x-internal' ] ;
391407 }
392408
409+ const paramJsDoc =
410+ p . schema ?. comment !== undefined
411+ ? parseCommentBlock ( p . schema . comment )
412+ : undefined ;
413+
414+ // Combine summary and description for markdown support; use empty string for tag-only comments
415+ const paramDescription =
416+ paramJsDoc ?. summary && paramJsDoc ?. description
417+ ? `${ paramJsDoc . summary . trim ( ) } \n\n${ paramJsDoc . description . trim ( ) } `
418+ : paramJsDoc ?. summary ?. trim ( ) ??
419+ paramJsDoc ?. description ?. trim ( ) ??
420+ ( p . schema ?. comment !== undefined ? '' : undefined ) ;
421+
393422 return {
394423 name : p . name ,
395- ...( p . schema ?. comment ?. description !== undefined
396- ? { description : p . schema . comment . description }
397- : { } ) ,
424+ ...( paramDescription !== undefined ? { description : paramDescription } : { } ) ,
398425 in : p . type ,
399426 ...( isPrivate ? { 'x-internal' : true } : { } ) ,
400427 ...( p . required ? { required : true } : { } ) ,
0 commit comments