Skip to content

Commit

Permalink
Fix(catalog): Expressions does not show input expression field as req…
Browse files Browse the repository at this point in the history
…uired
  • Loading branch information
shivamG640 committed Oct 9, 2024
1 parent f95f50e commit 8d6190b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public String getLanguageCatalog() throws Exception {
catalogMap.put(modelCatalog.getName(), camelCatalog.eipModel(name));
}
for (var entry : languageSchemaMap.entrySet()) {
List<String> required = new ArrayList<>();
var languageName = entry.getKey();
var languageSchema = entry.getValue();
EipModel eipModel = catalogMap.get(languageName);
Expand All @@ -267,6 +268,16 @@ public String getLanguageCatalog() throws Exception {
var json = JsonMapper.asJsonObject(languageCatalog).toJson();
var catalogTree = (ObjectNode) jsonMapper.readTree(json);
catalogTree.set("propertiesSchema", languageSchema);
// setting required property to the language schema
var camelYamlDslProperties = languageSchema.withObject("/properties").properties().stream()
.map(Map.Entry::getKey).toList();
for (var propertyName : camelYamlDslProperties) {
var catalogPropertySchema = catalogTree.withObject("/properties").withObject("/" + propertyName);
if (catalogPropertySchema.has("required") && catalogPropertySchema.get("required").asBoolean()) {
required.add(propertyName);
}
}
catalogTree.withObject("/propertiesSchema").set("required", jsonMapper.valueToTree(required));
answer.set(languageName, catalogTree);
}
StringWriter writer = new StringWriter();
Expand Down

0 comments on commit 8d6190b

Please sign in to comment.