Skip to content

Commit

Permalink
fixes #933 update javadoc and a test case (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu authored Jan 27, 2024
1 parent 7f1ec11 commit b76c9f4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/networknt/schema/AbsoluteIri.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AbsoluteIri {
/**
* Constructs a new IRI given the value.
*
* @param value
* @param value String
*/
public AbsoluteIri(String value) {
this.value = value;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/networknt/schema/Annotations.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class Annotations {
* Gets the default annotation allow list.
*
* @param metaSchema the meta schema
* @return the default annotation allow set
*/
public static Set<String> getDefaultAnnotationAllowList(JsonMetaSchema metaSchema) {
boolean unevaluatedProperties = metaSchema.getKeywords().get("unevaluatedProperties") != null;
Expand All @@ -82,6 +83,7 @@ public static Set<String> getDefaultAnnotationAllowList(JsonMetaSchema metaSchem
* Gets the default annotation allow list predicate.
*
* @param metaSchema the meta schema
* @return the default annotation allow list predicate
*/
public static Predicate<String> getDefaultAnnotationAllowListPredicate(JsonMetaSchema metaSchema) {
boolean unevaluatedProperties = metaSchema.getKeywords().get("unevaluatedProperties") != null;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/networknt/schema/OutputFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ default void customize(ExecutionContext executionContext, ValidationContext vali
/**
* Formats the validation results.
*
* @param validationMessages
* @param executionContext
* @param validationMessages the validation messages
* @param executionContext the execution context
* @param validationContext the validation context
* @return the result
*/
T format(Set<ValidationMessage> validationMessages, ExecutionContext executionContext,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/networknt/schema/SchemaLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static class Fragment {
/**
* Parses a string representing a fragment.
*
* @param fragmentString
* @param fragmentString the fragment
* @return the path
*/
public static JsonNodePath of(String fragmentString) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public static VersionFlag detect(JsonNode jsonNode) {
* Optional} value, otherwise - returns the detected spec version wrapped into {@link Optional}.
*
* @param jsonNode JSON Node to read from
* @param throwIfUnsupported whether to throw an exception if the version is not supported
* @return Spec version if present, otherwise empty
*/
public static Optional<VersionFlag> detectOptionalVersion(JsonNode jsonNode, boolean throwIfUnsupported) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface InputStreamSource {
* Opens a new inputstream to the resource.
*
* @return a new inputstream
* @throws IOException
* @throws IOException if an I/O error occurs
*/
InputStream getInputStream() throws IOException;
}
7 changes: 7 additions & 0 deletions src/test/java/com/networknt/schema/Issue619Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ public void uriThatPointsToNodeThatDoesNotExistShouldFail_Ref() {

@Test
public void uriThatPointsToNodeThatDoesNotExistShouldFail_Uri() {
// This test failed before adding the 10-millisecond sleep. IllegalStateException is returned with recursive update error. This only happens on my faster desktop
// computer during 'maven clean install'. It passes within the IDE on the same computer. It passes on my slower laptop. It passes on Travis CI.
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
assertThrows(JsonSchemaException.class, () -> factory.getSchema(SchemaLocation.of("resource:schema/issue619.json#/definitions/node-that-does-not-exist")));
}
}

0 comments on commit b76c9f4

Please sign in to comment.