Module: Meta::JsonSchema::SchemaOptions
- Defined in:
- lib/meta/json_schema/support/schema_options.rb
Class Method Summary collapse
Class Method Details
.divide_to_param_and_render(options) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/meta/json_schema/support/schema_options.rb', line 14 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 |
.normalize(options) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/meta/json_schema/support/schema_options.rb', line 24 def normalize() # 只要 options 中设置为 nil 的选项没有明确的意义,则下行代码是永远有效的 = (.compact).merge(.compact) if [:using] if [:type].nil? [:type] = 'object' elsif [:type] != 'object' && [:type] != 'array' raise "当使用 using 时,type 必须声明为 object 或 array" end end end |