Regenerate case conversion TS bindings#5434
Open
rekhoff wants to merge 14 commits into
Open
Conversation
Signed-off-by: Ryan <r.ekhoff@clockworklabs.io>
…case-conv-bindings Signed-off-by: Ryan <r.ekhoff@clockworklabs.io>
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.
Description of Changes
Updates the TypeScript code generator to emit correct
.name()values on table fields, and updates the three affected Case Conversion Test snapshots.Problem: For source identifiers with mixed/PascalCase casing (e.g.,
Player1Id), the in-process codegen path used bycargo testandcheck-diff.shemitted.name()calls using the pre-conversion identifier (name('Player1Id')) instead of the canonical database column name (name('player_1_id')). The CLIspacetime generatepath was already correct because itsextract-schemaround-trip canonicalizes names before codegen. The two paths disagreed, causingcheck-diffCI failures.Root cause / Fix:
write_object_type_builder_fieldsincrates/codegen/src/typescript.rswas using theTypespaceForGeneratepre-conversion identifier for.name(). It now accepts an optional&[ColumnDef]and emitscolumn.namefor table fields. The camelCase accessor key (e.g.,player1Id) is unchanged; only the underlying wire/database column name is corrected to snake_case.The three snapshot files in
crates/bindings-typescript/case-conversion-test-client/src/module_bindings/are updated to match the corrected output.API and ABI breaking changes
No API or ABI changes at the Rust crate or C ABI level.
For TypeScript users, this is a bug fix for the in-process generation path; the CLI path was already correct.
Expected complexity level and risk
1 - Trivial
Testing
cargo test -p spacetimedb-sdk -- case_conversionpath onmastergenerated incorrect PascalCase.name()values (name("Player1Id"), missing.name()forcurrentLevel2/status3Field..name()values (name("player_1_id"),name("current_level_2"),name("status_3_field")), matching the updated snapshots.spacetime generate --lang typescriptpath produces identical snake_case output on bothmasterand the PR branch."current_level_2","player_1_id","player_ref") via the SDKtoSql()function.