Loads JSON schema. The schema may contain remote references.

@param schema String containing the JSON schema to load
@return loaded {@link Schema}
@throws InvalidJsonSchemaException if the schema fails to load
493584
public Schema loadSchema(String schema) {
    try {
      JSONObject rawSchema = new JSONObject(new JSONTokener(schema));
      return SchemaLoader.load(rawSchema);
    } catch (JSONException | SchemaException e) {
      throw new InvalidJsonSchemaException(e);
    }
  }
791897
def load_schema(schema_path):
    '''
    
    '''
    with open(schema_path) as fd:
        schema = json.load(fd)
    schema_dir, schema_file = path.split(schema_path)
    return _load_schema(schema, schema_dir)
954917
public void doSchema(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
        setHeaders(rsp);
        rsp.setContentType("application/xml");
        StreamResult r = new StreamResult(rsp.getOutputStream());
        new SchemaGenerator(new ModelBuilder().get(bean.getClass())).generateSchema(r);
        r.getOutputStream().close();
    }
94836
def schema_from_json(self, file_or_path):
        
        if isinstance(file_or_path, io.IOBase):
            return self._schema_from_json_file_object(file_or_path)

        with open(file_or_path) as file_obj:
            return self._schema_from_json_file_object(file_obj)
115324
def load_schema(file_or_fp):
    
    fp = open(file_or_fp, 'r') if isinstance(file_or_fp, str) else file_or_fp
    obj = json.load(fp)
    schema = Schema(obj)
    return schema
1011341
SchemaProperty createDatabaseSchema(final App app, final AbstractSchemaNode schemaNode) throws FrameworkException {

		final PropertyMap getOrCreateProperties = new PropertyMap();
		final PropertyMap updateProperties      = new PropertyMap();

		getOrCreateProperties.put(SchemaProperty.name, getName());
		getOrCreateProperties.put(SchemaProperty.schemaNode, schemaNode);

		SchemaProperty property = app.nodeQuery(SchemaProperty.class).and(getOrCreateProperties).getFirst();
		if (property == null) {

			getOrCreateProperties.put(SchemaProperty.compound, isCompoundUnique());
			getOrCreateProperties.put(SchemaProperty.unique, isUnique());
			getOrCreateProperties.put(SchemaProperty.indexed, isIndexed());
			getOrCreateProperties.put(SchemaProperty.notNull, isRequired());
			getOrCreateProperties.put(SchemaProperty.readOnly, isReadOnly());
			getOrCreateProperties.put(SchemaProperty.format, getFormat());
			getOrCreateProperties.put(SchemaProperty.hint, getHint());
			getOrCreateProperties.put(SchemaProperty.category, getCategory());
			getOrCreateProperties.put(SchemaProperty.validators, validators.toArray(new String[0]));
			getOrCreateProperties.put(SchemaProperty.transformers, transformers.toArray(new String[0]));
			getOrCreateProperties.put(SchemaProperty.defaultValue, defaultValue);

			property = app.create(SchemaProperty.class, getOrCreateProperties);
		}

		if (parent != null) {

			final JsonSchema root = parent.getSchema();
			if (root != null) {

				if (SchemaService.DynamicSchemaRootURI.equals(root.getId())) {

					updateProperties.put(SchemaProperty.isPartOfBuiltInSchema, true);
				}
			}
		}

		// update properties
		property.setProperties(SecurityContext.getSuperUserInstance(), updateProperties);

		// return modified property
		return property;
	}
672401
public static Schema parseSchemaFromFile(Path filePath, FileSystem fs) throws IOException {
    Preconditions.checkArgument(fs.exists(filePath), filePath + " does not exist");

    try (FSDataInputStream in = fs.open(filePath)) {
      return new Schema.Parser().parse(in);
    }
  }
794307
public void setSchema(String schema)
   {
      if (schema.charAt(schema.length() - 1) != '.')
      {
         schema = schema + '.';
      }
      m_schema = schema;
   }
476431
public boolean matchJsonToSchema(JSONObject schema, JSONObject json) throws Exception {
        SchemaLoader.builder()
                 .useDefaults(true)
                 .schemaJson(schema)
                 .build()
                 .load()
                 .build()
                 .validate(json);
        return true;
    }
527334
private synchronized JsonSchema getInputPathJsonSchema() throws IOException {
        if (inputPathJsonSchema == null) {
            // No need to query Hadoop more than once as this shouldn't change mid-run,
            // thus, we can lazily initialize and cache the result.
            inputPathJsonSchema = HadoopUtils.getSchemaFromPath(getInputPath());
        }
        return inputPathJsonSchema;
    }
345233
def install_json_schema(self):
        """"""
        if self._install_json_schema is None and self.install_json_schema_file is not None:
            # remove old schema file
            if os.path.isfile('tcex_json_schema.json'):
                # this file is now part of tcex.
                os.remove('tcex_json_schema.json')

            if os.path.isfile(self.install_json_schema_file):
                with open(self.install_json_schema_file) as fh:
                    self._install_json_schema = json.load(fh)
        return self._install_json_schema
67383
@Given("^json (.+?) matches schema (.+?)$")
    public void jsonMatchesSchema(String json, String schema) throws Exception {
        JSONObject jsonschema = new JSONObject(schema);
        JSONObject jsondeploy = new JSONObject(json);

        commonspec.matchJsonToSchema(jsonschema, jsondeploy);
    }
5049
function requireValidSchema (schema) {
    // throw error on invalid schema object
    assert.equal(typeof schema, 'object', 'schema must be object')
    assert.equal(typeof schema.columns, 'object', 'schema columns must be object')
    assert.ok(Array.isArray(schema.indexes), 'schema indexes must be array')
    // require validated schema
    return schema
}
929377
function(sAnnotationJSONDoc) {
			var oAnnotation = null;
			try {
				oAnnotation = JSON.parse(sAnnotationJSONDoc);
			} catch (exception) {
				return;
			}

			var oMetadata;
			try {
				oMetadata = this._oModel.getServiceMetadata().dataServices;
			} catch (exception) {
				return;
			}

			// find "schema" entry in annotation document
			for ( var propName in oAnnotation) {
				if (!(this.oUI5ODataModelAnnotatableObject.objectName == propName)) {
					continue;
				}
				if (!(oAnnotation[propName] instanceof Array)) {
					continue;
				}
				this.mergeV2AnnotationLevel(oMetadata[this.oUI5ODataModelAnnotatableObject.objectName],
						oAnnotation[this.oUI5ODataModelAnnotatableObject.objectName], this.oUI5ODataModelAnnotatableObject);
				break;
			}

			return;
		}
659279
def from_json(cls, data, json_schema_class=None):
        
        schema = cls.json_schema if json_schema_class is None else json_schema_class()
        return schema.load(data)
419366
public HttpClientBuilder secureSchema(String schema) {
		if (sslHostConfig == null) {
			throw new IllegalStateException("ssl(String) must be called before this");
		}
		sslHostConfig.secureSchema = schema;
		return this;
	}
620938
def load_custom_schema(self, type, schema_file_path=None):
        
        try:
            if type in self.custom_data_schemas:
                return self.custom_data_schemas[type]

            if schema_file_path:
                _schema_file = schema_file_path
            else:
                _schema_file = os.path.join(self.base_path, 'schemas', "{0}_schema.json".format(type))

            custom_data_schema = json.load(open(_schema_file, 'r'))
            self.custom_data_schemas[type] = custom_data_schema

            return custom_data_schema
        except Exception as e:
            raise UnsupportedDataSchemaException(
                message="There is no schema defined for the '{0}' data type.".format(type))