I'm using Jackson jsonSchema(https://github.com/FasterXML/jackson-module-jsonSchema), to automate schema creation for my data model.
According to samples provided in http://json-schema.org/ and in jsonSchema, the format used by json shema includes links
{
"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}"
}
]
}
But I can't find a way to add it to the generated, schema, although there is a HyperSchema object, which seems to be what I need, but I can't find how to use it.
Made an issue in json-schema project, and a pull request to support HyperSchema, based on annotations, in a form
https://github.com/FasterXML/jackson-module-jsonSchema/issues/35
public class Pet {
public String genus;
}
@JsonHyperSchema(pathStart = "/persons/", links = {
@Link(href = "{name}", rel = "self"),
@Link(href = "{name}/pet", rel = "pet", targetSchema = Pet.class)
})
public class Person {
public String name;
public String hat;
}
Changes are in https://github.com/clemble/jackson-module-jsonSchema