inline documentation fixed

This commit is contained in:
rdavidek 2026-02-19 14:13:00 +01:00
parent 66b46259b2
commit a118cf6c0b

View File

@ -58,7 +58,7 @@ public class ExportApisToWso2FromV32 extends AbstractProcess {
ArtifactSearchResults apis = client.searchArtifacts(config.getApicurio().getDefaultApiGroup(), null, null, ArtifactSearchResults apis = client.searchArtifacts(config.getApicurio().getDefaultApiGroup(), null, null,
null, null, SortBy.name, SortOrder.asc, null, 9999); null, null, SortBy.name, SortOrder.asc, null, 9999);
List<SearchedArtifact> sortedArtifacts = apis.getArtifacts().stream() List<SearchedArtifact> sortedArtifacts = apis.getArtifacts().stream()
.sorted(Comparator.comparing(SearchedArtifact::getId)) .sorted(Comparator.comparing(SearchedArtifact::getId))
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -66,24 +66,25 @@ public class ExportApisToWso2FromV32 extends AbstractProcess {
log.info("Found {} APIs", sortedArtifacts.size()); log.info("Found {} APIs", sortedArtifacts.size());
int maxThreads = config.getMaxThreads(); int maxThreads = config.getMaxThreads();
//ExecutorService executor = Executors.newFixedThreadPool(maxThreads); // ExecutorService executor = Executors.newFixedThreadPool(maxThreads);
int skipCount = 9; // AutosweepIntegrationPPE/AutosweepIntegrationPPE/v1
int skipCount = 23;
for (SearchedArtifact api : sortedArtifacts) { for (SearchedArtifact api : sortedArtifacts) {
final int index = apiCounter.getAndIncrement(); final int index = apiCounter.getAndIncrement();
if (index <= skipCount) { if (index <= skipCount) {
log.info("Skipping API {} of {}: {}", index, apis.getCount(), api.getName()); log.info("Skipping API {} of {}: {}", index, apis.getCount(), api.getName());
continue; continue;
} }
//executor.submit(() -> processApi(api, token, index, apis.getCount())); // executor.submit(() -> processApi(api, token, index, apis.getCount()));
processApi(api, token, index, apis.getCount()); processApi(api, token, index, apis.getCount());
} }
// executor.shutdown(); // executor.shutdown();
// if (!executor.awaitTermination(10, TimeUnit.MINUTES)) { // if (!executor.awaitTermination(10, TimeUnit.MINUTES)) {
// log.warn("Timeout waiting for API import tasks to finish"); // log.warn("Timeout waiting for API import tasks to finish");
// } // }
log.info("Finished processing APIs."); log.info("Finished processing APIs.");
} catch (Exception e) { } catch (Exception e) {
log.error("Error while exporting APIs.", e); log.error("Error while exporting APIs.", e);
@ -186,10 +187,18 @@ public class ExportApisToWso2FromV32 extends AbstractProcess {
} else if (FileType.DOCUMENTATION.toString().equals(amd.getGroupId())) { } else if (FileType.DOCUMENTATION.toString().equals(amd.getGroupId())) {
subDir = "Docs/"; subDir = "Docs/";
if (content != null && content.length > 0) { if (content != null && content.length > 0) {
List<Documents32> docs = mapperYaml.readValue(content, new TypeReference<List<Documents32>>() { if (r.getName().endsWith(".yaml") || r.getName().endsWith(".yml")) {
}); List<Documents32> docs = mapperYaml.readValue(content,
for (Documents32 doc : docs) { new TypeReference<List<Documents32>>() {
convertAndAddDocument(zos, baseDir + subDir, doc, ref); });
for (Documents32 doc : docs) {
convertAndAddDocument(zos, baseDir + subDir, doc, ref);
}
} else {
String fileName = baseDir + subDir + r.getName() + "/" + r.getName();
zos.putNextEntry(new ZipEntry(fileName));
zos.write(content);
zos.closeEntry();
} }
} }
appendFile = false; appendFile = false;
@ -221,7 +230,8 @@ public class ExportApisToWso2FromV32 extends AbstractProcess {
} }
} }
private void convertAndAddDocument(ZipOutputStream zos, String subDir, Documents32 doc, List<ArtifactReference> ref) throws Exception { private void convertAndAddDocument(ZipOutputStream zos, String subDir, Documents32 doc, List<ArtifactReference> ref)
throws Exception {
Documents45 doc45 = new Documents45(); Documents45 doc45 = new Documents45();
Documents45.Data doc45Data = new Documents45.Data(); Documents45.Data doc45Data = new Documents45.Data();