diff --git a/packages/camel-catalog/kaoto-camel-catalog-maven-plugin/src/main/java/io/kaoto/camelcatalog/KaotoCamelCatalogMojo.java b/packages/camel-catalog/kaoto-camel-catalog-maven-plugin/src/main/java/io/kaoto/camelcatalog/KaotoCamelCatalogMojo.java index 8b13c9dd0..9b7e6b2a3 100644 --- a/packages/camel-catalog/kaoto-camel-catalog-maven-plugin/src/main/java/io/kaoto/camelcatalog/KaotoCamelCatalogMojo.java +++ b/packages/camel-catalog/kaoto-camel-catalog-maven-plugin/src/main/java/io/kaoto/camelcatalog/KaotoCamelCatalogMojo.java @@ -19,6 +19,7 @@ import java.io.File; import java.io.FileWriter; import java.io.OutputStreamWriter; +import java.io.StringWriter; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -111,7 +112,7 @@ public void execute() { var index = new Index(); var yamlDslSchemaProcessor = processCamelSchema(path, index); processK8sSchema(path, index); - processCatalog(yamlDslSchemaProcessor, index); + processCatalog(yamlDslSchemaProcessor, path, index); processCRDs(path, index); processKamelets(path, index); processAdditionalSchemas(path, index); @@ -213,12 +214,26 @@ private void processK8sSchema(Path inputDir, Index index) { } } - private void processCatalog(CamelYamlDslSchemaProcessor schemaProcessor, Index index) { + private void processCatalog(CamelYamlDslSchemaProcessor schemaProcessor, Path inputDir, Index index) { var catalogProcessor = new CamelCatalogProcessor(jsonMapper, schemaProcessor); try { var catalogMap = catalogProcessor.processCatalog(); catalogMap.forEach((name, catalog) -> { try { + // Adding Kamelet Configuration Schema to the Entities Catalog + if (name == "entities") { + var catalogNode = jsonMapper.readTree(catalog); + var schema = inputDir.resolve("schema").resolve("KameletConfiguration.json"); + ((ObjectNode) catalogNode).putObject("KameletConfiguration").putObject("propertiesSchema"); + ((ObjectNode) catalogNode.path("KameletConfiguration").path("propertiesSchema")) + .setAll((ObjectNode) jsonMapper.readTree(schema.toFile())); + + StringWriter writer = new StringWriter(); + var jsonGenerator = new JsonFactory().createGenerator(writer).useDefaultPrettyPrinter(); + jsonMapper.writeTree(jsonGenerator, catalogNode); + catalog = writer.toString(); + } + var outputFileName = String.format( "%s-%s-%s.json", CAMEL_CATALOG_AGGREGATE, name, Util.generateHash(catalog)); var output = outputDirectory.toPath().resolve(outputFileName);