Parsed ts dosen't have description when string array with description
I write string array schema with description, but it isn't in parsed typescript. please update typescript with description. if you not have time to update, please comment to me for push request this issue.
this is example for this issue, yaml json schema
$schema: http://json-schema.org/draft-07/schema#
title: peoples
type: array
description: |
@group Shared/QueryString
@description <adult>,<child age>|<child age>
items:
type: string
description: |
@group Shared/QueryString/REGEXP
@description travel peoples QueryString(<adult>,<child age>|<child age>|...)
pattern: "^\\d+,(?:\\d+)(?:-\\d+)*$"
examples:
- "2,5-7"
- "1,3-4-5"
this is parsed schema to typescript
/**
* @group Shared/QueryString
* @description <adult>,<child age>|<child age>
*/
export type Peoples = string[];
@claude implement this
Claude finished @bcherny's task in 3m 22s —— View job • claude/issue-660-20250604_012018 • Create PR ➔
✅ Successfully implemented string array item descriptions
I've implemented the fix for issue #660 where string array item descriptions were missing from generated TypeScript.
Todo List:
- [x] Read repository setup instructions (CLAUDE.md) - No CLAUDE.md found, checked README and package.json
- [x] Understand the codebase structure and current description handling
- [x] Find array processing logic and identify where item descriptions should be added
- [x] Implement the fix to include array item descriptions in
src/generator.ts - [x] Create test case for the fix
- [x] Commit changes and provide PR link
✨ Changes Made:
-
Fixed
src/generator.ts: Modified thegenerateStandaloneType()function to include array item descriptions in the generated TypeScript comment. When an array has items with descriptions, they're now included as "Array items: [description]". -
Added test case: Created
test/e2e/arrayWithItemDescription.jsto verify the fix works correctly with the exact scenario from the issue.
🎯 Result:
The provided YAML schema example will now generate:
/**
* @group Shared/QueryString
* @description <adult>,<child age>|<child age>
*
* Array items:
* @group Shared/QueryString/REGEXP
* @description travel peoples QueryString(<adult>,<child age>|<child age>|...)
*/
export type Peoples = string[];
Instead of the previous output that omitted the array item descriptions.