Examples of JSONSchema


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

        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);

        report = schema.validate(bad);
        System.out.println(report);

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

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

        if (!syntaxValidator.schemaIsValid(node)) {
            System.err.println("Schema is invalid! Aborting...");
            return SCHEMA_SYNTAX_ERROR;
        }

        final JsonSchema schema = factory.getJsonSchema(uri);

        RetCode ret = ALL_OK, retcode;

        for (final File file: files) {
            node = MAPPER.readTree(file);
View Full Code Here

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

            .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);

        report = schema.validate(bad);
        System.out.println(report);

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

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

            .addScheme("foobar", CustomDownloader.getInstance()).freeze();

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

        final JsonSchema schema
            = factory.getJsonSchema("foobar:/fstab.json#");

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);

        report = schema.validate(bad);
        System.out.println(report);

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

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

            .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);

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

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

        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);

        report = schema.validate(bad);
        System.out.println(report);

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

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

            .setURITranslatorConfiguration(translatorCfg).freeze();

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

        final JsonSchema schema = factory.getJsonSchema("fstab.json");

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);

        report = schema.validate(bad);
        System.out.println(report);

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

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

        builder.preloadSchema(uri, node);

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

        final JsonSchema schema
            = factory.getJsonSchema(URI_BASE + "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");

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);

        report = schema.validate(bad);
        System.out.println(report);

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

Examples of com.jetdrone.vertx.yoke.annotations.JsonSchema

        super(Router.class);
    }

    @Override
    public void process(Router router, Object instance, Class<?> clazz, Method method) {
        JsonSchema jsonSchema = Processor.getAnnotation(method, JsonSchema.class);

        if (jsonSchema == null) {
            return;
        }

        if (Processor.isCompatible(method, POST.class, YokeRequest.class, Handler.class)) {
            router.post(Processor.getAnnotation(method, POST.class).value(), wrap(JsonSchemaResolver.resolveSchema(jsonSchema.value())));
        }
        if (Processor.isCompatible(method, PUT.class, YokeRequest.class, Handler.class)) {
            router.put(Processor.getAnnotation(method, PUT.class).value(), wrap(JsonSchemaResolver.resolveSchema(jsonSchema.value())));
        }
        if (Processor.isCompatible(method, PATCH.class, YokeRequest.class, Handler.class)) {
            router.patch(Processor.getAnnotation(method, PATCH.class).value(), wrap(JsonSchemaResolver.resolveSchema(jsonSchema.value())));
        }
    }
View Full Code Here

Examples of org.codehaus.enunciate.json.JsonSchema

   * @throws java.lang.AssertionError if the parameter conditions are not met and assertions are enabled.
   */
  public static String schemaIdForPackage(final PackageDeclaration schemaPackage) {
    assert schemaPackage != null : "schemaPackage:null";

    final JsonSchema jsonSchema = schemaPackage.getAnnotation(JsonSchema.class);
    if (jsonSchema != null && jsonSchema.schemaId() != null) {
      return jsonSchema.schemaId();
    }
    return schemaPackage.getQualifiedName();
  }
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.