Skip to content

Commit 35c87a9

Browse files
adriandElMassimo
andauthored
feat: convert uuid fields to string type (#24)
Co-authored-by: Máximo Mussini <maximomussini@gmail.com>
1 parent 34e747f commit 35c87a9

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ bundle install
1212
pnpm install
1313
```
1414

15+
```
16+
pnpm migrate
17+
```
18+
1519
## Making sure your changes pass all tests
1620

1721
There are a number of automated checks which run on GitHub Actions when a pull request is created.
@@ -24,11 +28,13 @@ pnpm lint
2428
```
2529

2630
### 2. Check the code for Ruby style violations
31+
2732
```
2833
bin/rubocop
2934
```
3035

3136
### 3. Run the test suite
37+
3238
```
3339
bin/rspec
3440
```

spec/types_from_serializers/generator_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ def generate_serializers
116116
expect(ts_type).to eq(:string)
117117
end
118118

119+
it "maps uuid type from SQL to string type in TypeScript" do
120+
db_type = :uuid
121+
122+
ts_type = TypesFromSerializers.config.sql_to_typescript_type_mapping[db_type]
123+
124+
expect(ts_type).to eq(:string)
125+
end
126+
119127
it "maps json type from SQL to object type in TypeScript" do
120128
db_type = :json
121129

types_from_serializers/lib/types_from_serializers/generator.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ def default_config(root)
392392
string: :string,
393393
text: :string,
394394
citext: :string,
395+
uuid: :string,
395396
json: "Record<string, any>",
396397
jsonb: "Record<string, any>",
397398
}.tap do |types|

0 commit comments

Comments
 (0)