ts_schema 0.1.4 → 0.1.7
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: 3c5b7352bbc0b12a6d1925a6a3a3bbbd5cd07cdf0cc2357bd8ffa78ae2a914ff
|
4
|
+
data.tar.gz: a64da9cdc3cf78a889bd5a627b7da1a0db7069ca2810656d4fc6c9b100d46005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1fe180689d19ea43a0b1359bc1995dfe49432507c139b9253d89cd880810838b0c59b5e40b2fdc291fdf34921283f7e776dda5b24b0d5aa2ab1c6bc6a8544ed
|
7
|
+
data.tar.gz: 17c2297757977a80b4f311f5348f0892ebf7c645fc58d50324d75fd7cfd582b3a2e9ce22af26ae55e25c0f17a20695664a9f216736e923ecfd0aaa0d3860ff8f
|
@@ -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.concat(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