class Object

Public Instance Methods

get_building_schema(strict) click to toggle source
# File lib/urbanopt/geojson/validate_geojson.rb, line 9
def get_building_schema(strict)
  result = nil
  File.open(File.dirname(__FILE__) + '/../schema/building_properties.json') do |f|
    result = JSON.parse(f.read)
  end
  if strict
    result['additionalProperties'] = false
  else
    result['additionalProperties'] = true
  end
  return result
end
get_district_system_schema(strict) click to toggle source
# File lib/urbanopt/geojson/validate_geojson.rb, line 35
def get_district_system_schema(strict)
  result = nil
  File.open(File.dirname(__FILE__) + '/../schema/district_system_properties.json') do |f|
    result = JSON.parse(f.read)
  end
  if strict
    result['additionalProperties'] = false
  else
    result['additionalProperties'] = true
  end
  return result
end
get_region_schema(strict) click to toggle source
# File lib/urbanopt/geojson/validate_geojson.rb, line 48
def get_region_schema(strict)
  result = nil
  File.open(File.dirname(__FILE__) + '/../schema/region_properties.json') do |f|
    result = JSON.parse(f.read)
  end
  if strict
    result['additionalProperties'] = false
  else
    result['additionalProperties'] = true
  end
  return result
end
get_taxlot_schema(strict) click to toggle source
# File lib/urbanopt/geojson/validate_geojson.rb, line 22
def get_taxlot_schema(strict)
  result = nil
  File.open(File.dirname(__FILE__) + '/../schema/taxlot_properties.json') do |f|
    result = JSON.parse(f.read)
  end
  if strict
    result['additionalProperties'] = false
  else
    result['additionalProperties'] = true
  end
  return result
end
validate(schema, data) click to toggle source
# File lib/urbanopt/geojson/validate_geojson.rb, line 61
def validate(schema, data)
  # validate
  errors = JSON::Validator.fully_validate(schema, data, errors_as_objects: true)
  return errors
end