marty 2.6.3 → 2.6.4
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/config/locales/en.yml +1 -1
- data/lib/marty/version.rb +1 -1
- data/other/marty/api/base.rb +13 -13
- data/spec/controllers/rpc_controller_spec.rb +10 -4
- data/spec/fixtures/json/rpc_controller.json +0 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d525319e98d55b25d7ac47f40a085b1d3759f67bf400bfcecd3908fb6ed8c6e8
|
4
|
+
data.tar.gz: e3276f7391957c7fa615f2af1702944ff7a43aefd253d9e660e5c0f3cb637f1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a54c4a4e197cd114665cf83113eac00d16350501739e435080b68666ce8f78845a09d38af5cede910187b44736f4a8a0e715d2a37df7b19c541b202361e560
|
7
|
+
data.tar.gz: 92f6af0854f0d5965203669164c63370a7ad70a5d1666d9115d13a540a11828f4cfe64a69c45ac0c27a9c40e660cdff23e77440113b2cd2bef8b734248b31bd3
|
data/config/locales/en.yml
CHANGED
data/lib/marty/version.rb
CHANGED
data/other/marty/api/base.rb
CHANGED
@@ -65,6 +65,19 @@ class Marty::Api::Base
|
|
65
65
|
return { error: e.message }
|
66
66
|
end
|
67
67
|
|
68
|
+
# if schema was found
|
69
|
+
if input_schema.is_a?(Hash)
|
70
|
+
# fix numbers types
|
71
|
+
numbers = @@numbers[schema_key] ||=
|
72
|
+
Marty::JsonSchema.get_numbers(input_schema)
|
73
|
+
|
74
|
+
# modify params in place
|
75
|
+
Marty::JsonSchema.fix_numbers(params[:params], numbers)
|
76
|
+
elsif !input_schema.include?('Schema not defined')
|
77
|
+
# else if some error besides schema not defined, fail
|
78
|
+
return { error: input_schema }
|
79
|
+
end
|
80
|
+
|
68
81
|
# validate input schema
|
69
82
|
if config[:input_validated]
|
70
83
|
|
@@ -84,19 +97,6 @@ class Marty::Api::Base
|
|
84
97
|
schema_errors
|
85
98
|
end
|
86
99
|
|
87
|
-
# if schema was found
|
88
|
-
if input_schema.is_a?(Hash)
|
89
|
-
# fix numbers types
|
90
|
-
numbers = @@numbers[schema_key] ||=
|
91
|
-
Marty::JsonSchema.get_numbers(input_schema)
|
92
|
-
|
93
|
-
# modify params in place
|
94
|
-
Marty::JsonSchema.fix_numbers(params[:params], numbers)
|
95
|
-
elsif !input_schema.include?('Schema not defined')
|
96
|
-
# else if some error besides schema not defined, fail
|
97
|
-
return { error: input_schema }
|
98
|
-
end
|
99
|
-
|
100
100
|
# get script engine
|
101
101
|
begin
|
102
102
|
engine = Marty::ScriptSet.new(params[:tag]).get_engine(params[:script])
|
@@ -397,9 +397,8 @@ A:
|
|
397
397
|
"f15_number" : {"type": "number", "minimum": 0 },
|
398
398
|
"f16_array": {
|
399
399
|
"type" : "array",
|
400
|
-
"uniqueItems" : true,
|
401
400
|
"minItems" : 0,
|
402
|
-
"maxItems" :
|
401
|
+
"maxItems" : 5,
|
403
402
|
"items": {
|
404
403
|
"type" : "number",
|
405
404
|
"minimum" : 0,
|
@@ -409,9 +408,8 @@ A:
|
|
409
408
|
}}}}}},
|
410
409
|
"f7_array": {
|
411
410
|
"type" : "array",
|
412
|
-
"uniqueItems" : true,
|
413
411
|
"minItems" : 0,
|
414
|
-
"maxItems" :
|
412
|
+
"maxItems" : 5,
|
415
413
|
"items": {
|
416
414
|
"type" : "number",
|
417
415
|
"minimum" : 0,
|
@@ -1267,6 +1265,14 @@ describe Marty::RpcController do
|
|
1267
1265
|
api.app_name = 'TestApp'
|
1268
1266
|
api.script_name = 'M11'
|
1269
1267
|
api.save!
|
1268
|
+
Marty::ApiConfig.create!(script: 'M11',
|
1269
|
+
node: 'A',
|
1270
|
+
attr: nil,
|
1271
|
+
logged: false,
|
1272
|
+
input_validated: true,
|
1273
|
+
output_validated: false,
|
1274
|
+
strict_validate: false)
|
1275
|
+
|
1270
1276
|
p = File.expand_path('../../fixtures/json', __FILE__)
|
1271
1277
|
f = '%s/%s' % [p, 'rpc_controller.json']
|
1272
1278
|
begin
|
@@ -155,21 +155,5 @@
|
|
155
155
|
{"attr": "v0",
|
156
156
|
"request": {"f_bool":true},
|
157
157
|
"result": {"f_bool":true}
|
158
|
-
},
|
159
|
-
{"attr": "v0",
|
160
|
-
"request": {"f4_number": "bad"},
|
161
|
-
"result": {"f4_number": "bad"}
|
162
|
-
},
|
163
|
-
{"attr": "v0",
|
164
|
-
"request": {"f7_array": [1,"bad",3]},
|
165
|
-
"result": {"f7_array": [1.0,"bad",3.0]}
|
166
|
-
},
|
167
|
-
{"attr": "v0",
|
168
|
-
"request": {"f4_number": true},
|
169
|
-
"result": {"f4_number": true}
|
170
|
-
},
|
171
|
-
{"attr": "v0",
|
172
|
-
"request": {"f7_array": [1,true,3]},
|
173
|
-
"result": {"f7_array": [1.0,true,3.0]}
|
174
158
|
}
|
175
159
|
]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2019-04-
|
17
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: pg
|