Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2012, 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.schema;
Schema addressing mode

JSON Schema defines the id keyword for schema identification purposes. This keyword can be used both at the schema root and in subschemas. For instance:

     {
         "id": "some://where/schema.json",
         "sub": {
             "id": "other.json"
         }
     }
 

What can happen here is that an implementation walks the schema and determines that the URI of the root schema is some://where/schema.json , which is pretty much normal. It can also see the other id in subschema /sub and resolve the value of this subschema against the root URI: this gives some://where/other.json. This is called by this implementation INLINE addressing mode.

By default, for security reasons, the addressing mode is .

public enum AddressingMode
    CANONICAL
        {
            @Override
            public SchemaContext forSchema(final URI uri,
                final JsonNode schema)
            {
                return new CanonicalSchemaContext(urischema);
            }
        },
    INLINE
        {
            @Override
            public SchemaContext forSchema(final URI uri,
                final JsonNode schema)
            {
                return new InlineSchemaContext(schema);
            }
        };
    private static final URI EMPTY = URI.create("#");
    public abstract SchemaContext forSchema(final URI uri,
        final JsonNode schema);
    public final SchemaContext forSchema(final JsonNode schema)
    {
        return forSchema(schema);
    }
New to GrepCode? Check out our FAQ X