小编nis*_*ant的帖子

如何在JSON模式中使用定义(draft-04)

我正在使用的其余服务响应类似于以下示例,我在此处仅包含3个字段,但还有更多:

{
    "results": [
        {
            "type": "Person",
            "name": "Mr Bean",
            "dateOfBirth": "14 Dec 1981"
        },
        {
            "type": "Company",
            "name": "Pi",
            "tradingName": "Pi Engineering Limited"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

我想为上面的(draft-04)编写一个JSON模式文件,它将明确指定:

if type == Person then list of required properties is ["type", "name", "dateOfBirth", etc] 
OR
if type == "Company" then list of required properties is ["type", "name", "tradingName", etc]
Run Code Online (Sandbox Code Playgroud)

但是我无法找到任何文档或如何执行此操作的示例.

目前我的JSON架构如下所示:

{
    "$schema": "http://json-schema.org/draft-04/schema",
    "type": "object",
    "required": ["results" ],
    "properties": {
        "results": {
            "type": "array",
            "items": {
                "type": "object",
                "required": ["type", "name"], …
Run Code Online (Sandbox Code Playgroud)

json jsonschema

20
推荐指数
2
解决办法
2万
查看次数

Kibana 4自定义仪表板

具有聚合功能的Kibana 4对我来说非常有用,但我需要进行应用程序端连接才能使用可用数据.

在kibana 4中是否有办法执行应用程序端连接(查询+代码集)并返回仪表板?

我在线阅读有关如何执行脚本仪表板的文档(kibana 3)http://www.elasticsearch.org/guide/en/kibana/current/templated-and-scripted-dashboards.html但是我的理解是这是kibana不再支持4.

elasticsearch kibana

9
推荐指数
1
解决办法
3981
查看次数

JSONSchema将一个大的模式文件拆分为多个逻辑较小的文件

我希望在文件中捕获json模式的公共部分,然后从主模式文件中引用此文件.所以基本上代替了1个大的json模式文件,多个文件相互引用.我使用json-schema-validator lib来验证.

例如:

$ ls schemas/
response_schema.json results_schema.json

$ cat schemas/response_schema.json
{
    "$schema": "http://json-schema.org/draft-04/schema",
    "type": "object",
    "required": [ "results" ],
    "properties": {
        "results": "####Reference results_schema.json file here somehow####"
    }
}   

$ cat schemas/results_schema.json
{
    "$schema": "http://json-schema.org/draft-04/schema",
    "type": "array",
    "items": {
        "type": "object",
        "required": ["type", "name"],
        "properties": {
            "name": { "type": "string" },
            "dateOfBirth": { "type": "string" }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

json jsonschema

6
推荐指数
1
解决办法
6283
查看次数

具有独立测试模块的Maven多模块项目-代码覆盖率?

我有一个Maven多模块项目。

root:
    moduleA/   # no unit tests
    moduleB/   # no unit tests
    moduleC/   # no unit tests
    tests/     # All unit tests, since depends on modules A, B and C
Run Code Online (Sandbox Code Playgroud)

所有测试都在称为tests /的单个模块中,所有代码都在单独的模块中。

有没有办法获得代码覆盖率?

java code-coverage maven jacoco-maven-plugin

5
推荐指数
2
解决办法
1890
查看次数

如何使org.apache.cxf.interceptor.LoggingInInterceptor登录自定义日志文件

在正在处理的应用程序中,org.apache.cxf.interceptor.LoggingInInterceptor当前正在将HTTP请求/响应记录到catalina.out中.

我希望它以某种方式将此信息复制到一个单独的日志文件中.有关如何做到这一点的任何指示?

java cxf

1
推荐指数
1
解决办法
8812
查看次数