lhj-tools 0.1.85 → 0.1.87
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lhj/command/yapi.rb +12 -14
- data/lib/lhj/tools/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88a12084e737e12b3a0e10a428407cc1e83dfd29a6831709b40bbc330ce2c183
|
4
|
+
data.tar.gz: fb31614816bf573b70f2fd03fbdab218f8ce215b512e5d63acaf29001a357893
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 344983fb4d1b4f9d60bf94f85279a17db67a1e12ee5dd5d20c1efd000d5f37ec472aec6d4a93dbd786d7cb84a033d83a96f02cc612894cf3142f5fa3169c7088
|
7
|
+
data.tar.gz: 4936c0a4f26d79e879737447ec9c7ca408925b007624a1eb7e78187021ad7069d2b1d9f7dc65130202609356e87a7f4975c41f7826ebea20cb2a6da77c3909b7
|
data/lib/lhj/command/yapi.rb
CHANGED
@@ -67,7 +67,7 @@ module Lhj
|
|
67
67
|
# 2.print request json body
|
68
68
|
req_models = print_req_body_model(res_body) if res_body['data']['req_body_is_json_schema']
|
69
69
|
# 3.print request param
|
70
|
-
print_req_query(res_body['data']) unless res_body['data']['req_body_is_json_schema']
|
70
|
+
req_models ||= print_req_query(res_body['data']) unless res_body['data']['req_body_is_json_schema']
|
71
71
|
# 4.print request method
|
72
72
|
service_code = print_http_method(res_body['data'], project_info)
|
73
73
|
# print request mock data
|
@@ -124,7 +124,7 @@ module Lhj
|
|
124
124
|
File.write(h_file, @h_file_array.join("\n")) if @h_file_array.count.positive?
|
125
125
|
File.write(m_file, @m_file_array.join("\n")) if @m_file_array.count.positive?
|
126
126
|
File.write(service_file, service_code) if service_code
|
127
|
-
File.write(req_mock_file, @req_mock_array.join("\n")) if @req_mock_array
|
127
|
+
File.write(req_mock_file, @req_mock_array.join("\n")) if @req_mock_array&.count&.positive?
|
128
128
|
|
129
129
|
puts "\n\n生成文件成功!所在路径:\n#{File.expand_path(h_file)} \n#{File.expand_path(m_file)}".green if @save && !@notify
|
130
130
|
{
|
@@ -462,19 +462,17 @@ module Lhj
|
|
462
462
|
def print_req_query(data)
|
463
463
|
return unless data && data['req_query']
|
464
464
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
puts_h "@interface #{param_model_name} : NSObject"
|
469
|
-
data['req_query'].each do |h|
|
470
|
-
des = h['desc']
|
471
|
-
puts_h "///#{des} #{h['example']}"
|
472
|
-
puts_h "@property (nonatomic, copy) NSString *#{h['name']};"
|
473
|
-
end
|
474
|
-
puts_h '@end'
|
475
|
-
puts "\n\n"
|
476
|
-
when 'java'
|
465
|
+
properties = []
|
466
|
+
data['req_query'].each do |h|
|
467
|
+
properties << { key: h['name'], type: 'string', description: h['desc'], default: '' }
|
477
468
|
end
|
469
|
+
param_model_name = gen_model_name(nil, :req)
|
470
|
+
req_model = { name: param_model_name, properties: properties }
|
471
|
+
|
472
|
+
models = [req_model]
|
473
|
+
print_models(models)
|
474
|
+
print_models_impl(models)
|
475
|
+
models
|
478
476
|
end
|
479
477
|
|
480
478
|
def print_http_method(data, project_info)
|
data/lib/lhj/tools/version.rb
CHANGED