【发布时间】:2014-06-05 05:12:03
【问题描述】:
我正在使用 Jackson jsonSchema(https://github.com/FasterXML/jackson-module-jsonSchema) 为我的数据模型自动创建模式。
根据http://json-schema.org/和jsonSchema中提供的示例,json shema使用的格式包括链接
{
"name":"Product",
"properties":{
"id":{
"type":"number",
"description":"Product identifier",
"required":true
},
"name":{
"description":"Name of the product",
"type":"string",
"required":true
},
"price":{
"required":true,
"type": "number",
"minimum":0,
"required":true
},
"tags":{
"type":"array",
"items":{
"type":"string"
}
}
},
"links":[
{
"rel":"full",
"href":"{id}"
},
{
"rel":"comments",
"href":"comments/?id={id}"
}
]
}
但是我找不到将它添加到生成的架构中的方法,虽然有一个HyperSchema对象,这似乎是我需要的,但我找不到如何使用它。
【问题讨论】:
标签: json rest jackson jsonschema hateoas