[2,"1498134496","StatusNotification",{"connectorId":"1","errorCode":"NoError","info":"NoError","status":"Available","timestamp": "2017-06-22 12:28:16","vendorId":"CPV07","vendorErrorCode":"123ASD"}]
package com.chakra.ev.webservice.jsonschema;
import javax.persistence.Column;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
@Getter
@Setter
@AllArgsConstructor
@ToString
@RequiredArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class StatusNotificationSchema {
public Integer connectorId;
public String errorCode;
public String info;
public String status;
public String timestamp;
public String vendorId;
public String vendorErrorCode;
}
这是我接收的json数组,如何为此编写json schema类?前三个没有密钥及其json数组。
答案 0 :(得分:0)
我认为主要问题是前三个数组参数。这是有效的JSON。我认为json架构应该是这样的:
{
"type": "array",
"items": [
{
"type": "number"
},
{
"type": "string"
},
{
"type": "string",
"enum": ["StatusNotification", ...]
},
{
"type": "object",
"properties": {
"connectionId": {
//...
}, //...
}, // ...
}
]
}