Skip to content

Commit

Permalink
Resolve OpenAPI defaulting to a single server
Browse files Browse the repository at this point in the history
The OpenAPI specification dictates that that an empty or missing server
object should default to a server object of one item with a URL of "/"
[1].

This is reflected in 0.8 of openapi3_parser so the code here is adapted
to reflect that.

[1]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#openapi-object
  • Loading branch information
kevindew committed Feb 3, 2020
1 parent 4eeadaa commit 21e765c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<h1 id="<%= info.title.parameterize %>"><%= info.title %> v<%= info.version %></h1>
<%= info.description_html %>
<% unless servers.empty? %>
<%# OpenAPI files default to having a single server of URL "/" %>
<% if servers.length > 1 || servers[0].url != "/" %>
<h2 id="servers">Servers</h2>
<div id="server-list">
<% servers.each do |server| %>
Expand Down

0 comments on commit 21e765c

Please sign in to comment.