Wildcard generation can return empty schemas on Windows due to path comparison
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start at buildGenerator(), where onlyIncludeFiles is compared with file.fileName, and review the related pathEqual() use in getMainFileSymbols(). Add a regression test covering Windows-style and slash-separated paths, then run the existing suite. Done means wildcard generation includes the expected definitions on Windows without changing the checked-in schema output.
Written by the indexing model from the issue text.
Description
Summary
On Windows, wildcard generation ("*") can produce an empty definitions object even though named-type generation works.
This was isolated while investigating:
https://github.com/modelcontextprotocol/modelcontextprotocol/issues/3114
Root cause
For the same source file on Windows:
glob result: schema\draft\schema.ts
TypeScript source: schema/draft/schema.ts
exactStringEqual: false
pathEqual: true
buildGenerator() currently checks membership using:
return onlyIncludeFiles.indexOf(file.fileName) >= 0;
That causes the source not to be classified as a user file when Windows path separators differ.
Direct instrumentation showed:
rawUserSymbols: 0
rawMainFileSymbols: 0
canonicalUserSymbols: 155
canonicalMainFileSymbols: 155
namedAudioContent: 1
The library already uses pathEqual() for a related comparison in getMainFileSymbols().
Verified fix
Changing:
return onlyIncludeFiles.indexOf(file.fileName) >= 0;
to:
return onlyIncludeFiles.some((f) => pathEqual(f, file.fileName));
was tested against the Model Context Protocol schema generator on Windows with typescript-json-schema 0.68.0.
Generated definition counts after the fix:
2024-11-05 79
2025-03-26 83
2025-06-18 91
2025-11-25 145
2026-07-28 155
draft 155
The regenerated schemas had no diff from the checked-in files.
Validation result:
Results: 258 passed, 0 failed
I can submit a focused PR with the one-line fix and a regression test.
- Dominant language
- TypeScript
- Stars
- 3.3k
- Forks
- 332
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from YousefED/typescript-json-schema
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
YousefED/typescript-json-schema#640 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
YousefED/typescript-json-schema#633 · 6 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
YousefED/typescript-json-schema#626 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
YousefED/typescript-json-schema#624 · 1 reaction ·
All issues in YousefED/typescript-json-schema
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100