Skip to content

Commit

Permalink
Merge pull request swagger-api#739 from swagger-api/develop
Browse files Browse the repository at this point in the history
Standardized default value across both spec versions
  • Loading branch information
fehguy committed Nov 22, 2014
2 parents 932f4e3 + 091eca5 commit c7fc5d1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions dist/swagger-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1575,8 +1575,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
if (this.model.swaggerVersion === "2.0") {
if ("validatorUrl" in opts.swaggerOptions) {
return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
} else if (this.model.url.match(/https?:\/\/localhost/)) {
return this.model.validatorUrl = this.model.url;
} else if (this.model.url.indexOf("localhost") > 0) {
return this.model.validatorUrl = null;
} else {
return this.model.validatorUrl = "http://online.swagger.io/validator";
}
Expand Down
2 changes: 1 addition & 1 deletion dist/swagger-ui.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/coffeescript/view/MainView.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class MainView extends Backbone.View
if "validatorUrl" of opts.swaggerOptions
# Validator URL specified explicitly
@model.validatorUrl = opts.swaggerOptions.validatorUrl
else if @model.url.match(/https?:\/\/localhost/)
else if @model.url.indexOf("localhost") > 0
# Localhost override
@model.validatorUrl = @model.url
@model.validatorUrl = null
else
# Default validator
@model.validatorUrl = "http://online.swagger.io/validator"
Expand Down
2 changes: 1 addition & 1 deletion src/main/template/param_list.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<select {{#isArray this}} multiple='multiple'{{/isArray}} class='parameter' name='{{name}}'>
{{#if required}}
{{else}}
{{#if defaultValue}}
{{#if default}}
{{else}}
{{#isArray this}}
{{else}}
Expand Down
6 changes: 3 additions & 3 deletions src/main/template/param_readonly.handlebars
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<td class='code'>{{name}}</td>
<td>
{{#if isBody}}
<textarea class='body-textarea' readonly='readonly' name='{{name}}'>{{defaultValue}}</textarea>
<textarea class='body-textarea' readonly='readonly' name='{{name}}'>{{default}}</textarea>
{{else}}
{{#if defaultValue}}
{{defaultValue}}
{{#if default}}
{{default}}
{{else}}
(empty)
{{/if}}
Expand Down
6 changes: 3 additions & 3 deletions src/main/template/param_readonly_required.handlebars
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<td class='code required'>{{name}}</td>
<td>
{{#if isBody}}
<textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='{{name}}'>{{defaultValue}}</textarea>
<textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='{{name}}'>{{default}}</textarea>
{{else}}
{{#if defaultValue}}
{{defaultValue}}
{{#if default}}
{{default}}
{{else}}
(empty)
{{/if}}
Expand Down
8 changes: 4 additions & 4 deletions src/main/template/param_required.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{{#if isFile}}
<input type="file" name='{{name}}'/>
{{else}}
{{#if defaultValue}}
<textarea class='body-textarea' placeholder='(required)' name='{{name}}'>{{defaultValue}}</textarea>
{{#if default}}
<textarea class='body-textarea' placeholder='(required)' name='{{name}}'>{{default}}</textarea>
{{else}}
<textarea class='body-textarea' placeholder='(required)' name='{{name}}'></textarea>
<br />
Expand All @@ -16,8 +16,8 @@
{{#if isFile}}
<input class='parameter' class='required' type='file' name='{{name}}'/>
{{else}}
{{#if defaultValue}}
<input class='parameter required' minlength='1' name='{{name}}' placeholder='(required)' type='text' value='{{defaultValue}}'/>
{{#if default}}
<input class='parameter required' minlength='1' name='{{name}}' placeholder='(required)' type='text' value='{{default}}'/>
{{else}}
<input class='parameter required' minlength='1' name='{{name}}' placeholder='(required)' type='text' value=''/>
{{/if}}
Expand Down

0 comments on commit c7fc5d1

Please sign in to comment.