types_from_serializers 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -5
- data/lib/types_from_serializers/generator.rb +3 -2
- data/lib/types_from_serializers/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bfb48892a066d214d5a96b814516a45fce439e17f39da5293b7d972f230ff37
|
4
|
+
data.tar.gz: 741fee0da243cc9c2d07b592c2d78f05dd6b6d736aae1f4212f62ccdbc4cfa7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12b4306f9d43f471a1755cbdce1d0b956c42b4ffeb4835aa5301c3d069b69d7336c8bbebd8524fa9f5f71a56af955f9dc35675873e5a796cff98a3a9d1d49986
|
7
|
+
data.tar.gz: 579a846b0a583d0eb4fa16b111a8aca26ce04abd26c2866a19fe9767763c66c2a6d7de20d27638b0a3955b4db22f60fec53f25e5ea4f84dfc34807cb90c0ebc3
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,21 @@
|
|
1
|
-
|
1
|
+
## [0.1.1](https://github.com/ElMassimo/types_from_serializers/compare/types_from_serializers@0.1.0...types_from_serializers@0.1.1) (2022-07-12)
|
2
2
|
|
3
3
|
|
4
|
-
### Bug Fixes
|
5
4
|
|
6
|
-
|
5
|
+
# 0.1.0 (2022-07-12)
|
7
6
|
|
8
7
|
|
9
8
|
### Features
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
- Start simple, no additional syntax required
|
11
|
+
- Infers types from a related `ActiveRecord` model, using the SQL schema
|
12
|
+
- Understands JS native types and how to map SQL columns: `string`, `boolean`, etc
|
13
|
+
- Automatically types [associations](https://github.com/ElMassimo/oj_serializers#associations-dsl-), importing the generated types for the referenced serializers
|
14
|
+
- Detects [conditional attributes](https://github.com/ElMassimo/oj_serializers#rendering-an-attribute-conditionally) and marks them as optional: `name?: string`
|
15
|
+
- Fallback to a custom interface using `type_from`
|
16
|
+
- Supports custom types and automatically adds the necessary imports
|
17
|
+
- handle non-ActiveRecord models and extract types from unions ([ea9b2a7](https://github.com/ElMassimo/types_from_serializers/commit/ea9b2a71cb85503ff691e5ef115ab73f89b005af))
|
18
|
+
- support specifying base serializers and additional dirs to scan ([164cfe1](https://github.com/ElMassimo/types_from_serializers/commit/164cfe17bb0527c59cf95441381aef7bf797a568))
|
13
19
|
|
14
20
|
|
15
21
|
|
@@ -47,9 +47,10 @@ module TypesFromSerializers
|
|
47
47
|
to_s.classify.safe_constantize
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
def to_model
|
51
|
+
to_s.to_model
|
52
|
+
end
|
51
53
|
end
|
52
|
-
# rubocop:enable Rails/Delegate
|
53
54
|
|
54
55
|
refine Class do
|
55
56
|
# Internal: Name of the TypeScript interface.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: types_from_serializers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Máximo Mussini
|
@@ -142,6 +142,20 @@ dependencies:
|
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '1.0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: rubocop
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
145
159
|
- !ruby/object:Gem::Dependency
|
146
160
|
name: rubocop-rails
|
147
161
|
requirement: !ruby/object:Gem::Requirement
|