Skip to content

Commit

Permalink
EES-5494 Fix examples unable to render when no type provided
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsim committed Sep 6, 2024
1 parent 358507d commit b5690f4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/api_reference_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def schema_example(schema_data, references = [])
schema_example(schema)
when "array"
if schema.items && schema.items != schema_data
unless schema.items.one_of.nil?
if schema.items.one_of
schema.items.one_of
.reject { |item| references.include?(item) }
.map { |item| schema_example(item, references + [item]) }
Expand All @@ -40,6 +40,13 @@ def schema_example(schema_data, references = [])
else
[]
end
when nil
# Schema may be using `allOf` to inherit properties
if schema.all_of
schema_example(schema)
else
{}
end
else
Utils::primitive_schema_example(schema)
end
Expand Down Expand Up @@ -109,7 +116,7 @@ def render_schema_type(schema)
"array (#{render_schema_type(items)})"
end
else
schema.type || ""
schema.type || "any"
end
end

Expand Down

0 comments on commit b5690f4

Please sign in to comment.