ts_schema 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5d8f05efa9ac980177891e855cb0efc08e322b9020d5433b6106c7e32769ca4
|
4
|
+
data.tar.gz: be25c5bf7459c2fb2ed72f9d4aaf5fbc1af3d164feaabd4779ff4a2ec6d17da1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 040e9d42b416b74485b00c6c31da518a958b1d5e76436e336087589b7a92858750bbdf23a5176dde746242c8bd23a44a952858afdfbd84b25a4b585e81434060
|
7
|
+
data.tar.gz: 51dbdfa59ebab1e83e371881df092a68ce871c5d46ab3a68665211f16d3456c24e70667cb01984a745a248fac1209cee465d6c654719135181573afa0cba0843
|
@@ -41,6 +41,11 @@ TsSchema.setup do |config|
|
|
41
41
|
# Whether to generate types for associations
|
42
42
|
# config.include_associated = true
|
43
43
|
|
44
|
+
# Additional models to map which don't have a model file
|
45
|
+
# config.additional_models = [
|
46
|
+
#
|
47
|
+
# ]
|
48
|
+
|
44
49
|
# Namespace
|
45
50
|
# config.namespace = :schema
|
46
51
|
|
@@ -5,6 +5,7 @@ module TsSchema
|
|
5
5
|
def initialize
|
6
6
|
Rails.application.eager_load!
|
7
7
|
@models = ApplicationRecord.send(:subclasses)
|
8
|
+
@models << TsSchema.configuration.additional_models unless TsSchema.configuration.additional_models.empty?
|
8
9
|
@types = TsSchema.configuration.types.merge(TsSchema.configuration.custom_types || {})
|
9
10
|
end
|
10
11
|
|
@@ -33,7 +34,7 @@ module TsSchema
|
|
33
34
|
columns.concat(map_associations(model)) if TsSchema.configuration.include_associated
|
34
35
|
|
35
36
|
type_template += <<~TYPESCRIPT
|
36
|
-
interface #{model.model_name.
|
37
|
+
interface #{model.model_name.param_key.camelize} {
|
37
38
|
#{columns.map { |column| "#{indent_as_str}#{column_name_cased(column[:name])}: #{column[:ts_type]};" }.join("\n")}
|
38
39
|
}\n
|
39
40
|
TYPESCRIPT
|
data/lib/ts_schema/version.rb
CHANGED