Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Catalog): Add CamelCatalogSchemaEnhancer #1960

Conversation

lordrip
Copy link
Member

@lordrip lordrip commented Jan 28, 2025

part of: #1939

Comment on lines 49 to 89
definitions.fields().forEachRemaining(entry -> {
String javaType = entry.getKey();
ObjectNode node = (ObjectNode) entry.getValue();

camelCatalog.findModelNames().stream().findFirst().ifPresent(modelName -> {
var model = camelCatalog.eipModel(modelName);
if (model == null) {
return;
}

if (model.getJavaType().equals(javaType)) {
fillRequiredPropertiesIfNeeded(modelName, node);
}
});
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivamG640, this code goes from org.apache.camel.model.language.ConstantExpression to the constant model from the Camel Catalog, I think you're gonna need something like this for the sorting, if that's the case, I think we can extract the query part and create a method that receives a lambda where you can place the sorting code and I can place this required code.

@lordrip lordrip force-pushed the feat/add-required-properties-from-catalog branch 4 times, most recently from 9f225b9 to 18a2539 Compare January 28, 2025 18:26
@lordrip lordrip force-pushed the feat/add-required-properties-from-catalog branch 2 times, most recently from 606271f to ad3b054 Compare January 29, 2025 09:38
@lordrip lordrip force-pushed the feat/add-required-properties-from-catalog branch from ad3b054 to 29a7f8e Compare January 29, 2025 09:43
* @param modelNode the JSON schema node of the model
*/
void sortPropertiesAccordingToCatalog(EipModel model, ObjectNode modelNode) {
// TODO: Sort properties according to the Camel catalog
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivamG640 Here we need to place your Sorting code, and it will be sorting both Schemas and definitions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lordrip

@lordrip lordrip marked this pull request as ready for review January 29, 2025 10:12
@lordrip lordrip merged commit 8c027e5 into KaotoIO:feat/form-with-anyof-support Jan 29, 2025
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants