-
Notifications
You must be signed in to change notification settings - Fork 184
feat: generate JSON schema exports #4395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: generate JSON schema exports #4395
Conversation
This change modifies the type generation system to produce TypeScript source files (.ts) with embedded JSON schemas instead of declaration files (.d.ts). This enables runtime access to schema information while maintaining full type safety. Changes: - Generate .ts files instead of .d.ts files for all entity types - Export JSON schema as const alongside TypeScript interfaces - Use type-only imports with explicit .ts extensions - Update all test fixtures to support ES modules - Add comprehensive tests for JSON schema validation - Convert fixture plugin files from CommonJS to ES modules Benefits: - Runtime access to JSON schemas for validation and documentation - Better tree-shaking with type-only imports - Improved TypeScript compatibility with explicit file extensions - Maintains backward compatibility with existing type definitions Signed-off-by: Mikael Karon <[email protected]>
.ts files with JSON schema exports instead of .d.ts files
|
As it is, this is a semver-major change. Can you make it not breaking? One option would be it be keep the old behavior and add the new one behind a flag. Maybe there is another way, so that there is both a .d.ts and a .ts? I'm unsure. |
|
I think it could be possible to output the interface in a |
|
Then it'd be ok if it's not breaking. |
|
having a |
|
If it doesn't break existing users, no problem. |
fee4fab to
dcbd763
Compare
|
I'm not sure what's best here. Now I'm generating this into the |
Signed-off-by: Mikael Karon <[email protected]>
dcbd763 to
7b1e6f7
Compare
.ts files with JSON schema exports instead of .d.ts files|
Know what, it will probably make more sense to have a |
|
Yes! |
This change modifies the type generation system to produce TypeScript source files (
.ts) with embedded JSON schemas instead of declaration files (.d.ts). This enables runtime access to schema information while maintaining full type safety.Changes:
.tsfiles instead of.d.tsfiles for all entity typesas constalongside TypeScript interfaces.tsextensionsBenefits: