Skip to content

Commit e9d8bc1

Browse files
ochafikclaude
andcommitted
feat: use ts-morph for robust AST-based schema post-processing
Replace fragile regex-based post-processing with ts-morph AST transforms: - Add ts-morph dependency for TypeScript AST manipulation - Refactor all transforms to collect nodes first, then modify (prevents infinite loops) - Add field-level validation overrides via configuration: - AnnotationsSchema.lastModified: z.iso.datetime({ offset: true }) - RootSchema.uri: z.string().startsWith("file://") - Improve union-to-enum transform to handle all cases including chained methods Re-export AnnotationsSchema and RootSchema from generated (now have proper validation). Total schemas re-exported: 22 Lines saved: ~202 (2600 → 2398) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5b48124 commit e9d8bc1

File tree

5 files changed

+347
-236
lines changed

5 files changed

+347
-236
lines changed

package-lock.json

Lines changed: 77 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
},
118118
"devDependencies": {
119119
"@cfworker/json-schema": "^4.1.1",
120-
"ts-to-zod": "^5.1.0",
121120
"@eslint/js": "^9.39.1",
122121
"@types/content-type": "^1.1.8",
123122
"@types/cors": "^2.8.17",
@@ -134,6 +133,8 @@
134133
"eslint-plugin-n": "^17.23.1",
135134
"prettier": "3.6.2",
136135
"supertest": "^7.0.0",
136+
"ts-morph": "^27.0.2",
137+
"ts-to-zod": "^5.1.0",
137138
"tsx": "^4.16.5",
138139
"typescript": "^5.5.4",
139140
"typescript-eslint": "^8.48.1",

0 commit comments

Comments
 (0)