100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/govuk_tech_docs/api_reference/api_reference_renderer.rb', line 100
def schemas_from_schema(schema)
schemas = []
properties = []
schema.properties.each do |property|
properties.push property[1]
end
if schema.type == 'array'
properties.push schema.items
end
all_of = schema["allOf"]
if !all_of.blank?
all_of.each do |schema_nested|
schema_nested.properties.each do |property|
properties.push property[1]
end
end
end
properties.each do |property|
if property.node_context.referenced_by.to_s.include?('#/components/schemas') &&
!property.node_context.source_location.to_s.include?('/properties/')
schema_name = get_schema_name(property.node_context.source_location.to_s)
end
if !schema_name.nil?
schemas.push schema_name
end
schemas.concat(schemas_from_schema(property))
end
schemas
end
|