use of io.strimzi.crdgenerator.annotations.OneOf in project strimzi by strimzi.
the class CrdGenerator method buildSchemaOneOf.
private ArrayNode buildSchemaOneOf(Class<?> crdClass) {
ArrayNode alternatives;
OneOf oneOf = crdClass.getAnnotation(OneOf.class);
if (oneOf != null && oneOf.value().length > 0) {
alternatives = nf.arrayNode();
for (OneOf.Alternative alt : oneOf.value()) {
ObjectNode alternative = alternatives.addObject();
ObjectNode properties = alternative.putObject("properties");
for (OneOf.Alternative.Property prop : alt.value()) {
properties.putObject(prop.value());
}
ArrayNode required = alternative.putArray("required");
for (OneOf.Alternative.Property prop : alt.value()) {
if (prop.required()) {
required.add(prop.value());
}
}
}
} else {
alternatives = null;
}
return alternatives;
}
use of io.strimzi.crdgenerator.annotations.OneOf in project strimzi-kafka-operator by strimzi.
the class CrdGenerator method buildSchemaOneOf.
private ArrayNode buildSchemaOneOf(Class<?> crdClass) {
ArrayNode alternatives;
OneOf oneOf = crdClass.getAnnotation(OneOf.class);
if (oneOf != null && oneOf.value().length > 0) {
alternatives = nf.arrayNode();
for (OneOf.Alternative alt : oneOf.value()) {
ObjectNode alternative = alternatives.addObject();
ObjectNode properties = alternative.putObject("properties");
for (OneOf.Alternative.Property prop : alt.value()) {
properties.putObject(prop.value());
}
ArrayNode required = alternative.putArray("required");
for (OneOf.Alternative.Property prop : alt.value()) {
if (prop.required()) {
required.add(prop.value());
}
}
}
} else {
alternatives = null;
}
return alternatives;
}
Aggregations