lib/nxt_schema.rb in nxt_schema-0.1.2 vs lib/nxt_schema.rb in nxt_schema-1.0.0
- old
+ new
@@ -1,68 +1,75 @@
-require "nxt_schema/version"
-require "active_support/all"
+require 'nxt_schema/version'
+require 'active_support/all'
require 'dry-types'
require 'nxt_registry'
+require 'nxt_init'
require 'yaml'
-require "nxt_schema/types"
-require "nxt_schema/undefined"
-require "nxt_schema/registry"
-require "nxt_schema/callable"
-require "nxt_schema/callable_or_value"
-require "nxt_schema/validators/registry"
-require "nxt_schema/node/validate_with_proxy"
+require_relative 'nxt_schema/types'
+require_relative 'nxt_schema/callable'
+require_relative 'nxt_schema/application'
+require_relative 'nxt_schema/missing_input'
+require_relative 'nxt_schema/error'
+require_relative 'nxt_schema/errors/invalid'
+require_relative 'nxt_schema/errors/invalid_options'
-require "nxt_schema/errors"
-require "nxt_schema/errors/error"
-require "nxt_schema/errors/schema_not_applied_error"
-require "nxt_schema/errors/invalid_options_error"
+require_relative 'nxt_schema/validators/registry'
+require_relative 'nxt_schema/validators/validate_with_proxy'
+require_relative 'nxt_schema/validators/error_messages'
+require_relative 'nxt_schema/validators/validator'
+require_relative 'nxt_schema/validators/attribute'
+require_relative 'nxt_schema/validators/equal_to'
+require_relative 'nxt_schema/validators/optional_node'
+require_relative 'nxt_schema/validators/greater_than'
+require_relative 'nxt_schema/validators/greater_than_or_equal'
+require_relative 'nxt_schema/validators/less_than'
+require_relative 'nxt_schema/validators/less_than_or_equal'
+require_relative 'nxt_schema/validators/pattern'
+require_relative 'nxt_schema/validators/included_in'
+require_relative 'nxt_schema/validators/includes'
+require_relative 'nxt_schema/validators/excluded_in'
+require_relative 'nxt_schema/validators/excludes'
+require_relative 'nxt_schema/validators/query'
-require "nxt_schema/error_messages"
-require "nxt_schema/validators/validator"
-require "nxt_schema/validators/attribute"
-require "nxt_schema/validators/equality"
-require "nxt_schema/validators/optional_node"
-require "nxt_schema/validators/greater_than"
-require "nxt_schema/validators/greater_than_or_equal"
-require "nxt_schema/validators/less_than"
-require "nxt_schema/validators/less_than_or_equal"
-require "nxt_schema/validators/pattern"
-require "nxt_schema/validators/included"
-require "nxt_schema/validators/includes"
-require "nxt_schema/validators/excluded"
-require "nxt_schema/validators/excludes"
-require "nxt_schema/validators/query"
+require_relative 'nxt_schema/node/on_evaluator'
+require_relative 'nxt_schema/node/maybe_evaluator'
+require_relative 'nxt_schema/node/type_resolver'
+require_relative 'nxt_schema/node/type_system_resolver'
+require_relative 'nxt_schema/node/base'
+require_relative 'nxt_schema/node/sub_nodes'
+require_relative 'nxt_schema/node/has_sub_nodes'
+require_relative 'nxt_schema/node/any_of'
+require_relative 'nxt_schema/node/collection'
+require_relative 'nxt_schema/node/schema'
+require_relative 'nxt_schema/node/leaf'
-require "nxt_schema/node"
-require "nxt_schema/node/type_resolver"
-require "nxt_schema/node/maybe_evaluator"
-require "nxt_schema/node/default_value_evaluator"
-require "nxt_schema/node/base"
-require "nxt_schema/node/error"
-require "nxt_schema/node/has_subnodes"
-require "nxt_schema/node/template_store"
-require "nxt_schema/node/schema"
-require "nxt_schema/node/collection"
-require "nxt_schema/node/leaf"
-require "nxt_schema/dsl"
+require_relative 'nxt_schema/application/errors/schema_error'
+require_relative 'nxt_schema/application/errors/validation_error'
+require_relative 'nxt_schema/application/error_store'
+require_relative 'nxt_schema/application/base'
+require_relative 'nxt_schema/application/any_of'
+require_relative 'nxt_schema/application/leaf'
+require_relative 'nxt_schema/application/collection'
+require_relative 'nxt_schema/application/schema'
+require_relative 'nxt_schema/dsl'
module NxtSchema
+ extend Dsl
+
+ def register_error_messages(*paths)
+ Validators::ErrorMessages.load(paths)
+ end
+
def register_validator(validator, *keys)
- keys.each do |key|
- NxtSchema::Validators::Registry::VALIDATORS.register(key, validator)
- end
+ keys.each { |key| NxtSchema::Validators::REGISTRY.register(key, validator) }
end
def register_type(key, type)
NxtSchema::Types.const_set(key.to_s, type)
end
- def register_error_messages(*paths)
- ErrorMessages.load(paths)
- end
-
# Load default messages
- ErrorMessages.load
+ Validators::ErrorMessages.load
- module_function :register_validator, :register_type, :register_error_messages
+ module_function :register_error_messages, :register_validator, :register_type
end