File: json_schema.rb

package info (click to toggle)
ruby-brandur-json-schema 0.19.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 376 kB
  • sloc: ruby: 3,764; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 696 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require_relative "json_schema/attributes"
require_relative "json_schema/configuration"
require_relative "json_schema/document_store"
require_relative "json_schema/error"
require_relative "json_schema/parser"
require_relative "json_schema/reference_expander"
require_relative "json_schema/schema"
require_relative "json_schema/validator"

module JsonSchema
  def self.configure
    yield configuration
  end

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.parse(data)
    parser = Parser.new
    if schema = parser.parse(data)
      [schema, nil]
    else
      [nil, parser.errors]
    end
  end

  def self.parse!(data)
    Parser.new.parse!(data)
  end
end