I am trying to using the jsonschema2pojo to generate Java classes. I am running into trouble in using the '$ref' tag to refer other schemas in my parent schema.
Device.json
{
"$schema": "http://json-schema.org/draft-03/hyper-schema",
"additionalProperties": false,
"id": "device:v1",
"name": "device",
"properties": {
"components": {
"$ref": "spec.json"
},
"usage": {
"$ref": "spec.json"
}
}
},
"required": true,
"title": "Device",
"type": "object"
}
Here is my spec.json
{
"$schema": "http://json-schema.org/draft-03/hyper-schema",
"additionalProperties": false,
"id": "spec:v1",
"name": "spec",
"properties": {
"content": {
"description" : "Content",
"type": "string",
"required": false
}
},
"required": true,
"title": "spec",
"type": "object"
}
Now I expected the following java class to be created:
public class Device {
private Spec components,
private Spec usage
.....
}
and
public class Spec {
private String content
}
but I get
public class Device {
private Components components,
private Components usage
.....
}
and
public class Components {
private String content
}
What am I doing wrong?