goa_model_gen 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/goa_model_gen.gemspec +1 -1
- data/lib/goa_model_gen/field.rb +9 -3
- data/lib/goa_model_gen/templates/model.go.erb +1 -0
- data/lib/goa_model_gen/version.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bf4c80340040eaf2b29729d5798bd0c6b6220b25b2fa75b7c8ac507c546d690
|
4
|
+
data.tar.gz: a260252e1472941a1f02ee88712dca0079f6d3898178af619ecb1fce64957132
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 723725e4b61fa693909d4f3d0ffb0337bdd2acf73a074cd79b1fb52571825f63008ce78d9326c4b0b7d1e904574fe6b79c82fc461828b27e47875acc91aaff1c
|
7
|
+
data.tar.gz: b8daf5ce16247ef444146749f9a8189a5b647a241c1a1d583e9ecb06936f1ceaf537720a7bfda94a2675b5fff36ff24ec25c47a1bc596e268b551b858fb44ba4
|
data/goa_model_gen.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_runtime_dependency "thor", "~> 0.20.0"
|
27
27
|
spec.add_runtime_dependency "activesupport"
|
28
28
|
|
29
|
-
spec.add_development_dependency "bundler"
|
29
|
+
spec.add_development_dependency "bundler"
|
30
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
31
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
32
32
|
spec.add_development_dependency "pry"
|
data/lib/goa_model_gen/field.rb
CHANGED
@@ -13,6 +13,7 @@ module GoaModelGen
|
|
13
13
|
attr_accessor :validation
|
14
14
|
attr_accessor :swagger_name
|
15
15
|
attr_reader :type_obj
|
16
|
+
attr_reader :json_tag
|
16
17
|
attr_reader :datastore_tag
|
17
18
|
attr_reader :prepare_method
|
18
19
|
|
@@ -26,6 +27,7 @@ module GoaModelGen
|
|
26
27
|
@validation = attrs['validation']
|
27
28
|
@goa_name = attrs['goa_name']
|
28
29
|
@swagger_name = attrs['swagger_name']
|
30
|
+
@json_tag = attrs['json_tag']
|
29
31
|
@datastore_tag = attrs['datastore_tag']
|
30
32
|
@prepare_method = attrs['prepare_method']
|
31
33
|
end
|
@@ -79,18 +81,22 @@ module GoaModelGen
|
|
79
81
|
end
|
80
82
|
|
81
83
|
def tag
|
82
|
-
json_tag = name.underscore.dup
|
83
|
-
json_tag << ',omitempty' if nullable?
|
84
84
|
validate_tags = nullable? ? [] : ['required']
|
85
85
|
validate_tags << validation.presence
|
86
86
|
validate_tags.compact!
|
87
87
|
[
|
88
|
-
['json', json_tag],
|
88
|
+
['json', json_tag.presence || build_json_tag],
|
89
89
|
['validate', validate_tags.join(',').presence],
|
90
90
|
['datastore', datastore_tag],
|
91
91
|
].map{|k,v| v ? "#{k}:\"#{v}\"" : nil}.compact.join(' ')
|
92
92
|
end
|
93
93
|
|
94
|
+
def build_json_tag
|
95
|
+
r = name.underscore.dup
|
96
|
+
r << ',omitempty' if nullable?
|
97
|
+
return r
|
98
|
+
end
|
99
|
+
|
94
100
|
def definition
|
95
101
|
"#{ name } #{ type } `#{ tag }`"
|
96
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goa_model_gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,8 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
|
-
|
190
|
-
rubygems_version: 2.7.6
|
189
|
+
rubygems_version: 3.0.3
|
191
190
|
signing_key:
|
192
191
|
specification_version: 4
|
193
192
|
summary: Generate model files for goa in golang
|