Sha256: 5e3d2e95f142da288330c5d1fcf11798a7cd056dd6a160ff216598d9822ac74f
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
require "pathname" require "json_schemer" module Eddy module Schema # Check a Segment definition file against Eddy's JSON schema. # # @param path [String] Path to the file. # @return [Boolean] def self.valid_segment_data?(path) schema = Pathname.new(File.join(Eddy::Util.data_dir, "schema", "segment_summary.json")) schemer = JSONSchemer.schema(schema, ref_resolver: "net/http") data = Eddy::Util.read_json_or_yaml(path, symbolize: false) schemer.valid?(data) end # Check a Loop definition file against Eddy's JSON schema. # # @param path [String] Path to the file. # @return [Boolean] def self.valid_loop_data?(path) schema = Pathname.new(File.join(Eddy::Util.data_dir, "schema", "loop_summary.json")) schemer = JSONSchemer.schema(schema, ref_resolver: "net/http") data = Eddy::Util.read_json_or_yaml(path, symbolize: false) schemer.valid?(data) end # Check a Transaction Set definition file against Eddy's JSON schema. # # @param path [String] Path to the file. # @return [Boolean] def self.valid_transaction_set_data?(path) schema = Pathname.new(File.join(Eddy::Util.data_dir, "schema", "transaction_set_summary.json")) schemer = JSONSchemer.schema(schema, ref_resolver: "net/http") data = Eddy::Util.read_json_or_yaml(path, symbolize: false) schemer.valid?(data) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
eddy-0.5.1 | lib/eddy/schema/validate.rb |
eddy-0.5.0 | lib/eddy/schema/validate.rb |
eddy-0.4.0 | lib/eddy/schema/validate.rb |
eddy-0.3.0 | lib/eddy/schema/validate.rb |