Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2013, Francis Galiegue <fgaliegue@gmail.com>
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the Lesser GNU General Public License as
   * published by the Free Software Foundation, either version 3 of the
   * License, or (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * Lesser GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.github.fge.jsonschema.metaschema;
 
 
 import java.net.URI;
 import java.util.Map;

Enumeration of builtin metaschemas

This enum centralizes all metaschemas defined by the different JSON Schema specifications (draft v3 and draft v4).

 
 public enum BuiltinSchemas
 {
    
Draft v3 core schema
 
     DRAFTV3_CORE("http://json-schema.org/draft-03/schema#""/draftv3/schema",
         "draft v3 core schema", KeywordRegistries.draftV3Core()),
    
Draft v4 core schema
 
     DRAFTV4_CORE("http://json-schema.org/draft-04/schema#""/draftv4/schema",
         "draft v4 core schema", KeywordRegistries.draftV4Core()),
    
Draft v3 LDO (Link Description Object) schema
 
     DRAFTV3_LINKS("http://json-schema.org/draft-03/links#""/draftv3/links",
         "draft v3 link description object (LDO) schema",
         KeywordRegistries.draftV3HyperSchema()),
    
Draft v3 hyper-schema
 
     DRAFTV3_HYPERSCHEMA("http://json-schema.org/draft-03/hyper-schema#",
         "/draftv3/hyper-schema""draft v3 hyper schema",
         KeywordRegistries.draftV3HyperSchema());
 
     private final JsonRef locator;
     private final JsonNode rawSchema;
     private final String desc;
 
     // The following are package-visible to allow direct access by MetaSchema
     final Map<StringSyntaxCheckercheckers;
     final Map<StringClass<? extends KeywordValidator>> validators;
 
     BuiltinSchemas(final String urifinal String resourcefinal String desc,
         final KeywordRegistry registry)
     {
         try {
              = JsonRef.fromString(uri);
              = JsonLoader.fromResource(resource);
         } catch (JsonSchemaException e) {
             throw new ExceptionInInitializerError(e);
         } catch (IOException e) {
             throw new ExceptionInInitializerError(e);
         }
 
         this. = desc;
         // All .get() methods return immutable map instances, but that is
         // no less ugly
          = registry.getSyntaxCheckers();
          = registry.getValidators();
          = registry.getFormatAttributes();
     }

    
Return the default metaschema (currently DRAFTV3_HYPERSCHEMA

Returns:
a BuiltinSchemas instance
 
     public static BuiltinSchemas byDefault()
     {
         return ;
    }

    
Get the locator for this schema

Returns:
the locator as a URI
    public URI getURI()
    {
        return .toURI();
    }

    
Get the raw JSON document for that schema

    public JsonNode getRawSchema()
    {
        return ;
    }
    @Override
    public String toString()
    {
        return  + " (" +  + ')';
    }
New to GrepCode? Check out our FAQ X