lib/meta/json_schema/support/schema_options.rb in meta-api-0.0.3 vs lib/meta/json_schema/support/schema_options.rb in meta-api-0.0.4

- old
+ new

@@ -3,17 +3,10 @@ require_relative '../../utils/kwargs/builder' module Meta module JsonSchema module SchemaOptions - OPTIONS_CHECKER = Utils::KeywordArgs::Builder.build do - key :type, :items, :description, :presenter, :value, :format, :required, :default, :validate, :allowable, :properties, :convert - key :using, normalizer: ->(value) { value.is_a?(Proc) ? { resolve: value } : value } - key :param - key :render - end - @default_options = { scope: [], required: false } @allowable_options = ( @@ -32,11 +25,9 @@ render_opts = merge_common_to_stage(common_opts, render_opts) [param_opts, render_opts, common_opts] end def normalize(options) - options = OPTIONS_CHECKER.check(options) - # 只要 options 中设置为 nil 的选项没有明确的意义,则下行代码是永远有效的 options = (@default_options.compact).merge(options.compact) if options[:using] if options[:type].nil? options[:type] = 'object'