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()); } }
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); } } }
protected boolean _equals(ArraySchema that) { return equals(getAdditionalItems(), that.getAdditionalItems()) && equals(getItems(), that.getItems()) && equals(getMaxItems(), that.getMaxItems()) && equals(getMinItems(), that.getMinItems()) && equals(getUniqueItems(), that.getUniqueItems()) && super._equals(that); }
protected boolean _equals(ArraySchema that) { return equals(getAdditionalItems(), that.getAdditionalItems()) && equals(getItems(), that.getItems()) && equals(getMaxItems(), that.getMaxItems()) && equals(getMinItems(), that.getMinItems()) && equals(getUniqueItems(), that.getUniqueItems()) && super._equals(that); }
Integer entries; if (arrSchema.getMinItems() != null && arrSchema.getMinItems().equals(entries = arrSchema.getMaxItems())) { Items items = arrSchema.getItems(); if (items.isSingleItems()) {