Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit c60c778

Browse files
committed
Fixes then functionality
1 parent 71f2043 commit c60c778

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ElseValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public class ElseValidator implements KeywordValidator {
2525
JsonSchema elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema);
2626
PathToSchemasMap pathToSchemas = new PathToSchemasMap();
2727
var elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg(), data.validationMetadata());
28-
pathToSchemas.update(elsePathToSchemas);
2928
// todo capture validation error and describe it as an else error?
29+
pathToSchemas.update(elsePathToSchemas);
3030
return pathToSchemas;
3131
}
3232
}

samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/schemas/validation/ThenValidator.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ public class ThenValidator implements KeywordValidator {
2424
}
2525
JsonSchema thenSchema = JsonSchemaFactory.getInstance(then);
2626
PathToSchemasMap pathToSchemas = new PathToSchemasMap();
27-
try {
28-
var thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg(), data.validationMetadata());
29-
pathToSchemas.update(ifPathToSchemas);
30-
pathToSchemas.update(thenPathToSchemas);
31-
} catch (ValidationException | InvalidTypeException ignored) {}
27+
var thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg(), data.validationMetadata());
28+
// todo capture validation error and describe it as an then error?
29+
pathToSchemas.update(ifPathToSchemas);
30+
pathToSchemas.update(thenPathToSchemas);
3231
return pathToSchemas;
3332
}
3433
}

src/main/resources/java/src/main/java/packagename/schemas/validation/ElseValidator.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public class ElseValidator implements KeywordValidator {
2525
JsonSchema elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema);
2626
PathToSchemasMap pathToSchemas = new PathToSchemasMap();
2727
var elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg(), data.validationMetadata());
28-
pathToSchemas.update(elsePathToSchemas);
2928
// todo capture validation error and describe it as an else error?
29+
pathToSchemas.update(elsePathToSchemas);
3030
return pathToSchemas;
3131
}
3232
}

src/main/resources/java/src/main/java/packagename/schemas/validation/ThenValidator.hbs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ public class ThenValidator implements KeywordValidator {
2424
}
2525
JsonSchema thenSchema = JsonSchemaFactory.getInstance(then);
2626
PathToSchemasMap pathToSchemas = new PathToSchemasMap();
27-
try {
28-
var thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg(), data.validationMetadata());
29-
pathToSchemas.update(ifPathToSchemas);
30-
pathToSchemas.update(thenPathToSchemas);
31-
} catch (ValidationException | InvalidTypeException ignored) {}
27+
var thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg(), data.validationMetadata());
28+
// todo capture validation error and describe it as an then error?
29+
pathToSchemas.update(ifPathToSchemas);
30+
pathToSchemas.update(thenPathToSchemas);
3231
return pathToSchemas;
3332
}
3433
}

0 commit comments

Comments
 (0)