16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/fitting/doc/combination_optional.rb', line 16
def report(res, index)
@index_before = index
@res_before = [] + res
@index_medium = index
@res_medium = [] + res
combinations = @step_key.split('.')
elements = YAML.dump(@source_json_schema).split("\n")[1..-1]
res_index = 0
elements.each_with_index do |element, i|
if element.include?(combinations[-1])
res_index = i
break
end
end
res[res_index + index] = @step_cover_size
res[res_index + index + 1] = @step_cover_size
if @source_json_schema["properties"][combinations[-1]] && @source_json_schema["properties"][combinations[-1]].class == Hash && @source_json_schema["properties"][combinations[-1]]["type"] == "array"
res[res_index + index + 2] = @step_cover_size
res[res_index + index + 3] = @step_cover_size
res[res_index + index + 4] = @step_cover_size
schema = @source_json_schema["properties"][combinations[-1]]['items']
mark_required(res_index + index + 4, res, schema)
elsif @source_json_schema["properties"][combinations[-1]] && @source_json_schema["properties"][combinations[-1]].class == Hash && @source_json_schema["properties"][combinations[-1]]["type"] == "object"
schema = @source_json_schema["properties"][combinations[-1]]
res[res_index + index + 2] = @step_cover_size
mark_required(res_index + index + 2, res, schema)
end
@index_after = res_index + index + 4
@res_after = [] + res
[res, index]
end
|