TypeDef generatedType = TypeUtils.allProperties(pojo) .stream() .filter(p -> p.getName().equals(m.getName()))
/** * Creates the JSON schema for the particular {@TypeDef}. * @param definition The definition. * @return The schema. */ public static JSONSchemaProps from(TypeDef definition) { JSONSchemaPropsBuilder builder = new JSONSchemaPropsBuilder(); builder.withType("object"); List<String> required = new ArrayList<>(); for (Property property : TypeUtils.allProperties(definition)) { JSONSchemaProps schema = from(property.getTypeRef()); if (property.getAnnotations() .stream() .anyMatch(a -> a.getClassRef().getFullyQualifiedName().equals("javax.validation.constraints.NotNull"))) { required.add(property.getName()); } if (schema != null) { builder.addToProperties(property.getName(), from(property.getTypeRef())); } } builder.withRequired(required); return builder.build(); }
adapterImports.addAll(TypeUtils.allProperties(generatedPojo).stream() .filter(p -> p.getTypeRef() instanceof ClassRef) .map(p -> (ClassRef) p.getTypeRef())