use of io.strimzi.crdgenerator.annotations.Description in project strimzi by strimzi.
the class CrdGenerator method buildAdditionalPrinterColumns.
private ArrayNode buildAdditionalPrinterColumns(Crd.Spec crd, ApiVersion crApiVersion) {
ArrayNode cols = nf.arrayNode();
if (crd.additionalPrinterColumns().length != 0) {
for (Crd.Spec.AdditionalPrinterColumn col : Arrays.stream(crd.additionalPrinterColumns()).filter(col -> crApiVersion == null || ApiVersion.parseRange(col.apiVersion()).contains(crApiVersion)).collect(Collectors.toList())) {
ObjectNode colNode = cols.addObject();
colNode.put("name", col.name());
colNode.put("description", col.description());
colNode.put(crdApiVersion.compareTo(V1) >= 0 ? "jsonPath" : "JSONPath", col.jsonPath());
colNode.put("type", col.type());
if (col.priority() != 0) {
colNode.put("priority", col.priority());
}
if (!col.format().isEmpty()) {
colNode.put("format", col.format());
}
}
}
return cols;
}
use of io.strimzi.crdgenerator.annotations.Description in project strimzi-kafka-operator by strimzi.
the class CrdGenerator method buildAdditionalPrinterColumns.
private ArrayNode buildAdditionalPrinterColumns(Crd.Spec crd, ApiVersion crApiVersion) {
ArrayNode cols = nf.arrayNode();
if (crd.additionalPrinterColumns().length != 0) {
for (Crd.Spec.AdditionalPrinterColumn col : Arrays.stream(crd.additionalPrinterColumns()).filter(col -> crApiVersion == null || ApiVersion.parseRange(col.apiVersion()).contains(crApiVersion)).collect(Collectors.toList())) {
ObjectNode colNode = cols.addObject();
colNode.put("name", col.name());
colNode.put("description", col.description());
colNode.put(crdApiVersion.compareTo(V1) >= 0 ? "jsonPath" : "JSONPath", col.jsonPath());
colNode.put("type", col.type());
if (col.priority() != 0) {
colNode.put("priority", col.priority());
}
if (!col.format().isEmpty()) {
colNode.put("format", col.format());
}
}
}
return cols;
}
use of io.strimzi.crdgenerator.annotations.Description in project strimzi by strimzi.
the class DocGenerator method appendDescription.
private void appendDescription(Class<?> cls) throws IOException {
DescriptionFile descriptionFile = cls.getAnnotation(DescriptionFile.class);
Description description = cls.getAnnotation(Description.class);
if (descriptionFile != null) {
String filename = "api/" + cls.getCanonicalName() + ".adoc";
File includeFile = new File(filename);
if (!includeFile.isFile()) {
throw new RuntimeException("Class " + cls.getCanonicalName() + " has @DescribeFile annotation, but file " + filename + " does not exist!");
}
out.append("xref:type-").append(cls.getSimpleName()).append("-schema-{context}[Full list of `").append(cls.getSimpleName()).append("` schema properties]").append(NL);
out.append(NL);
out.append("include::../" + filename + "[leveloffset=+1]").append(NL);
out.append(NL);
out.append("[id='type-").append(cls.getSimpleName()).append("-schema-{context}']").append(NL);
out.append("==== `").append(cls.getSimpleName()).append("` schema properties").append(NL);
out.append(NL);
} else if (description != null) {
out.append(getDescription(description)).append(NL);
}
out.append(NL);
}
use of io.strimzi.crdgenerator.annotations.Description in project strimzi-kafka-operator by strimzi.
the class DocGenerator method appendDescription.
private void appendDescription(Class<?> cls) throws IOException {
DescriptionFile descriptionFile = cls.getAnnotation(DescriptionFile.class);
Description description = cls.getAnnotation(Description.class);
if (descriptionFile != null) {
String filename = "api/" + cls.getCanonicalName() + ".adoc";
File includeFile = new File(filename);
if (!includeFile.isFile()) {
throw new RuntimeException("Class " + cls.getCanonicalName() + " has @DescribeFile annotation, but file " + filename + " does not exist!");
}
out.append("xref:type-").append(cls.getSimpleName()).append("-schema-{context}[Full list of `").append(cls.getSimpleName()).append("` schema properties]").append(NL);
out.append(NL);
out.append("include::../" + filename + "[leveloffset=+1]").append(NL);
out.append(NL);
out.append("[id='type-").append(cls.getSimpleName()).append("-schema-{context}']").append(NL);
out.append("==== `").append(cls.getSimpleName()).append("` schema properties").append(NL);
out.append(NL);
} else if (description != null) {
out.append(getDescription(description)).append(NL);
}
out.append(NL);
}
Aggregations