Browse Source

Merge branch 'master' of github.com:swagger-api/swagger-ui

bubble
Tony Tam 10 years ago
parent
commit
9bdc758147
2 changed files with 10 additions and 8 deletions
  1. +3
    -4
      README.md
  2. +7
    -4
      lib/swagger-client.js

+ 3
- 4
README.md View File

@@ -32,10 +32,9 @@ You can use the swagger-ui code AS-IS! No need to build or recompile--just clon
You can rebuild swagger-ui on your own to tweak it or just so you can say you did. To do so, follow these steps:

1. install [handlebars](http://handlebarsjs.com/)
2. install java
3. npm install
4. npm run-script build
5. You should see the distribution under the dist folder. Open ./dist/index.html to launch Swagger UI in a browser
2. npm install
3. npm run-script build
4. You should see the distribution under the dist folder. Open ./dist/index.html to launch Swagger UI in a browser

### Use
Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.wordnik.com/api/api-docs) service and show its APIs. You can enter your own server url and click explore to view the API.


+ 7
- 4
lib/swagger-client.js View File

@@ -420,6 +420,9 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
if(typeof response.paths[path] === 'object') {
var httpMethod;
for(httpMethod in response.paths[path]) {
if(['delete', 'get', 'head', 'options', 'patch', 'post', 'put'].indexOf(httpMethod) === -1) {
continue;
}
var operation = response.paths[path][httpMethod];
var tags = operation.tags;
if(typeof tags === 'undefined') {
@@ -997,7 +1000,7 @@ Operation.prototype.encodeCollection = function(type, name, value) {
}

/**
* TODO this encoding needs to be changed
* TODO this encoding needs to be changed
**/
Operation.prototype.encodeQueryParam = function(arg) {
return escape(arg);
@@ -1037,7 +1040,7 @@ var Model = function(name, definition) {
if(requiredFields.indexOf(key) >= 0)
required = true;
this.properties.push(new Property(key, property, required));
}
}
}
}

@@ -1216,7 +1219,7 @@ Property.prototype.toString = function() {
str += ', <span class="propOptKey">optional</span>';
str += ')';
}
else
else
str = this.name + ' (' + JSON.stringify(this.obj) + ')';

if(typeof this.description !== 'undefined')
@@ -1480,4 +1483,4 @@ ShredHttpClient.prototype.execute = function(obj) {
obj.on = res;
}
return this.shred.request(obj);
};
};

Loading…
Cancel
Save