Module: Meta::JsonSchema::SchemaOptions
- Defined in:
- lib/meta/json_schema/support/schema_options.rb
Defined Under Namespace
Modules: UserOptions
Constant Summary collapse
- BaseBuildOptions =
Utils::Kwargs::Builder.build do key :type, :items, :description, :presenter, :value, :default, :properties, :convert key :validate, :required, :format key :enum, alias_names: [:allowable] key :ref, alias_names: [:using], normalizer: ->(entity) { entity } key :dynamic_ref, alias_names: [:dynamic_using], normalizer: ->(value) { value.is_a?(Proc) ? { resolve: value } : value } key :before, :after key :if end
Class Method Summary collapse
Class Method Details
.divide_to_param_and_render(options) ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/meta/json_schema/support/schema_options.rb', line 66 def divide_to_param_and_render() common_opts = ( || {}).dup param_opts = common_opts.delete(:param) render_opts = common_opts.delete(:render) param_opts = merge_common_to_stage(common_opts, param_opts) render_opts = merge_common_to_stage(common_opts, render_opts) [param_opts, render_opts, common_opts] end |
.fix_type_option!(options) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/meta/json_schema/support/schema_options.rb', line 51 def fix_type_option!() if [:type].is_a?(Class) # 修复 type 为自定义类的情形 the_class = [:type] # 修复 param 选项 [:param] = {} if [:param].nil? make_after_cast_to_class([:param], the_class) if [:param] # 修复 render 选项 [:render] = {} if [:render].nil? make_before_match_to_class([:render], the_class) if [:render] # 最终确保 type 为 object .merge!(type: 'object') end end |