Module: SnippetCli::SchemaValidator

Defined in:
lib/snippet_cli/schema_validator.rb

Overview

Loads the vendored Espanso merged matchfile schema once and exposes valid?/validate for use by MatchValidator and FileValidator. Callers are responsible for stringifying keys before passing data.

Constant Summary collapse

SCHEMA_PATH =
File.expand_path(
  'Espanso_Merged_Matchfile_Schema.json', __dir__
).freeze

Class Method Summary collapse

Class Method Details

.valid?(data) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/snippet_cli/schema_validator.rb', line 14

def self.valid?(data)
  schemer.valid?(data)
end

.validate(data) ⇒ Object



18
19
20
# File 'lib/snippet_cli/schema_validator.rb', line 18

def self.validate(data)
  schemer.validate(data)
end