Examples of JsonSchemaFactory


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

        try
        {
            InputStream inputStream = IOUtils.getResourceAsStream(schemaLocations, getClass());
            InputStreamReader reader = new InputStreamReader(inputStream);
            JsonNode jsonNode = JsonLoader.fromReader(reader);
            JsonSchemaFactory schemaFactory = JsonSchemaFactory.byDefault();
            jsonSchema = schemaFactory.getJsonSchema(jsonNode);
        }
        catch (Exception e)
        {
            Message msg = MessageFactory.createStaticMessage("Unable to load or parse JSON Schema file at: " + schemaLocations);
            throw new InitialisationException(msg, e, this);
View Full Code Here

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

                    .dereferencing(dereferencing == JsonSchemaDereferencing.CANONICAL
                                   ? Dereferencing.CANONICAL
                                   : Dereferencing.INLINE)
                    .setURITranslatorConfiguration(translatorConfigurationBuilder.freeze());

            JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
                    .setLoadingConfiguration(loadingConfigurationBuilder.freeze())
                    .freeze();

            try
            {
                return new JsonSchemaValidator(factory.getJsonSchema(schemaLocation));
            }
            catch (ProcessingException e)
            {
                throw new MuleRuntimeException(MessageFactory.createStaticMessage("Could not initialise JsonSchemaValidator"), e);
            }
View Full Code Here

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

        final JsonNode bad = Utils.loadResource("/fstab-bad.json");
        final JsonNode bad2 = Utils.loadResource("/fstab-bad2.json");

        final LoadingConfiguration cfg = LoadingConfiguration.newBuilder()
            .dereferencing(Dereferencing.INLINE).freeze();
        final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
            .setLoadingConfiguration(cfg).freeze();

        final JsonSchema schema = factory.getJsonSchema(fstabSchema);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);
View Full Code Here

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

    {
        final JsonNode good = Utils.loadResource("/fstab-good.json");
        final JsonNode bad = Utils.loadResource("/fstab-bad.json");
        final JsonNode bad2 = Utils.loadResource("/fstab-bad2.json");

        final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();

        final JsonSchema schema = factory.getJsonSchema(SCHEMA_URI);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);
View Full Code Here

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

        final JsonNode fstabSchema = Utils.loadResource("/fstab.json");
        final JsonNode good = Utils.loadResource("/fstab-good.json");
        final JsonNode bad = Utils.loadResource("/fstab-bad.json");
        final JsonNode bad2 = Utils.loadResource("/fstab-bad2.json");

        final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();

        final JsonSchema schema = factory.getJsonSchema(fstabSchema);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);
View Full Code Here

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

         */
        final ValidationConfiguration cfg = ValidationConfiguration.newBuilder()
            .setDefaultLibrary("http://my.site/myschema#", library)
            .setValidationMessages(bundle).freeze();

        final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
            .setValidationConfiguration(cfg).freeze();

        final JsonSchema schema = factory.getJsonSchema(customSchema);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);
View Full Code Here

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

         */
        final ValidationConfiguration cfg = ValidationConfiguration.newBuilder()
            .setDefaultLibrary("http://my.site/myschema#", library)
            .setValidationMessages(bundle).freeze();

        final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
            .setValidationConfiguration(cfg).freeze();

        final JsonSchema schema = factory.getJsonSchema(customSchema);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);
View Full Code Here

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

            = URITranslatorConfiguration.newBuilder()
            .addSchemaRedirect(FROM, TO).freeze();
        final LoadingConfiguration cfg = LoadingConfiguration.newBuilder()
            .setURITranslatorConfiguration(translatorCfg).freeze();

        final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
            .setLoadingConfiguration(cfg).freeze();

        final JsonSchema schema = factory.getJsonSchema(FROM);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);
View Full Code Here

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

            .freeze();
        final Library library = DraftV4Library.get().thaw()
            .addKeyword(keyword).freeze();
        final ValidationConfiguration cfg = ValidationConfiguration.newBuilder()
            .setDefaultLibrary("foo://bar#", library).freeze();
        final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
            .setValidationConfiguration(cfg).freeze();
        processor = factory.getProcessor();
        COUNT.set(0);
    }
View Full Code Here

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

    public void circularReferencingDuringValidationIsDetected()
        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,
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.