Java 使用SpringDataRest架构确定属性是否为集合
我正在构建一个动态适应spring数据rest端点的客户机/代码生成器 我通过两个请求请求模式信息:Java 使用SpringDataRest架构确定属性是否为集合,java,spring,spring-data,spring-data-rest,Java,Spring,Spring Data,Spring Data Rest,我正在构建一个动态适应spring数据rest端点的客户机/代码生成器 我通过两个请求请求模式信息: curl -v -H "Accept: application/schema+json" http://localhost:8080/legalEntity curl -v -H "Accept: application/hal+json" http://localhost:8080/legalEntity 这给了我一个ApiLegalEntity的模式。特别是,我对这个实体的一个子属性感兴趣
curl -v -H "Accept: application/schema+json" http://localhost:8080/legalEntity
curl -v -H "Accept: application/hal+json" http://localhost:8080/legalEntity
这给了我一个ApiLegalEntity
的模式。特别是,我对这个实体的一个子属性感兴趣,我知道它是一个列表
。对于schema,我得到:
{
"title": "Api legal entity",
"properties": {
"accounts": {
"title": "Accounts",
"readOnly": true,
"type": "string",
"format": "uri"
},
...
},
"definitions": {},
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#"
}
到目前为止,除了财产名称,我无法破译任何东西,但幸运的是,哈尔告诉我(几乎)其他一切:
{
"alps": {
"version": "1.0",
"descriptors": [
{
"id": "legalentities-representation",
"href": "http://.../profile/legalentities",
...
"descriptors": [
{
"name": "accounts",
"type": "SAFE",
"rt": "http://.../#accounts-representation"
},
...
]
},
{
"id": "get-legalentities",
...
},
]
}
}
太好了!现在从“rt”:http://.../#accounts-表示“
我知道accounts
属性是一个apaccount
实体。现在,我如何判断这是一个帐户集合