jsonSchema.setTitle(jsonObject.optString("title", null));
jsonSchema.setDescription(jsonObject.optString("description", null));
Object typeValue = jsonObject.opt("type");
if (typeValue instanceof JSONArray) {
jsonSchema.setTypes(convertSchemaTypesFromJSONValues(new GenericJSONArrayList((JSONArray) typeValue)));
} else if (typeValue instanceof Collection) {
//noinspection unchecked
jsonSchema.setTypes(convertSchemaTypesFromJSONValues((Collection) typeValue));
} else if (typeValue != null) {
jsonSchema.setTypes(convertSchemaTypesFromJSONValues(Collections.singleton(typeValue)));
}
for (final JSONSchemaType<?> type : jsonSchema.getTypes()) {
Object defaultValue = jsonObject.opt("default");
Number minimum = (Number) jsonObject.opt("minimum");
Boolean minimumExclusive = (Boolean) jsonObject.opt("exclusiveMinimum");
Number maximum = (Number) jsonObject.opt("maximum");
Boolean maximumExclusive = (Boolean) jsonObject.opt("exclusiveMaximum");
Number divisibleBy = (Number) jsonObject.opt("divisibleBy");
List<Object> enums = new GenericJSONArrayList(jsonObject.optJSONArray("enum"));
if (type instanceof JSONSchemaBooleanType) {
JSONSchemaBooleanType booleanType = (JSONSchemaBooleanType) type;
if (defaultValue instanceof Boolean) {
booleanType.setDefaultValue((Boolean) defaultValue);