Reputation: 1175
I want to create the json schema of the following:
My java pojo looks like:
public class Filter {
Map<String, Object>
Map<String, Integer> sort;
int offset = -1;
int limit = -1;
List<String> responseFields;
}
My sample json looks like:
{
"terms": {
"foo":"bar",
"foo1":1
},
"sort": {
"foo": 1
},
"offset": 1,
"limit": 25,
"responseFields": ["foo", "foo1"]
}
I'm stuck at creating the json-schema for the terms and order fields. Can anyone please let me know how i could mode this?
Upvotes: 1
Views: 1725
Reputation: 24409
Map<String, ???>
can be described with { "type": "object", "additionalProperties": ??? }
.
{
"type": "object",
"properties": {
"terms": { "type": "object" },
"sort": {
"type": "object",
"additionalProperties": { "type": "integer" }
},
"offset": { "type": "integer" },
"limit": { "type": "integer" },
"responseFields": {
"type": "array",
"items": { "type": "string" }
}
}
}
Upvotes: 1