Examples of JsonValidator


Examples of com.github.fge.jsonschema.main.JsonValidator

      throw new ServiceException("Schema valid? " + invalidSchema
          + " Data valid?" + invalidData);
    }
    final JsonNode schemaNode = ret.remove(ValidateResponse.SCHEMA);
    final JsonNode data = ret.remove(ValidateResponse.DATA);
    final JsonValidator validator = JsonValidators.withOptions(useV3, useId);
    final ProcessingReport report = validator.validateUnchecked(schemaNode,
        data);

    return report;
  }
View Full Code Here

Examples of com.github.fge.jsonschema.main.JsonValidator

        throws IOException, ProcessingException, JsonPointerException
    {
        final JsonNode schemaNode
            = JsonLoader.fromResource("/other/issue102.json");
        final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
        final JsonValidator validator = factory.getValidator();
        final MessageBundle bundle
            = MessageBundles.getBundle(JsonSchemaValidationBundle.class);

        try {
            validator.validate(schemaNode,
                JacksonUtils.nodeFactory().nullNode());
            fail("No exception thrown!");
        } catch (ProcessingException e) {
            final URI uri = URI.create("#/oneOf/1");
            final ProcessingMessage message = e.getProcessingMessage();
View Full Code Here

Examples of com.github.fge.jsonschema.main.JsonValidator

        throws IOException, ProcessingException
    {
        final JsonNode node = JsonLoader.fromResource("/other/issue112.json");
        final JsonNode schemaNode = node.get("schema");
        final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
        final JsonValidator validator = factory.getValidator();

        final JsonNode instance = node.get("instance");

        assertTrue(validator.validate(schemaNode, instance).isSuccess());
        assertTrue(true);
    }
View Full Code Here

Examples of com.mozilla.grouperfish.base.json.JsonValidator

@Test(groups="unit")
public class JsonValidatorTest {

    public void testInvalidDocument() throws IOException {
        assertFalse(new JsonValidator().isValid("Your mom is valit!!!!"));
        assertFalse(new JsonValidator().isValid("{{{}}"));
    }
View Full Code Here

Examples of com.mozilla.grouperfish.base.json.JsonValidator

        assertFalse(new JsonValidator().isValid("Your mom is valit!!!!"));
        assertFalse(new JsonValidator().isValid("{{{}}"));
    }

    public void testTooEmptyDocument() throws IOException {
        assertFalse(new JsonValidator().isValid(""));
    }
View Full Code Here

Examples of com.mozilla.grouperfish.base.json.JsonValidator

    public void testTooEmptyDocument() throws IOException {
        assertFalse(new JsonValidator().isValid(""));
    }

    public void testValidDocument() throws IOException {
        assertTrue(new JsonValidator().isValid("{}"));
        assertTrue(new JsonValidator().isValid("{\"a\": 1}"));
        assertTrue(new JsonValidator().isValid("{\"a\": 1, \"b\": 2}"));
    }
View Full Code Here

Examples of com.mozilla.grouperfish.base.json.JsonValidator

    public boolean allows(final Class<?> resourceType, final Access access) {
        return true;
    }

    public JsonValidator validator(final Class<?> resourceType) {
        return new JsonValidator();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.