lib/fdoc/presenters/schema_presenter.rb in fdoc-0.2.2 vs lib/fdoc/presenters/schema_presenter.rb in fdoc-0.2.3
- old
+ new
@@ -35,13 +35,13 @@
html << '<div class="schema">'
html << render_markdown(@schema["description"])
html << '<ul>'
begin
+ html << '<li>Required: %s</li>' % required? if nested?
html << '<li>Type: %s</li>' % type if type
html << '<li>Format: %s</li>' % format if format
- html << '<li>Required: %s</li>' % required? if nested?
html << '<li>Example: %s</li>' % example if example
html << enum_html
(@schema.keys - FORMATTED_KEYS).each do |key|
html << '<li>%s: %s</li>' % [ key, @schema[key] ]
@@ -59,10 +59,18 @@
end
def type
t = @schema["type"]
if t.kind_of? Array
- t.join(", ")
+ types = t.map do |type|
+ if type.kind_of? Hash
+ '<li>%s</li>' % self.class.new(type, options).to_html
+ else
+ '<li>%s</li>' % type
+ end
+ end.join('')
+
+ '<ul>%s</ul>' % types
elsif t != "object"
t
end
end