private void arrayExample(StringBuilder sb, int maxlength, String indent, JsonSchema schema, Map<String, JsonSchema> refs, Set<String> followed, Set<String> referenced) { sb.append("[\n").append(indent).append(" "); ArraySchema as = schema.asArraySchema(); if (as.getItems() == null) { sb.append(" ... ]"); } else if (as.getItems().isSingleItems()) { example(sb, maxlength, indent + " ", as.getItems().asSingleItems().getSchema(), refs, followed, referenced); sb.append(",\n").append(indent).append(" ...\n").append(indent).append("]"); } else if (as.getItems().isArrayItems()) { ArrayItems items = as.getItems().asArrayItems(); for (JsonSchema item : items.getJsonSchemas()) { sb.append("\n").append(indent); example(sb, maxlength, indent + " ", item, refs, followed, referenced); sb.append(","); } sb.append("]"); } else { throw new UnsupportedOperationException(as.getItems().toString()); } }
if (arrSchema.getMinItems() != null && arrSchema.getMinItems().equals(entries = arrSchema.getMaxItems())) { Items items = arrSchema.getItems(); if (items.isSingleItems()) { if (items.asSingleItems().getSchema().get$ref() == null) { items.asSingleItems().getSchema().set$ref(arrSchema.get$ref()); pObject = readObject(objectClass, items.asSingleItems().getSchema(), name, entries); } else { throw new SchemaErrorException("RCGenericObject.readObject: array not SingleItem type");
private void findRefs(JsonSchema schema, Map<String, JsonSchema> refs, Set<String> referenced) { addRef(schema, refs); if (schema instanceof ReferenceSchema) { referenced.add(schema.get$ref()); } else if (schema.isArraySchema()) { ArraySchema as = schema.asArraySchema(); if (as.getItems() != null) { if (as.getItems().isSingleItems()) { findRefs(as.getItems().asSingleItems().getSchema(), refs, referenced); } else if (as.getItems().isArrayItems()) { ArrayItems items = as.getItems().asArrayItems(); for (JsonSchema item : items.getJsonSchemas()) { findRefs(item, refs, referenced); } } else { throw new UnsupportedOperationException(as.getItems().toString()); } } } else if (schema.isObjectSchema()) { ObjectSchema os = schema.asObjectSchema(); for (JsonSchema value : os.getProperties().values()) { findRefs(value, refs, referenced); } } }