我有一个要求,我必须接受对象列表。
突变类中的方法如下所示
@GraphQLMutation //1
public void ack(@GraphQLInputField List<PingEntity> pingEntityList) { //2
log.info("Handling ack calls.");
pingEntityRepository.savePingEntityList(pingEntityList);
}
PingEntity 看起来像这样
@Data
//@Document(collection="pingdatastore")
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class PingEntity {
private String id;
@JsonProperty("action")
private String action;
@JsonProperty("message")
private String message;
@JsonProperty("timestamp")
private Long timestamp;
@JsonProperty("transactionId")
private String transactionId;
@JsonProperty("type")
private Integer type;
private String imei;
}
我的查询看起来像这样
mutation ack {
ack(pingEntityList: [{action: "KEEP-ALIVE2", message: "Keep alive message at regular intervals", timestamp: 1462747047}]) {
id
}
}
我得到这样的错误:
"data": null,
"errors": [
{
"validationErrorType": "SubSelectionNotAllowed",
"message": "Validation error of type SubSelectionNotAllowed: Sub selection not allowed on leaf type Boolean",
"locations": [
{
"line": 2,
"column": 3
}
],
"errorType": "ValidationError"
}
]
}
我尝试给出不同的注释。我无法解决这个问题..在这个问题上需要帮助
提前致谢 :)