Package com.github.fge.jsonschema.library

Examples of com.github.fge.jsonschema.library.Library


    ValidationConfigurationBuilder()
    {
        libraries = Maps.newHashMap();
        JsonRef ref;
        Library library;
        for (final Map.Entry<SchemaVersion, Library> entry:
            DEFAULT_LIBRARIES.entrySet()) {
            ref = JsonRef.fromURI(entry.getKey().getLocation());
            library = entry.getValue();
            libraries.put(ref, library);
View Full Code Here


            .withValidatorClass(DivisorsKeywordValidator.class).freeze();

        /*
         * Build a library, based on the v4 library, with this new keyword
         */
        final Library library = DraftV4Library.get().thaw()
            .addKeyword(keyword).freeze();

        /*
         * Complement the validation message bundle with a dedicated message
         * for our keyword validator
View Full Code Here

            .withValidatorClass(DivisorsKeywordValidator.class).freeze();

        /*
         * Build a library, based on the v4 library, with this new keyword
         */
        final Library library = DraftV4Library.get().thaw()
            .addKeyword(keyword).freeze();

        /*
         * Complement the validation message bundle with a dedicated message
         * for our keyword validator
View Full Code Here

        final Keyword keyword = Keyword.newBuilder(K1)
            .withSyntaxChecker(mock(SyntaxChecker.class))
            .withIdentityDigester(NodeType.ARRAY, NodeType.values())
            .withValidatorClass(K1Validator.class)
            .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();
View Full Code Here

        final JsonNode bad = Utils.loadResource("/custom-fmt-bad.json");

        /*
         * Build a new library with our added format attribute
         */
        final Library library = DraftV4Library.get().thaw()
            .addFormatAttribute("uuid", UUIDFormatAttribute.getInstance())
            .freeze();

        /*
         * Build a new message bundle with our added error message
View Full Code Here

    @Test
    public void cannotOverrideExistingLibrary()
    {
        final String ref = "x://y.z/schema#";
        final Library library = Library.newBuilder().freeze();
        try {
            cfg.addLibrary(ref, library);
            cfg.addLibrary(ref, library);
            fail("No exception thrown!!");
        } catch (IllegalArgumentException e) {
View Full Code Here

    @Test
    public void defaultLibraryIsAccountedFor()
    {
        final String ref = "x://y.z/schema#";
        final Library library = Library.newBuilder().freeze();
        cfg.setDefaultLibrary(ref, library);
        assertSame(cfg.freeze().getDefaultLibrary(), library);
    }
View Full Code Here

        final JsonNode bad = Utils.loadResource("/custom-fmt-bad.json");

        /*
         * Build a new library with our added format attribute
         */
        final Library library = DraftV4Library.get().thaw()
            .addFormatAttribute("uuid", UUIDFormatAttribute.getInstance())
            .freeze();

        /*
         * Build a new message bundle with our added error message
View Full Code Here

    private Processor<SchemaContext, ValidatorList> buildProcessor()
    {
        final RefResolver resolver = new RefResolver(loader);

        final Map<JsonRef, Library> libraries = validationCfg.getLibraries();
        final Library defaultLibrary = validationCfg.getDefaultLibrary();
        final ValidationChain defaultChain
            = new ValidationChain(resolver, defaultLibrary, validationCfg);
        final ProcessorMap<JsonRef, SchemaContext, ValidatorList> map
            = new ProcessorMap<JsonRef, SchemaContext, ValidatorList>(FUNCTION);
        map.setDefaultProcessor(defaultChain);
View Full Code Here

TOP

Related Classes of com.github.fge.jsonschema.library.Library

Copyright © 2018 www.massapicom. 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.