codemods: model-to-schema typescript support#10474
Open
BobrImperator wants to merge 16 commits intowarp-drive-data:mainfrom
Open
codemods: model-to-schema typescript support#10474BobrImperator wants to merge 16 commits intowarp-drive-data:mainfrom
BobrImperator wants to merge 16 commits intowarp-drive-data:mainfrom
Conversation
7d61f8b to
83d7f90
Compare
BobrImperator
commented
Feb 17, 2026
| collectTraitImports(extendedTraits, imports, options); | ||
|
|
||
| const traitSchemaName = traitInterfaceName; | ||
| const traitSchemaName = `${toPascalCase(baseName)}Schema`; |
Contributor
Author
There was a problem hiding this comment.
A recurring problem so far is shotgun surgeries like this which are also very error prone that Claude was very happy with. Additionally the codemod often lacks the ability to quickly refer from a file to it's dependencies for the exact same reason.
There's on-going effort to wrangle this up https://github.com/BobrImperator/data/compare/codemod/typescript-support...BobrImperator:data:codemod/poc-typescript?expand=1
6d62aed to
5894553
Compare
5894553 to
d5cec6a
Compare
…e, update codemod to account
260f072 to
640d45c
Compare
640d45c to
5801423
Compare
aa9411f to
bf28e98
Compare
BobrImperator
commented
Feb 27, 2026
| readonly isForControlsAssessment: boolean | null; | ||
| readonly frameworks: HasMany<Framework>; | ||
| }", | ||
| // @ts-expect-error TS disallows it. However in real world \`Resource\` "wins" when merged. |
Contributor
Author
There was a problem hiding this comment.
Perhaps could contain a documentation link
0d94f23 to
23db85f
Compare
Merges the codemod-tests branch which adds: - SchemaArtifact config system (artifact.ts) - createExtension utility for stripping schema fields from models - New test harness with basic-native-model-class and extension tests - Updated generateMergedSchemaCode to return GeneratedSchemaParts - Refactored function signatures across schema-generation utils
Replace FIXME placeholder in mixin and model trait generation with actual assembled code from generateMergedSchemaCode return value. Add combineSchemasAndTypes, resourcesImport, and traitsImport to DEFAULT_TEST_OPTIONS. Fix stale test assertions: .schema.js → .schema.ts, unknown | null → unknown, import path extensions, and import prefix bug in transformModelToResourceImport.
23db85f to
823ba15
Compare
BobrImperator
commented
Mar 2, 2026
| "resources/": "__dir__", | ||
| "resources/typed.ext.ts": " | ||
| import BaseModel from 'test-app/models/base-model'; | ||
| import type { Typed } from './typed.type.ts'; |
Contributor
Author
There was a problem hiding this comment.
typed.type.ts is used but not generated
BobrImperator
commented
Mar 2, 2026
Comment on lines
-795
to
+796
| import type { Type } from '@ember-data/core-types/symbols'; | ||
| import type { StaticBaseModelTraitTrait } from 'test-app/data/traits/static-base-model-trait.schema'; | ||
| import type { TypedExtension } from 'test-app/data/resources/typed.ext'; | ||
| import type { LegacyResourceSchema } from '@warp-drive/core-types/schema/fields'; |
Contributor
Author
There was a problem hiding this comment.
Removes the imports but there's no typed.ts file which would declare the merged interfaces
Add more tests for combineSchemaAndTypes true/false setting
6183097 to
52248f6
Compare
When a model like `class Foo extends BaseModel.extend(Mixin1, Mixin2)` is transformed, the generated extension class now includes the mixins in its extends clause: `export class FooExtension extends Mixin1, Mixin2`. - Add heritageLocalNames to ParsedFile to track original mixin identifiers - Thread heritageLocalNames through ModelAnalysisResult to extension generation - Add extendsClause parameter to generateExtensionCode for class format - Update snapshots to reflect new extends clause in extension classes
…e default setting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pulls changes from #10487
TraitorExtensionResourceBrandsBrands using Typescript interface merging.disableTypescriptSchemasandcombineSchemasAndTypessettingsThis does rely on the fact that some imports are effectively circular, but Typescript appears to be fine with that.