我有一个HTTP请求,它发送一个有效负载如下:
{ "key1“:"value1","key2”:"value2“,"key3":"value3”}
我能够验证所有的值,但每次都必须使用组件。在这种情况下,我三次使用验证器“不是空字符串”。
1. Is there any way that I can validate all the three values in a single validator ?
2. Should I use Scatter-Gather for validating all the values in parallel(according to best-practices) ?
3. How can I validate the key set(the key set should only contain "key1", "key2" and "key3" ?更新:我已经使用连接器setVariable获取了密钥集

编辑:JSON验证器可以从exchange下载。搜索JSON模块
发布于 2019-12-13 14:49:30
我做了一个小示例来演示json验证器是如何工作的。你可以用同样的
folder.

以下是针对我的流使用不同json输入的一些响应



您可以始终增强架构以满足您的需求。您可以为每个键定义数据类型。让我们说key3应该只包含数值,key2应该是一个数组。所有这些都可以通过修改模式来实现,验证器将相应地验证传入的json。
更新:这里是here流的xml内容
<flow name="stackoverflowFlow1" doc:id="c24d34aa-ce1d-4bbb-b3fd-d73007dad60b" >
<http:listener doc:name="Listener" doc:id="80ab5db5-1d3e-409f-9990-cebf1fc07dd5" config-ref="HTTP_Listener_config" path="/valid"/>
<json:validate-schema doc:name="Validate schema" doc:id="0a51cde0-5175-4f11-b972-3d5d708094c6" schema="schema.json"/>
<logger level="INFO" doc:name="Logger" doc:id="2d95a6f0-8f88-4608-bdb8-7fae8abc0e6d" message="valid json"/>
</flow>https://stackoverflow.com/questions/59318278
复制相似问题