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

#1 fix issue about reading correct schema with allOff, create eclips… #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions json-core/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
/target/
53 changes: 25 additions & 28 deletions json-core/src/main/java/io/apptik/json/AbstractValidator.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
package io.apptik.json;


public abstract class AbstractValidator implements Validator {

@Override
public boolean isValid(JsonElement el) {
//System.out.println("Started simple JsonSchema Validation using: " + this.getTitle());
return doValidate(el, null);
}

@Override
public String validate(JsonElement el) {
//System.out.println("Started JsonSchema Validation using: " + this.getTitle());
StringBuilder sb = new StringBuilder();
doValidate(el, sb);
return sb.toString();
}

@Override
public boolean validate(JsonElement el, StringBuilder sb) {
//System.out.println("Started full JsonSchema Validation using: " + this.getTitle());
return doValidate(el, sb);
}

protected abstract boolean doValidate(JsonElement el, StringBuilder sb);

@Override
public String getTitle() {
return getClass().getCanonicalName();
}
protected abstract boolean doValidate(JsonElement el, StringBuilder sb);

public String getTitle() {
return getClass().getCanonicalName();
}

public boolean isValid(final JsonElement el) {
// System.out.println("Started simple JsonSchema Validation using: " +
// this.getTitle());
return doValidate(el, null);
}

public String validate(final JsonElement el) {
// System.out.println("Started JsonSchema Validation using: " +
// this.getTitle());
StringBuilder sb = new StringBuilder();
doValidate(el, sb);
return sb.toString();
}

public boolean validate(final JsonElement el, final StringBuilder sb) {
// System.out.println("Started full JsonSchema Validation using: " +
// this.getTitle());
return doValidate(el, sb);
}
}

Loading