Skip to content

Commit dcb1cba

Browse files
authored
Provide a next step when validation fails (#6475)
1 parent f5ae0d7 commit dcb1cba

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

rewrite-core/src/main/java/org/openrewrite/marketplace/RecipeMarketplaceCompletenessValidator.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,18 @@ public Validated<RecipeMarketplace> validate(RecipeMarketplace csv, Environment
5555
// Find recipes in CSV that don't exist in the environment (phantom recipes)
5656
for (String csvRecipeName : csvRecipeNames) {
5757
if (!jarRecipeNames.contains(csvRecipeName)) {
58-
validation = validation.and(Validated.invalid(csvRecipeName, csvRecipeName, "Recipe listed in CSV must exist in the environment"));
58+
validation = validation.and(Validated.invalid(csvRecipeName, csvRecipeName,
59+
"Recipe listed in CSV must exist in the environment; " +
60+
"remove this entry from `recipes.csv` or add the recipe to the environment."));
5961
}
6062
}
6163

6264
// Find recipes in the environment that aren't in CSV (missing recipes)
6365
for (String envRecipeName : jarRecipeNames) {
6466
if (!csvRecipeNames.contains(envRecipeName)) {
65-
validation = validation.and(Validated.invalid(envRecipeName, envRecipeName, "Recipe exists in environment but is not listed in CSV"));
67+
validation = validation.and(Validated.invalid(envRecipeName, envRecipeName,
68+
"Recipe exists in environment but is not listed in CSV; " +
69+
"run `./gradlew recipeCsvGenerate` to update `recipes.csv`."));
6670
}
6771
}
6872

0 commit comments

Comments
 (0)