13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/meta/json_schema/builders/schema_builder_tool.rb', line 13
def build(options = {}, &block)
options = SchemaOptions::BaseBuildOptions.check(options)
SchemaOptions.fix_type_option!(options)
if apply_staging_schema?(options)
StagingSchema.build_from_options(options)
elsif apply_array_schema?(options, block)
ArraySchemaBuilder.new(options, &block).to_schema
elsif apply_ref_schema?(options, block)
RefSchemaBuilder.new(options).to_schema
elsif apply_dynamic_schema?(options, block)
DynamicSchemaBuilder.new(options).to_schema
elsif apply_object_schema?(options, block)
ObjectSchemaBuilder.new(options, &block).to_schema
else
BaseSchema.new(options)
end
end
|