Compare commits

..
154 Commits
Author SHA1 Message Date
Tony Tam 114add9287 Merge pull request #740 from swagger-api/develop
added  for 2.0 specs to support multi-select inputs
2014-11-22 08:09:17 -10:00
Tony Tam 50cf3c3597 added for 2.0 specs to support multi-select inputs 2014-11-22 08:01:00 -10:00
Tony Tam c7fc5d1b65 Merge pull request #739 from swagger-api/develop
Standardized default value across both spec versions
2014-11-22 07:58:48 -10:00
Tony Tam 091eca50d9 fix for default values--standardized on which is handled by ParameterView.coffee 2014-11-22 07:54:20 -10:00
Tony Tam 1531dd69a9 Merge branch 'master' of github.com:swagger-api/swagger-ui into develop 2014-11-20 07:00:21 -08:00
webron 932f4e35aa Merge pull request #734 from mhurne/patch-3
Fix spelling errors and improve a sentence
2014-11-20 16:44:21 +02:00
Matt Hurne 33f5c2e498 Fix spelling errors and improve a sentence 2014-11-20 09:42:33 -05:00
webron 48a15e0cb0 Merge pull request #733 from mhurne/patch-2
Fix spelling error in README.md
2014-11-20 16:17:05 +02:00
Matt Hurne 42dfeab882 Fix spelling error in README.md 2014-11-20 09:11:29 -05:00
webron 314b12969a Merge pull request #732 from mhurne/patch-1
Update README.md
2014-11-20 16:07:07 +02:00
Matt Hurne 8bb9391fa8 Update README.md 2014-11-20 09:05:59 -05:00
Tony Tam 0b878111b7 removed file 2014-11-19 07:13:15 -08:00
Tony Tam 616085680f proposed fix for #731 2014-11-19 07:12:40 -08:00
Tony Tam 53fd2f013f fix for https://github.com/swagger-api/swagger-ui/issues/729 2014-11-18 08:28:08 -08:00
Tony Tam 8888827573 updated version 2014-11-17 17:02:46 -08:00
Tony Tam af768dcdbf fix for #727 2014-11-17 17:02:05 -08:00
Tony Tam 187e0a1162 updated link, removed buttons 2014-11-11 09:37:30 -08:00
Tony Tam 8831e289c0 updated versions 2014-11-11 00:17:02 -08:00
Tony Tam 329772af4c merged from auth_2.0 branch 2014-11-11 00:16:13 -08:00
Tony Tam 8e20a32344 updated js libs 2014-11-10 23:19:14 -08:00
Tony Tam d1d2bc75db rebuilt lib 2014-11-03 22:53:14 -08:00
Tony Tam 7457b2027d smarter content type detection 2014-11-03 22:52:17 -08:00
Tony Tam 22c7a9672c updated from swagger-js 2014-10-30 07:59:02 -07:00
Tony Tam 9bdc758147 Merge branch 'master' of github.com:swagger-api/swagger-ui 2014-10-30 07:54:09 -07:00
Tony Tam 23562cecd0 added back exports 2014-10-30 07:53:10 -07:00
Tony Tam 424dde251e Merge pull request #692 from whitlockjc/fix-678
Do not create operations for non-HTTP methods/verbs
2014-10-28 09:36:22 -07:00
Jeremy Whitlock 295fa75dc4 Do not create operations for non-HTTP methods/verbs
Fixes #678
2014-10-28 09:49:03 -06:00
Tony Tam cdd02ad8a3 Update README.md
removed per #688
2014-10-25 13:32:33 -07:00
Tony Tam aefd35237c updated for auth 2014-10-25 11:33:04 -07:00
Tony Tam 73f02aa182 minor formatting 2014-10-25 11:27:40 -07:00
Tony Tam 799069640b removed validator for 1.2 specs 2014-10-23 00:09:14 -07:00
Tony Tam 38112e3cd0 whitespace 2014-10-22 17:28:08 -07:00
Tony Tam 918bd9eedb updated readme 2014-10-22 17:26:57 -07:00
Tony Tam 2d0b3262f3 updated index 2014-10-20 07:28:45 -07:00
Tony Tam 97d23f61de fix for https://github.com/wordnik/swagger-ui/issues/644, verify path object by type 2014-10-20 07:27:06 -07:00
Tony Tam 187dacd8e4 Merge branch 'master' of github.com:wordnik/swagger-ui 2014-10-18 17:39:02 -07:00
Tony Tam 9ba4c38783 updated swagger-js for https://github.com/wordnik/swagger-js/issues/151 2014-10-18 17:38:25 -07:00
Tony Tam 32df32da8e Update README.md 2014-10-18 17:14:35 -07:00
Tony Tam de0f9d58ee updated build 2014-10-18 16:08:01 -07:00
Tony Tam bc38d35aea updated js client 2014-10-18 16:07:22 -07:00
Tony Tam 1738bf1272 fix for #663 2014-10-18 15:57:09 -07:00
Tony Tam 4d1e48df39 updated client per #669 2014-10-18 15:25:28 -07:00
Tony Tam dc84dfc8f8 updated js client 2014-10-17 15:26:05 -07:00
Tony Tam d16b149f39 fix for #632, param names other than 2014-10-17 08:52:44 -07:00
Tony Tam c6fb33a9c7 added support for body params with name other than 2014-10-17 08:51:15 -07:00
Tony Tam b0301d6ee3 rebuilt with deprecate support, https://github.com/wordnik/swagger-ui/pull/645 2014-10-17 06:23:33 -07:00
Tony Tam 97efb054bf Merge pull request #645 from callenx/addDeprecated
Adding deprecated indicator to operations
2014-10-17 06:22:34 -07:00
Tony Tam f882750e5c merged from https://github.com/wordnik/swagger-ui/pull/642 2014-10-17 06:21:00 -07:00
Tony Tam 7957201b61 updated version for publish 2014-10-16 09:10:02 -07:00
Tony Tam 52f55054ed updated swagger-js library 2014-10-16 09:09:22 -07:00
Tony Tam 6b448c1fae Merge branch 'master' of github.com:wordnik/swagger-ui 2014-10-16 02:03:07 -07:00
Tony Tam 559221de56 updated version check, multi support for 2.0 2014-10-16 02:02:56 -07:00
Tony Tam 2bedc01807 Update README.md 2014-10-07 21:15:49 -07:00
Tony Tam e52f83b501 updated version to alpha tag 2014-10-06 13:03:22 -07:00
Chris Allen 20c555306f Adding deprecated indicator to operations 2014-10-03 16:52:44 -07:00
Tony Tam 03dd9fb7f4 fix for header undefined 2014-10-02 23:39:21 -07:00
Tony Tam a4a6c6191b Merge branch 'master' of github.com:wordnik/swagger-ui 2014-10-02 15:29:33 -07:00
Tony Tam 4d2ad25a10 added check for schema 2014-10-02 15:29:26 -07:00
Tony Tam 23fe6d337b Merge pull request #639 from edmondchui/master
Show response for 20x as default if response 200 is not present
2014-10-02 15:19:34 -07:00
Edmond Chui 841acc6db0 Fix swagger-ui issue#637 [https://github.com/wordnik/swagger-ui/issues/637] to show response for 20x as default if response 200 is not present. 2014-10-02 15:13:35 -07:00
Tony Tam 5823358e73 fix for #626, added support for (default || defaultValue) 2014-09-29 22:35:30 -07:00
Tony Tam a39ab425bf undid double stringify 2014-09-28 20:23:04 -07:00
Tony Tam b0eff2d78b added exception handling, updated client 2014-09-28 20:19:17 -07:00
Tony Tam 1eac80abdd formatting 2014-09-28 19:26:59 -07:00
Tony Tam 162ec41fcc Merge branch 'master' of github.com:wordnik/swagger-ui 2014-09-27 22:59:27 -07:00
Tony Tam cbead84f8e updated library 2014-09-27 22:59:19 -07:00
Tony Tam 25c4ab4d5e Merge pull request #619 from miniharryc/master
Update README.md
2014-09-26 13:23:49 -07:00
Harold Combs db28e8b6db Update README.md
Fixed a couple of typos
2014-09-26 16:19:10 -04:00
Tony Tam b7a452eca3 fix for #605, create default tag group 2014-09-26 09:52:27 -07:00
Tony Tam 4e15e9a068 added key listener 2014-09-25 21:44:23 -07:00
Tony Tam b9e79d6824 Merge pull request #594 from alexagranov/master
pull out onChange handler for #input_apiKey so it can be called manually
2014-09-25 21:39:24 -07:00
Tony Tam 1842c41b10 Merge pull request #613 from wordnik/develop_2.0
Sync `develop_2.0` branch back to `master`
2014-09-25 21:38:28 -07:00
Tony Tam 607cca6229 fix for #612 2014-09-25 21:32:55 -07:00
Tony Tam d3f373c188 fixed version 2014-09-25 21:28:34 -07:00
Tony Tam 8918fa1c24 added validator for v2 2014-09-25 21:23:05 -07:00
Tony Tam 3492c72024 added logic for link 2014-09-25 21:02:31 -07:00
Tony Tam 0209cdd42b updated lib 2014-09-25 06:04:18 -04:00
Tony Tam af6eed4eb4 fix for #606, renamed resource to in the template 2014-09-23 10:00:03 -07:00
Tony Tam 2eabeb667a updated client, converted newlines to br in description 2014-09-23 01:26:18 -07:00
Tony Tam d838073389 updated libraries 2014-09-23 00:57:04 -07:00
Tony Tam 922848b195 fix for #602 2014-09-23 00:54:14 -07:00
Tony Tam da661827bf fix for #596 2014-09-22 21:55:48 -07:00
Tony Tam 82e9ceaca6 rebuilt distro 2014-09-20 21:21:13 -07:00
Tony Tam 0cabc3017b updated client to enable auth #588 2014-09-20 21:21:04 -07:00
Tony Tam fedb12960b added null check 2014-09-20 21:20:15 -07:00
Tony Tam 8258d8b4d9 added null check 2014-09-20 21:20:04 -07:00
Tony Tam b9d6f388e9 Merge pull request #589 from davidcole/escape_returned_html
Escape returned HTML
2014-09-20 13:45:20 -07:00
Tony Tam 2edfb5ef0c Merge pull request #591 from johnkchiu/develop_2.0
Fixing tags check for undefined.
2014-09-20 09:18:32 -07:00
Tony Tam 35aac47df3 Merge pull request #584 from KnisterPeter/master
Use initial url parameter if given, else fallback to petstore example
2014-09-20 09:09:10 -07:00
Alex Agranov 19c34cf1ea tidy up the commenting 2014-09-19 18:18:57 -04:00
Alex Agranov ad3e9e5481 pull out onChange handler for #input_apiKey so it can be called manually 2014-09-19 18:14:28 -04:00
Tony Tam 3a43a4cd91 Merge branch 'master' of github.com:wordnik/swagger-ui 2014-09-19 11:35:45 -07:00
Tony Tam a0f398853a fix for #592, added http method 2014-09-19 11:35:37 -07:00
John Chiu 5bdc109746 Fixing tags check for undefined. 2014-09-19 11:13:46 -07:00
David Cole 252100b704 Escape returned HTML. 2014-09-19 13:44:45 -04:00
Markus Wolf 55a5abb9c7 Use initial url parameter if given, else fallback to petstore example 2014-09-19 10:55:17 +02:00
Tony Tam d9f13e9163 Update package.json 2014-09-18 23:03:27 -07:00
Tony Tam 7570e85389 updated link 2014-09-18 21:27:47 -07:00
Tony Tam e7b803b018 updated link 2014-09-18 21:27:13 -07:00
Tony Tam a26651a3bd updated versions 2014-09-18 21:26:12 -07:00
Tony Tam 6675568d09 merged from develop 2014-09-18 21:26:04 -07:00
Tony Tam bd354103f1 merged from develop 2014-09-18 21:12:30 -07:00
Tony Tam c0b11e4719 updated links 2014-09-18 21:09:22 -07:00
Tony Tam 4e508c0a1e updated link 2014-09-18 21:04:24 -07:00
Tony Tam b9c631e09e merged from master 2014-09-18 19:40:33 -07:00
Tony Tam 4ad4b499ee fix for license structure change 2014-09-18 09:29:52 -07:00
Tony Tam 26734d711e added compatibility table 2014-09-18 09:14:43 -07:00
Tony Tam ba14498fbd added links to readme 2014-09-18 09:11:21 -07:00
Tony Tam 390c8c8408 added links to readme 2014-09-18 09:04:21 -07:00
Tony Tam bc4f60a955 added links to readme 2014-09-18 08:28:37 -07:00
Tony Tam 88118bfc32 updated readme, resource to remove url if not present 2014-09-18 08:24:32 -07:00
Tony Tam b653a9909b updated readme, resource to remove url if not present 2014-09-18 08:24:17 -07:00
Tony Tam 91822035ef added response check for swagger 2.0/1.2 client 2014-09-16 17:40:33 -07:00
Tony Tam 394afba3e5 fix for #570, sanitized tag names 2014-09-15 17:37:50 -07:00
Tony Tam b2096eb21b removed stubs 2014-09-15 17:37:22 -07:00
Tony Tam 0c44f83c26 updated swagger lib 2014-09-15 17:36:28 -07:00
Tony Tam 674b288fe6 Merge pull request #572 from dblock/handlebars-from-npm
Use handlebars installed from npm.
2014-09-15 16:17:10 -07:00
dblock 0cdcbfb70b Use handlebars from npm. 2014-09-15 18:58:08 -04:00
Tony Tam 0395bf3eb3 updated swagger-js 2014-09-14 14:06:31 -07:00
Tony Tam 264ba2910d updated client, version 2014-09-12 16:42:49 -07:00
Tony Tam 66718f23dd updates to develop branch 2014-09-12 16:09:42 -07:00
Tony Tam 7b3b7066eb Merge pull request #543 from STRML/fixInlineEvents
Remove inline event handlers from resource template.
2014-09-12 13:51:55 -07:00
Samuel Reed 7a91117b6f Remove inline event handlers from resource template.
This allows us to use a strict CSP on explorer pages.
2014-09-12 14:30:42 -04:00
Tony Tam 963c009870 added 2.0 client 2014-09-11 15:39:09 -07:00
Tony Tam bdec07e8c3 updated files 2014-09-07 17:12:03 -07:00
Tony Tam 9b0aa32941 rebuilt 2014-08-27 19:50:34 -07:00
Tony Tam b1964254c5 Merge pull request #540 from bezhermoso/throbber_img_reference
Moved reference to throbber.gif to CSS file.
2014-08-24 21:19:03 -07:00
Tony Tam 3a7b66d345 Merge pull request #541 from STRML/master
Fix self XSS in request url.
2014-08-24 11:04:36 -07:00
Samuel Reed 5da60bfa62 Fix potential self XSS in request url. 2014-08-24 11:02:54 -04:00
Bez Hermoso f8991bc7f5 Moved reference to throbber.gif to CSS file. 2014-08-21 13:20:45 -07:00
Tony Tam ec81d25cb0 Merge pull request #532 from Antek-drzewiecki/oauth_redirect_url_fix
Fixed oauth redirect url path. URL works with nested pathnames.
2014-08-14 08:30:27 -07:00
Antek Drzewiecki 2b08c0e209 Fixed oauth redirect url path. URL works with nested pathnames. 2014-08-14 17:01:18 +02:00
Tony Tam ee199633f6 fixes for https://github.com/wordnik/swagger-js/issues/107 2014-08-06 15:59:32 -07:00
Tony Tam 4ea20859c7 updated swagger-js 2014-08-02 15:24:51 -07:00
Tony Tam 0a52e344e7 updated swagger-js, added #507 to dist 2014-08-02 09:31:17 -07:00
Tony Tam e04b756521 Merge pull request #507 from jbryson3/master
Provide option highlightSizeThreshold
2014-08-01 19:44:25 -07:00
Tony Tam 9955bcc69f updated versions 2014-08-01 17:34:15 -07:00
Tony Tam c17cc1010f rebuilt 2014-08-01 17:15:42 -07:00
Tony Tam 2de104aac9 updated templates to support file as body or form params 2014-08-01 17:13:56 -07:00
Tony Tam fbe5278928 updated logger to avoid logging arrays 2014-08-01 17:13:30 -07:00
Tony Tam b09a8e91c9 updated key name 2014-08-01 17:12:08 -07:00
Tony Tam c3904c54c8 updated key name 2014-08-01 17:11:59 -07:00
Tony Tam 26db2ce375 updated swagger-js to 2.0.34 2014-08-01 17:11:36 -07:00
John Bryson 28c7597138 Provide option highlightSizeThreshold to allow conditional syntax highlighting based on response size 2014-07-31 11:56:13 -04:00
Tony Tam c948b40d34 Merge pull request #496 from chatch/master
sort routes alphabetically (254)
2014-07-28 07:45:31 -07:00
Chris Hatch 5d2bed7025 provide option sorter=[alpha|method] 2014-07-27 21:18:18 +08:00
Chris Hatch 6dc12f733e Merge branch 'master' of https://github.com/wordnik/swagger-ui 2014-07-27 20:24:01 +08:00
Tony Tam dfd5e937d4 Merge pull request #500 from 3scale/patch-2
Fixed undefined variable error
2014-07-24 12:01:46 -07:00
aurelian 9d0417e7f2 fixed undefined variable errors 2014-07-24 17:42:51 +02:00
Chris Hatch 8ad46f0813 remove console.info 2014-07-20 20:21:28 +08:00
Chris Hatch db6419414c #254 alphabetical sort of apis and operations under apis
new option sortAlphabetical=true|false
2014-07-20 20:18:19 +08:00
Tony Tam 9b9b5b4551 updated distro to include #493 2014-07-14 13:42:57 -06:00
Tony Tam 50ded295d9 Merge pull request #493 from vanderlee/patch-1
Fix for issue #492; HTML in response headers
2014-07-14 13:41:46 -06:00
Martijn van der Lee 525241fcd2 Fix for issue #492; HTML in response headers
Fix for issue #492 by escaping the response headers using Underscore
2014-07-14 20:39:54 +02:00
38 changed files with 7439 additions and 3504 deletions
+13 -11
View File
@@ -2,6 +2,7 @@ fs = require 'fs'
path = require 'path'
{exec} = require 'child_process'
less = require 'less'
handlebars = require 'handlebars'
sourceFiles = [
'SwaggerUi'
@@ -15,6 +16,8 @@ sourceFiles = [
'view/ContentTypeView'
'view/ResponseContentTypeView'
'view/ParameterContentTypeView'
'view/ApiKeyButton'
'view/BasicAuthButton'
]
@@ -41,18 +44,17 @@ task 'dist', 'Build a distribution', ->
templateContents = new Array remaining = templateFiles.length
for file, index in templateFiles then do (file, index) ->
console.log " : Compiling src/main/template/#{file}"
exec "handlebars src/main/template/#{file} -f dist/_#{file}.js", (err, stdout, stderr) ->
fs.readFile "src/main/template/#{file}", 'utf8', (err, source) ->
throw err if err
fs.readFile 'dist/_' + file + '.js', 'utf8', (err, fileContents) ->
throw err if err
templateContents[index] = fileContents
fs.unlink 'dist/_' + file + '.js'
if --remaining is 0
templateContents.push '\n\n'
fs.writeFile 'dist/_swagger-ui-templates.js', templateContents.join('\n\n'), 'utf8', (err) ->
throw err if err
build()
compiled = handlebars.precompile(source)
templateContents[index] = '(function() {\n var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};\ntemplates[\'' + file.replace('.handlebars', '') + '\'] = template(' + compiled + ');\n})();'
fs.unlink 'dist/_' + file + '.js', (err) ->
console.log "#{err.code}: #{err.path}" unless err.code == 'ENOENT'
if --remaining is 0
templateContents.push '\n\n'
fs.writeFile 'dist/_swagger-ui-templates.js', templateContents.join('\n\n'), 'utf8', (err) ->
throw err if err
build()
build = ->
console.log ' : Collecting Coffeescript source...'
+24 -14
View File
@@ -1,19 +1,28 @@
# Swagger UI
Swagger UI is part of Swagger project. The Swagger project allows you to produce, visualize and consume your OWN RESTful services. No proxy or 3rd party services required. Do it your own way.
Swagger UI is part of the Swagger project. The Swagger project allows you to produce, visualize and consume your OWN RESTful services. No proxy or 3rd party services required. Do it your own way.
Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically
generate beautiful documentation and sandbox from a Swagger-compliant API. Because Swagger UI has no dependencies, you can host it in any server environment, or on your local machine.
## What's Swagger?
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swager removes the guesswork in calling the service.
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service.
Check out [Swagger-Spec](https://github.com/wordnik/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
## Compatibility
The Swagger Specification has undergone 3 revisions since initial creation in 2010. Compatibility between swagger-ui and the Swagger specification is as follows:
Swagger UI Version | Release Date | Swagger Spec compatibility | Notes | Status
------------------ | ------------ | -------------------------- | ----- | ------
2.1.0-alpha.1 (in development) | 2014-10-06 | 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-ui/tree/master) | [Issues](https://github.com/swagger-api/swagger-ui/milestones/v2.1.0)
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) |
1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) |
## How to Use It
### Download
@@ -23,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.
@@ -45,7 +53,7 @@ You may choose to customize Swagger UI for your organization. Here is an overvie
- src/main/javascript: some legacy javascript referenced by CoffeeScript code
### SwaggerUi
To use swagger-ui you should take a look at the [source of swagger-ui html page](https://github.com/wordnik/swagger-ui/tree/master/src/main/html) and customize it. This basically requires you to instantiate a SwaggerUi object and call load() on it as below:
To use swagger-ui you should take a look at the [source of swagger-ui html page](https://github.com/swagger-api/swagger-ui/tree/master/src/main/html) and customize it. This basically requires you to instantiate a SwaggerUi object and call load() on it as below:
```javascript
window.swaggerUi = new SwaggerUi({
@@ -55,21 +63,23 @@ To use swagger-ui you should take a look at the [source of swagger-ui html page]
window.swaggerUi.load();
```
* *url* parameter should point to a resource listing url as per [Swagger Spec](https://github.com/wordnik/swagger-core/wiki)
* *url* parameter should point to a resource listing url as per [Swagger Spec](https://github.com/swagger-api/swagger-spec/)
* *dom_id parameter* is the the id of a dom element inside which SwaggerUi will put the user interface for swagger
* *booleanValues* SwaggerUI renders boolean data types as a dropdown. By default it provides a 'true' and 'false' string as the possible choices. You can use this parameter to change the values in dropdown to be something else, for example 0 and 1 by setting booleanValues to new Array(0, 1)
* *docExpansion* controls how the API listing is displayed. It can be set to 'none' (default), 'list' (shows operations for each resource), or 'full' (fully expanded: shows operations and their details)
* *sorter* apply a sort to the API list. It can be 'alpha' (sort paths alphanumerically) or 'method' (sort operations by HTTP method). Default is the order returned by the server unchanged.
* *onComplete* is a callback function parameter which can be passed to be notified of when SwaggerUI has completed rendering successfully.
* *onFailure* is a callback function parameter which can be passed to be notified of when SwaggerUI encountered a failure was unable to render.
* *highlightSizeThreshold* any size response below this threshold will be highlighted syntactically, attempting to highlight large responses can lead to browser hangs, not including a threshold will default to highlight all returned responses
* All other parameters are explained in greater detail below
### HTTP Methods and API Invocation
swagger-ui supports invocation of all HTTP methods APIs including GET, PUT, POST, DELETE, PATCH, OPTIONS. These are handled in the [swagger-js](https://github.com/wordnik/swagger-js) project, please see there for specifics on their usage.
swagger-ui supports invocation of all HTTP methods APIs including GET, PUT, POST, DELETE, PATCH, OPTIONS. These are handled in the [swagger-js](https://github.com/swagger-api/swagger-js) project, please see there for specifics on their usage.
### Header Parameters
Header params are supported through a pluggable mechanism in [swagger-js](https://github.com/wordnik/swagger-js). You can see the [index.html](https://github.com/wordnik/swagger-ui/blob/master/dist/index.html) for a sample of how to dynamically set headers:
Header params are supported through a pluggable mechanism in [swagger-js](https://github.com/swagger-api/swagger-js). You can see the [index.html](https://github.com/swagger-api/swagger-ui/blob/master/dist/index.html) for a sample of how to dynamically set headers:
```js
// add a new ApiKeyAuthorization when the api-key changes in the ui.
@@ -94,9 +104,9 @@ Note! You can pass multiple header params on a single request, just use unique
## How to Improve It
Create your own fork of [wordnik/swagger-ui](https://github.com/wordnik/swagger-ui)
Create your own fork of [wordnik/swagger-ui](https://github.com/swagger-api/swagger-ui)
To share your changes, [submit a pull request](https://github.com/wordnik/swagger-ui/pull/new/master).
To share your changes, [submit a pull request](https://github.com/swagger-api/swagger-ui/pull/new/master).
Since the javascript files are compiled from coffeescript, please submit changes in the *.coffee files! We have to reject changes only in the .js files as they will be lost on each build of the ui.
+8 -5
View File
@@ -743,17 +743,20 @@
display: inline-block;
font-size: 0.9em;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header img {
display: block;
clear: none;
float: right;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit {
display: block;
clear: none;
float: left;
padding: 6px 8px;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber {
background-image: url('../images/throbber.gif');
width: 128px;
height: 16px;
display: block;
clear: none;
float: right;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type='text'].error {
outline: 2px solid black;
outline-color: #cc0000;
+54 -42
View File
@@ -16,49 +16,67 @@
<script src='lib/underscore-min.js' type='text/javascript'></script>
<script src='lib/backbone-min.js' type='text/javascript'></script>
<script src='lib/swagger.js' type='text/javascript'></script>
<script src='lib/swagger-client.js' type='text/javascript'></script>
<script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
<!-- enabling this will enable oauth2 implicit scope support -->
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
$(function () {
window.swaggerUi = new SwaggerUi({
url: "http://petstore.swagger.wordnik.com/api/api-docs",
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
onComplete: function(swaggerApi, swaggerUi){
log("Loaded SwaggerUI");
if(typeof initOAuth == "function") {
/*
initOAuth({
clientId: "your-client-id",
realm: "your-realms",
appName: "your-app-name"
});
*/
}
$('pre code').each(function(i, e) {
hljs.highlightBlock(e)
});
},
onFailure: function(data) {
log("Unable to Load SwaggerUI");
},
docExpansion: "none"
});
$('#input_apiKey').change(function() {
var key = $('#input_apiKey')[0].value;
log("key: " + key);
if(key && key.trim() != "") {
log("added key " + key);
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = url[1];
} else {
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
}
})
window.swaggerUi.load();
window.swaggerUi = new SwaggerUi({
url: url,
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
onComplete: function(swaggerApi, swaggerUi){
log("Loaded SwaggerUI");
if(typeof initOAuth == "function") {
/*
initOAuth({
clientId: "your-client-id",
realm: "your-realms",
appName: "your-app-name"
});
*/
}
$('pre code').each(function(i, e) {
hljs.highlightBlock(e)
});
},
onFailure: function(data) {
log("Unable to Load SwaggerUI");
},
docExpansion: "none",
sorter : "alpha"
});
function addApiKeyAuthorization() {
var key = $('#input_apiKey')[0].value;
log("key: " + key);
if(key && key.trim() != "") {
log("added key " + key);
window.authorizations.add("api_key", new ApiKeyAuthorization("api_key", key, "query"));
}
}
$('#input_apiKey').change(function() {
addApiKeyAuthorization();
});
// if you have an apiKey you would like to pre-populate on the page for demonstration purposes...
/*
var apiKey = "myApiKeyXXXX123456789";
$('#input_apiKey').val(apiKey);
addApiKeyAuthorization();
*/
window.swaggerUi.load();
});
</script>
</head>
@@ -66,14 +84,8 @@
<body class="swagger-section">
<div id='header'>
<div class="swagger-ui-wrap">
<a id="logo" href="http://swagger.wordnik.com">swagger</a>
<a id="logo" href="http://swagger.io">swagger</a>
<form id='api_selector'>
<div class='input icon-btn'>
<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis">
</div>
<div class='input icon-btn'>
<img id="show-wordnik-dev-icon" src="images/wordnik_api.png" title="Show Wordnik Developer Apis">
</div>
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
<div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
<div class='input'><a id="explore" href="#">Explore</a></div>
+3 -3
View File
@@ -2131,10 +2131,10 @@ require.define("/shred/mixins/headers.js", function (require, module, exports, _
// to `Content-Type`.
var corsetCase = function(string) {
return string.toLowerCase()
return string;//.toLowerCase()
//.replace("_","-")
.replace(/(^|-)(\w)/g,
function(s) { return s.toUpperCase(); });
// .replace(/(^|-)(\w)/g,
// function(s) { return s.toUpperCase(); });
};
// We suspect that `initializeHeaders` was once more complicated ...
+1489
View File
File diff suppressed because it is too large Load Diff
+106 -87
View File
@@ -7,10 +7,29 @@ var realm;
function handleLogin() {
var scopes = [];
if(window.swaggerUi.api.authSchemes
&& window.swaggerUi.api.authSchemes.oauth2
&& window.swaggerUi.api.authSchemes.oauth2.scopes) {
scopes = window.swaggerUi.api.authSchemes.oauth2.scopes;
var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
if(auths) {
var key;
var defs = auths;
for(key in defs) {
var auth = defs[key];
if(auth.type === 'oauth2' && auth.scopes) {
var scope;
if(Array.isArray(auth.scopes)) {
// 1.2 support
var i;
for(i = 0; i < auth.scopes.length; i++) {
scopes.push(auth.scopes[i]);
}
}
else {
// 2.0 support
for(scope in auth.scopes) {
scopes.push({scope: scope, description: auth.scopes[scope]});
}
}
}
}
}
if(window.swaggerUi.api
@@ -18,102 +37,103 @@ function handleLogin() {
appName = window.swaggerUi.api.info.title;
}
if(popupDialog.length > 0)
popupDialog = popupDialog.last();
else {
popupDialog = $(
[
'<div class="api-popup-dialog">',
'<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
'<div class="api-popup-content">',
'<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
'<a href="#">Learn how to use</a>',
'</p>',
'<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
'<ul class="api-popup-scopes">',
'</ul>',
'<p class="error-msg"></p>',
'<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
'</div>',
'</div>'].join(''));
$(document.body).append(popupDialog);
popupDialog = $(
[
'<div class="api-popup-dialog">',
'<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
'<div class="api-popup-content">',
'<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
'<a href="#">Learn how to use</a>',
'</p>',
'<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
'<ul class="api-popup-scopes">',
'</ul>',
'<p class="error-msg"></p>',
'<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
'</div>',
'</div>'].join(''));
$(document.body).append(popupDialog);
popup = popupDialog.find('ul.api-popup-scopes').empty();
for (i = 0; i < scopes.length; i ++) {
scope = scopes[i];
str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
if (scope.description) {
str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
}
str += '</label></li>';
popup.append(str);
popup = popupDialog.find('ul.api-popup-scopes').empty();
for (i = 0; i < scopes.length; i ++) {
scope = scopes[i];
str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
if (scope.description) {
str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
}
str += '</label></li>';
popup.append(str);
}
var $win = $(window),
dw = $win.width(),
dh = $win.height(),
st = $win.scrollTop(),
dlgWd = popupDialog.outerWidth(),
dlgHt = popupDialog.outerHeight(),
top = (dh -dlgHt)/2 + st,
left = (dw - dlgWd)/2;
var $win = $(window),
dw = $win.width(),
dh = $win.height(),
st = $win.scrollTop(),
dlgWd = popupDialog.outerWidth(),
dlgHt = popupDialog.outerHeight(),
top = (dh -dlgHt)/2 + st,
left = (dw - dlgWd)/2;
popupDialog.css({
top: (top < 0? 0 : top) + 'px',
left: (left < 0? 0 : left) + 'px'
});
popupDialog.css({
top: (top < 0? 0 : top) + 'px',
left: (left < 0? 0 : left) + 'px'
});
popupDialog.find('button.api-popup-cancel').click(function() {
popupMask.hide();
popupDialog.hide();
});
popupDialog.find('button.api-popup-authbtn').click(function() {
popupMask.hide();
popupDialog.hide();
popupDialog.find('button.api-popup-cancel').click(function() {
popupMask.hide();
popupDialog.hide();
popupDialog.empty();
popupDialog = [];
});
var authSchemes = window.swaggerUi.api.authSchemes;
var location = window.location;
var locationUrl = location.protocol + '//' + location.host + location.pathname;
var redirectUrl = locationUrl.replace("index.html","").concat("/o2c.html").replace("//o2c.html","/o2c.html");
var url = null;
popupDialog.find('button.api-popup-authbtn').click(function() {
popupMask.hide();
popupDialog.hide();
var p = window.swaggerUi.api.authSchemes;
for (var key in p) {
if (p.hasOwnProperty(key)) {
var o = p[key].grantTypes;
var authSchemes = window.swaggerUi.api.authSchemes;
var host = window.location;
var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
var url = null;
for (var key in authSchemes) {
if (authSchemes.hasOwnProperty(key)) {
if(authSchemes[key].type === 'oauth2' && authSchemes[key].flow === 'implicit') {
var dets = authSchemes[key];
url = dets.authorizationUrl + '?response_type=token';
window.swaggerUi.tokenName = dets.tokenUrl || 'access_token';
}
else if(authSchemes[key].grantTypes) {
// 1.2 support
var o = authSchemes[key].grantTypes;
for(var t in o) {
if(o.hasOwnProperty(t) && t === 'implicit') {
var dets = o[t];
url = dets.loginEndpoint.url + "?response_type=token";
var ep = dets.loginEndpoint.url;
url = dets.loginEndpoint.url + '?response_type=token';
window.swaggerUi.tokenName = dets.tokenName;
}
}
}
}
var scopes = [];
var scopeForUrl='';
var o = $('.api-popup-scopes').find('input:checked');
}
var scopes = []
var o = $('.api-popup-scopes').find('input:checked');
for(var k =0; k < o.length; k++) {
scopes.push($(o[k]).attr("scope"));
if(k > 0){
scopeForUrl+=' ';
}
scopeForUrl+=$(o[k]).attr("scope");
}
for(k =0; k < o.length; k++) {
scopes.push($(o[k]).attr('scope'));
}
window.enabledScopes=scopes;
window.enabledScopes=scopes;
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
url += '&realm=' + encodeURIComponent(realm);
url += '&client_id=' + encodeURIComponent(clientId);
url += '&scope=' + encodeURIComponent(scopeForUrl);
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
url += '&realm=' + encodeURIComponent(realm);
url += '&client_id=' + encodeURIComponent(clientId);
url += '&scope=' + encodeURIComponent(scopes);
window.open(url);
});
window.open(url);
});
}
popupMask.show();
popupDialog.show();
return;
@@ -137,14 +157,14 @@ function initOAuth(opts) {
var o = (opts||{});
var errors = [];
appName = (o.appName||errors.push("missing appName"));
appName = (o.appName||errors.push('missing appName'));
popupMask = (o.popupMask||$('#api-common-mask'));
popupDialog = (o.popupDialog||$('.api-popup-dialog'));
clientId = (o.clientId||errors.push("missing client id"));
realm = (o.realm||errors.push("missing realm"));
clientId = (o.clientId||errors.push('missing client id'));
realm = (o.realm||errors.push('missing realm'));
if(errors.length > 0){
log("auth unable initialize oauth: " + errors);
log('auth unable initialize oauth: ' + errors);
return;
}
@@ -210,8 +230,7 @@ function onOAuthComplete(token) {
}
}
});
window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "Bearer " + b, "header"));
window.authorizations.add('oauth2', new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
}
}
}
+1581 -1472
View File
File diff suppressed because it is too large Load Diff
+555 -152
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -2131,10 +2131,10 @@ require.define("/shred/mixins/headers.js", function (require, module, exports, _
// to `Content-Type`.
var corsetCase = function(string) {
return string.toLowerCase()
return string;//.toLowerCase()
//.replace("_","-")
.replace(/(^|-)(\w)/g,
function(s) { return s.toUpperCase(); });
// .replace(/(^|-)(\w)/g,
// function(s) { return s.toUpperCase(); });
};
// We suspect that `initializeHeaders` was once more complicated ...
File diff suppressed because it is too large Load Diff
+106 -87
View File
@@ -7,10 +7,29 @@ var realm;
function handleLogin() {
var scopes = [];
if(window.swaggerUi.api.authSchemes
&& window.swaggerUi.api.authSchemes.oauth2
&& window.swaggerUi.api.authSchemes.oauth2.scopes) {
scopes = window.swaggerUi.api.authSchemes.oauth2.scopes;
var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
if(auths) {
var key;
var defs = auths;
for(key in defs) {
var auth = defs[key];
if(auth.type === 'oauth2' && auth.scopes) {
var scope;
if(Array.isArray(auth.scopes)) {
// 1.2 support
var i;
for(i = 0; i < auth.scopes.length; i++) {
scopes.push(auth.scopes[i]);
}
}
else {
// 2.0 support
for(scope in auth.scopes) {
scopes.push({scope: scope, description: auth.scopes[scope]});
}
}
}
}
}
if(window.swaggerUi.api
@@ -18,102 +37,103 @@ function handleLogin() {
appName = window.swaggerUi.api.info.title;
}
if(popupDialog.length > 0)
popupDialog = popupDialog.last();
else {
popupDialog = $(
[
'<div class="api-popup-dialog">',
'<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
'<div class="api-popup-content">',
'<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
'<a href="#">Learn how to use</a>',
'</p>',
'<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
'<ul class="api-popup-scopes">',
'</ul>',
'<p class="error-msg"></p>',
'<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
'</div>',
'</div>'].join(''));
$(document.body).append(popupDialog);
popupDialog = $(
[
'<div class="api-popup-dialog">',
'<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
'<div class="api-popup-content">',
'<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
'<a href="#">Learn how to use</a>',
'</p>',
'<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
'<ul class="api-popup-scopes">',
'</ul>',
'<p class="error-msg"></p>',
'<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
'</div>',
'</div>'].join(''));
$(document.body).append(popupDialog);
popup = popupDialog.find('ul.api-popup-scopes').empty();
for (i = 0; i < scopes.length; i ++) {
scope = scopes[i];
str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
if (scope.description) {
str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
}
str += '</label></li>';
popup.append(str);
popup = popupDialog.find('ul.api-popup-scopes').empty();
for (i = 0; i < scopes.length; i ++) {
scope = scopes[i];
str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
if (scope.description) {
str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
}
str += '</label></li>';
popup.append(str);
}
var $win = $(window),
dw = $win.width(),
dh = $win.height(),
st = $win.scrollTop(),
dlgWd = popupDialog.outerWidth(),
dlgHt = popupDialog.outerHeight(),
top = (dh -dlgHt)/2 + st,
left = (dw - dlgWd)/2;
var $win = $(window),
dw = $win.width(),
dh = $win.height(),
st = $win.scrollTop(),
dlgWd = popupDialog.outerWidth(),
dlgHt = popupDialog.outerHeight(),
top = (dh -dlgHt)/2 + st,
left = (dw - dlgWd)/2;
popupDialog.css({
top: (top < 0? 0 : top) + 'px',
left: (left < 0? 0 : left) + 'px'
});
popupDialog.css({
top: (top < 0? 0 : top) + 'px',
left: (left < 0? 0 : left) + 'px'
});
popupDialog.find('button.api-popup-cancel').click(function() {
popupMask.hide();
popupDialog.hide();
});
popupDialog.find('button.api-popup-authbtn').click(function() {
popupMask.hide();
popupDialog.hide();
popupDialog.find('button.api-popup-cancel').click(function() {
popupMask.hide();
popupDialog.hide();
popupDialog.empty();
popupDialog = [];
});
var authSchemes = window.swaggerUi.api.authSchemes;
var location = window.location;
var locationUrl = location.protocol + '//' + location.host + location.pathname;
var redirectUrl = locationUrl.replace("index.html","").concat("/o2c.html").replace("//o2c.html","/o2c.html");
var url = null;
popupDialog.find('button.api-popup-authbtn').click(function() {
popupMask.hide();
popupDialog.hide();
var p = window.swaggerUi.api.authSchemes;
for (var key in p) {
if (p.hasOwnProperty(key)) {
var o = p[key].grantTypes;
var authSchemes = window.swaggerUi.api.authSchemes;
var host = window.location;
var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
var url = null;
for (var key in authSchemes) {
if (authSchemes.hasOwnProperty(key)) {
if(authSchemes[key].type === 'oauth2' && authSchemes[key].flow === 'implicit') {
var dets = authSchemes[key];
url = dets.authorizationUrl + '?response_type=token';
window.swaggerUi.tokenName = dets.tokenUrl || 'access_token';
}
else if(authSchemes[key].grantTypes) {
// 1.2 support
var o = authSchemes[key].grantTypes;
for(var t in o) {
if(o.hasOwnProperty(t) && t === 'implicit') {
var dets = o[t];
url = dets.loginEndpoint.url + "?response_type=token";
var ep = dets.loginEndpoint.url;
url = dets.loginEndpoint.url + '?response_type=token';
window.swaggerUi.tokenName = dets.tokenName;
}
}
}
}
var scopes = [];
var scopeForUrl='';
var o = $('.api-popup-scopes').find('input:checked');
}
var scopes = []
var o = $('.api-popup-scopes').find('input:checked');
for(var k =0; k < o.length; k++) {
scopes.push($(o[k]).attr("scope"));
if(k > 0){
scopeForUrl+=' ';
}
scopeForUrl+=$(o[k]).attr("scope");
}
for(k =0; k < o.length; k++) {
scopes.push($(o[k]).attr('scope'));
}
window.enabledScopes=scopes;
window.enabledScopes=scopes;
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
url += '&realm=' + encodeURIComponent(realm);
url += '&client_id=' + encodeURIComponent(clientId);
url += '&scope=' + encodeURIComponent(scopeForUrl);
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
url += '&realm=' + encodeURIComponent(realm);
url += '&client_id=' + encodeURIComponent(clientId);
url += '&scope=' + encodeURIComponent(scopes);
window.open(url);
});
window.open(url);
});
}
popupMask.show();
popupDialog.show();
return;
@@ -137,14 +157,14 @@ function initOAuth(opts) {
var o = (opts||{});
var errors = [];
appName = (o.appName||errors.push("missing appName"));
appName = (o.appName||errors.push('missing appName'));
popupMask = (o.popupMask||$('#api-common-mask'));
popupDialog = (o.popupDialog||$('.api-popup-dialog'));
clientId = (o.clientId||errors.push("missing client id"));
realm = (o.realm||errors.push("missing realm"));
clientId = (o.clientId||errors.push('missing client id'));
realm = (o.realm||errors.push('missing realm'));
if(errors.length > 0){
log("auth unable initialize oauth: " + errors);
log('auth unable initialize oauth: ' + errors);
return;
}
@@ -210,8 +230,7 @@ function onOAuthComplete(token) {
}
}
});
window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "Bearer " + b, "header"));
window.authorizations.add('oauth2', new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
}
}
}
+1581 -1472
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "swagger-ui",
"version": "2.0.18",
"version": "2.1.0-alpha.6",
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"scripts": {
"build": "PATH=$PATH:./node_modules/.bin cake dist",
@@ -18,8 +18,8 @@
"license": "Apache",
"readmeFilename": "README.md",
"dependencies": {
"coffee-script": "~1.5.0",
"swagger-client": "2.0.29",
"coffee-script": "~1.6.3",
"swagger-client": "2.0.41",
"handlebars": "~1.0.10",
"less": "~1.4.2"
}
+21 -6
View File
@@ -22,9 +22,16 @@ class SwaggerUi extends Backbone.Router
@options = options
# Set the callbacks
@options.success = => @render()
@options.success = =>
@render()
@options.progress = (d) => @showMessage(d)
@options.failure = (d) => @onLoadFailure(d)
@options.failure = (d) =>
if @api and @api.isValid is false
log "not a valid 2.0 spec, loading legacy client"
@api = new SwaggerApi(@options)
@api.build()
else
@onLoadFailure(d)
# Create view to handle the header inputs
@headerView = new HeaderView({el: $('#header')})
@@ -32,6 +39,14 @@ class SwaggerUi extends Backbone.Router
# Event handler for when the baseUrl/apiKey is entered by user
@headerView.on 'update-swagger-ui', (data) => @updateSwaggerUi(data)
# Set an option after initializing
setOption: (option,value) ->
@options[option] = value
# Get the value of a previously set option
getOption: (option) ->
@options[option]
# Event handler for when url/key is received from user
updateSwaggerUi: (data) ->
@options.url = data.url
@@ -47,15 +62,15 @@ class SwaggerUi extends Backbone.Router
@options.url = url
@headerView.update(url)
@api = new SwaggerApi(@options)
@api.build()
@api
@api = new SwaggerClient(@options)
@api.build()
# This is bound to success handler for SwaggerApi
# so it gets called when SwaggerApi completes loading
render:() ->
@showMessage('Finished Loading Resource Information. Rendering Swagger UI...')
@mainView = new MainView({model: @api, el: $('#' + @dom_id)}).render()
@mainView = new MainView({model: @api, el: $('#' + @dom_id), swaggerOptions: @options}).render()
@showMessage()
switch @options.docExpansion
when "full" then Docs.expandOperationsForResource('')
@@ -0,0 +1,31 @@
class ApiKeyButton extends Backbone.View
initialize: ->
render: ->
template = @template()
$(@el).html(template(@model))
@
events:
"click #apikey_button" : "toggleApiKeyContainer"
"click #apply_api_key" : "applyApiKey"
applyApiKey: ->
window.authorizations.add(@model.name, new ApiKeyAuthorization(@model.name, $("#input_apiKey_entry").val(), @model.in))
window.swaggerUi.load()
elem = $('#apikey_container').show()
toggleApiKeyContainer: ->
if $('#apikey_container').length > 0
elem = $('#apikey_container').first()
if elem.is ':visible'
elem.hide()
else
# hide others
$('.auth_container').hide()
elem.show()
template: ->
Handlebars.templates.apikey_button_view
@@ -0,0 +1,35 @@
class BasicAuthButton extends Backbone.View
initialize: ->
render: ->
template = @template()
$(@el).html(template(@model))
@
events:
"click #basic_auth_button" : "togglePasswordContainer"
"click #apply_basic_auth" : "applyPassword"
applyPassword: ->
console.log "applying password"
username = $(".input_username").val()
password = $(".input_password").val()
window.authorizations.add(@model.type, new PasswordAuthorization("basic", username, password))
window.swaggerUi.load()
elem = $('#basic_auth_container').hide()
togglePasswordContainer: ->
if $('#basic_auth_container').length > 0
elem = $('#basic_auth_container').show()
if elem.is ':visible'
elem.slideUp()
else
# hide others
$('.auth_container').hide()
elem.show()
template: ->
Handlebars.templates.basic_auth_button_view
+58 -5
View File
@@ -1,7 +1,52 @@
class MainView extends Backbone.View
initialize: ->
sorters = {
'alpha' : (a,b) -> return a.path.localeCompare(b.path),
'method' : (a,b) -> return a.method.localeCompare(b.method),
}
initialize: (opts={}) ->
# set up the UI for input
@model.auths = []
for key, value of @model.securityDefinitions
auth = {name: key, type: value.type, value: value}
@model.auths.push auth
if @model.info and @model.info.license and typeof @model.info.license is 'string'
name = @model.info.license
url = @model.info.licenseUrl
@model.info.license = {}
@model.info.license.name = name
@model.info.license.url = url
if !@model.info
@model.info = {}
if !@model.info.version
@model.info.version = @model.apiVersion
if @model.swaggerVersion is "2.0"
if "validatorUrl" of opts.swaggerOptions
# Validator URL specified explicitly
@model.validatorUrl = opts.swaggerOptions.validatorUrl
else if @model.url.indexOf("localhost") > 0
# Localhost override
@model.validatorUrl = null
else
# Default validator
@model.validatorUrl = "http://online.swagger.io/validator"
render: ->
if @model.securityDefinitions
for name of @model.securityDefinitions
auth = @model.securityDefinitions[name]
if auth.type is "apiKey" and $("#apikey_button").length is 0
button = new ApiKeyButton({model: auth}).render().el
$('.auth_main_container').append button
if auth.type is "basicAuth" and $("#basic_auth_button").length is 0
button = new BasicAuthButton({model: auth}).render().el
$('.auth_main_container').append button
# Render the outer container for resources
$(@el).html(Handlebars.templates.main(@model))
@@ -16,13 +61,21 @@ class MainView extends Backbone.View
counter += 1
resource.id = id
resources[id] = resource
@addResource resource
@addResource resource, @model.auths
@
addResource: (resource) ->
addResource: (resource, auths) ->
# Render a resource and add it to resources li
resourceView = new ResourceView({model: resource, tagName: 'li', id: 'resource_' + resource.id, className: 'resource'})
resource.id = resource.id.replace(/\s/g, '_')
resourceView = new ResourceView({
model: resource,
tagName: 'li',
id: 'resource_' + resource.id,
className: 'resource',
auths: auths,
swaggerOptions: @options.swaggerOptions
})
$('#resources').append resourceView.render().el
clear: ->
$(@el).html ''
$(@el).html ''
+80 -28
View File
@@ -10,12 +10,15 @@ class OperationView extends Backbone.View
'mouseout .api-ic' : 'mouseExit'
}
initialize: ->
initialize: (opts={}) ->
@auths = opts.auths
@
mouseEnter: (e) ->
elem = $(e.currentTarget.parentNode).find('#api_information_panel')
x = event.pageX
y = event.pageY
x = e.pageX
y = e.pageY
scX = $(window).scrollLeft()
scY = $(window).scrollTop()
scMaxX = scX + $(window).width()
@@ -44,16 +47,46 @@ class OperationView extends Backbone.View
isMethodSubmissionSupported = true #jQuery.inArray(@model.method, @model.supportedSubmitMethods) >= 0
@model.isReadOnly = true unless isMethodSubmissionSupported
# 1.2 syntax for description was `notes`
@model.description = (@model.description || @model.notes)
if @model.description
@model.description = @model.description.replace(/(?:\r\n|\r|\n)/g, '<br />')
@model.oauth = null
if @model.authorizations
for k, v of @model.authorizations
if k == "oauth2"
if @model.oauth == null
@model.oauth = {}
if @model.oauth.scopes is undefined
@model.oauth.scopes = []
for o in v
@model.oauth.scopes.push o
if Array.isArray @model.authorizations
for auths in @model.authorizations
for key, auth of auths
for a of @auths
auth = @auths[a]
if auth.type == 'oauth2'
@model.oauth = {}
@model.oauth.scopes = []
for k, v of auth.value.scopes
o = {scope: k, description: v}
@model.oauth.scopes.push o
else
for k, v of @model.authorizations
if k == "oauth2"
if @model.oauth == null
@model.oauth = {}
if @model.oauth.scopes is undefined
@model.oauth.scopes = []
for o in v
@model.oauth.scopes.push o
if typeof @model.responses isnt 'undefined'
@model.responseMessages = []
for code, value of @model.responses
schema = null
schemaObj = @model.responses[code].schema
if schemaObj and schemaObj['$ref']
schema = schemaObj['$ref']
if schema.indexOf('#/definitions/') is 0
schema = schema.substring('#/definitions/'.length)
@model.responseMessages.push {code: code, message: value.description, responseModel: schema }
if typeof @model.responseMessages is 'undefined'
@model.responseMessages = []
$(@el).html(Handlebars.templates.operation(@model))
@@ -66,6 +99,7 @@ class OperationView extends Backbone.View
responseSignatureView = new SignatureView({model: signatureModel, tagName: 'div'})
$('.model-signature', $(@el)).append responseSignatureView.render().el
else
@model.responseClassSignature = 'string'
$('.model-signature', $(@el)).html(@model.type)
contentTypeModel =
@@ -76,10 +110,18 @@ class OperationView extends Backbone.View
for param in @model.parameters
type = param.type || param.dataType
if type.toLowerCase() == 'file'
if typeof type is 'undefined'
schema = param.schema
if schema and schema['$ref']
ref = schema['$ref']
if ref.indexOf('#/definitions/') is 0
type = ref.substring('#/definitions/'.length)
else
type = ref
if type and type.toLowerCase() == 'file'
if !contentTypeModel.consumes
log "set content type "
contentTypeModel.consumes = 'multipart/form-data'
param.type = type
responseContentTypeView = new ResponseContentTypeView({model: contentTypeModel})
$('.response-content-type', $(@el)).append responseContentTypeView.render().el
@@ -131,7 +173,7 @@ class OperationView extends Backbone.View
for o in form.find("textarea")
if(o.value? && jQuery.trim(o.value).length > 0)
map["body"] = o.value
map[o.name] = o.value
for o in form.find("select")
val = this.getSelectedValue o
@@ -162,7 +204,7 @@ class OperationView extends Backbone.View
# add params
for param in @model.parameters
if param.paramType is 'form'
if map[param.name] != undefined
if param.type.toLowerCase() isnt 'file' and map[param.name] != undefined
bodyParam.append(param.name, map[param.name])
# headers in operation
@@ -171,16 +213,12 @@ class OperationView extends Backbone.View
if param.paramType is 'header'
headerParams[param.name] = map[param.name]
log headerParams
# add files
for el in form.find('input[type~="file"]')
if typeof el.files[0] isnt 'undefined'
bodyParam.append($(el).attr('name'), el.files[0])
params += 1
log(bodyParam)
@invocationUrl =
if @model.supportHeaderParams()
headerParams = @model.getHeaderParams(map)
@@ -188,8 +226,9 @@ class OperationView extends Backbone.View
else
@model.urlify(map, true)
$(".request_url", $(@el)).html "<pre>" + @invocationUrl + "</pre>"
$(".request_url", $(@el)).html("<pre></pre>")
$(".request_url pre", $(@el)).text(@invocationUrl);
obj =
type: @model.method
url: @invocationUrl
@@ -242,7 +281,7 @@ class OperationView extends Backbone.View
options = []
options.push opt.value for opt in select.options when opt.selected
if options.length > 0
options.join ","
options
else
null
@@ -336,19 +375,28 @@ class OperationView extends Backbone.View
headers = response.headers
# if server is nice, and sends content-type back, we can use it
contentType = if headers && headers["Content-Type"] then headers["Content-Type"].split(";")[0].trim() else null
contentType = null
if headers
contentType = headers["Content-Type"] or headers["content-type"]
if contentType
contentType = contentType.split(";")[0].trim()
if !content
code = $('<code />').text("no content")
pre = $('<pre class="json" />').append(code)
else if contentType is "application/json" || /\+json$/.test(contentType)
code = $('<code />').text(JSON.stringify(JSON.parse(content), null, " "))
json = null
try
json = JSON.stringify(JSON.parse(content), null, " ")
catch e
json = "can't parse JSON. Raw result:\n\n" + content
code = $('<code />').text(json)
pre = $('<pre class="json" />').append(code)
else if contentType is "application/xml" || /\+xml$/.test(contentType)
code = $('<code />').text(@formatXml(content))
pre = $('<pre class="xml" />').append(code)
else if contentType is "text/html"
code = $('<code />').html(content)
code = $('<code />').html(_.escape(content))
pre = $('<pre class="xml" />').append(code)
else if /^image\//.test(contentType)
pre = $('<img>').attr('src',url)
@@ -358,14 +406,18 @@ class OperationView extends Backbone.View
pre = $('<pre class="json" />').append(code)
response_body = pre
$(".request_url", $(@el)).html "<pre>" + url + "</pre>"
$(".request_url", $(@el)).html("<pre></pre>")
$(".request_url pre", $(@el)).text(url);
$(".response_code", $(@el)).html "<pre>" + response.status + "</pre>"
$(".response_body", $(@el)).html response_body
$(".response_headers", $(@el)).html "<pre>" + JSON.stringify(response.headers, null, " ").replace(/\n/g, "<br>") + "</pre>"
$(".response_headers", $(@el)).html "<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>"
$(".response", $(@el)).slideDown()
$(".response_hider", $(@el)).show()
$(".response_throbber", $(@el)).hide()
hljs.highlightBlock($('.response_body', $(@el))[0])
response_body_el = $('.response_body', $(@el))[0]
# only highlight the response if response is less than threshold, default state is highlight response
opts = @options.swaggerOptions
if opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold then response_body_el else hljs.highlightBlock(response_body_el)
toggleOperationContent: ->
elem = $('#' + Docs.escapeResourceName(@model.parentId) + "_" + @model.nickname + "_content")
@@ -9,8 +9,24 @@ class ParameterView extends Backbone.View
render: ->
type = @model.type || @model.dataType
if typeof type is 'undefined'
schema = @model.schema
if schema and schema['$ref']
ref = schema['$ref']
if ref.indexOf('#/definitions/') is 0
type = ref.substring('#/definitions/'.length)
else
type = ref
@model.type = type
@model.paramType = @model.in || @model.paramType
@model.isBody = true if @model.paramType == 'body'
@model.isFile = true if type.toLowerCase() == 'file'
@model.isFile = true if type and type.toLowerCase() == 'file'
@model.default = (@model.default || @model.defaultValue)
if@model.allowableValues
@model.isList = true
template = @template()
$(@el).html(template(@model))
+28 -4
View File
@@ -1,11 +1,16 @@
class ResourceView extends Backbone.View
initialize: ->
initialize: (opts={}) ->
@auths = opts.auths
if "" is @model.description
@model.description = null
render: ->
$(@el).html(Handlebars.templates.resource(@model))
methods = {}
if @model.description
@model.summary = @model.description
# Render each operation
for operation in @model.operationsArray
counter = 0
@@ -20,14 +25,33 @@ class ResourceView extends Backbone.View
operation.nickname = id
operation.parentId = @model.id
@addOperation operation
@
$('.toggleEndpointList', @el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'))
$('.collapseResource', @el).click(this.callDocs.bind(this, 'collapseOperationsForResource'))
$('.expandResource', @el).click(this.callDocs.bind(this, 'expandOperationsForResource'))
return @
addOperation: (operation) ->
operation.number = @number
# Render an operation and add it to operations li
operationView = new OperationView({model: operation, tagName: 'li', className: 'endpoint'})
operationView = new OperationView({
model: operation,
tagName: 'li',
className: 'endpoint',
swaggerOptions: @options.swaggerOptions,
auths: @auths
})
$('.endpoints', $(@el)).append operationView.render().el
@number++
@number++
#
# Generic Event handler (`Docs` is global)
#
callDocs: (fnName, e) ->
e.preventDefault()
Docs[fnName](e.currentTarget.getAttribute('data-id'))
+8 -5
View File
@@ -743,17 +743,20 @@
display: inline-block;
font-size: 0.9em;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header img {
display: block;
clear: none;
float: right;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit {
display: block;
clear: none;
float: left;
padding: 6px 8px;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber {
background-image: url('../images/throbber.gif');
width: 128px;
height: 16px;
display: block;
clear: none;
float: right;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type='text'].error {
outline: 2px solid black;
outline-color: #cc0000;
+54 -42
View File
@@ -16,49 +16,67 @@
<script src='lib/underscore-min.js' type='text/javascript'></script>
<script src='lib/backbone-min.js' type='text/javascript'></script>
<script src='lib/swagger.js' type='text/javascript'></script>
<script src='lib/swagger-client.js' type='text/javascript'></script>
<script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
<!-- enabling this will enable oauth2 implicit scope support -->
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
$(function () {
window.swaggerUi = new SwaggerUi({
url: "http://petstore.swagger.wordnik.com/api/api-docs",
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
onComplete: function(swaggerApi, swaggerUi){
log("Loaded SwaggerUI");
if(typeof initOAuth == "function") {
/*
initOAuth({
clientId: "your-client-id",
realm: "your-realms",
appName: "your-app-name"
});
*/
}
$('pre code').each(function(i, e) {
hljs.highlightBlock(e)
});
},
onFailure: function(data) {
log("Unable to Load SwaggerUI");
},
docExpansion: "none"
});
$('#input_apiKey').change(function() {
var key = $('#input_apiKey')[0].value;
log("key: " + key);
if(key && key.trim() != "") {
log("added key " + key);
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = url[1];
} else {
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
}
})
window.swaggerUi.load();
window.swaggerUi = new SwaggerUi({
url: url,
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
onComplete: function(swaggerApi, swaggerUi){
log("Loaded SwaggerUI");
if(typeof initOAuth == "function") {
/*
initOAuth({
clientId: "your-client-id",
realm: "your-realms",
appName: "your-app-name"
});
*/
}
$('pre code').each(function(i, e) {
hljs.highlightBlock(e)
});
},
onFailure: function(data) {
log("Unable to Load SwaggerUI");
},
docExpansion: "none",
sorter : "alpha"
});
function addApiKeyAuthorization() {
var key = $('#input_apiKey')[0].value;
log("key: " + key);
if(key && key.trim() != "") {
log("added key " + key);
window.authorizations.add("api_key", new ApiKeyAuthorization("api_key", key, "query"));
}
}
$('#input_apiKey').change(function() {
addApiKeyAuthorization();
});
// if you have an apiKey you would like to pre-populate on the page for demonstration purposes...
/*
var apiKey = "myApiKeyXXXX123456789";
$('#input_apiKey').val(apiKey);
addApiKeyAuthorization();
*/
window.swaggerUi.load();
});
</script>
</head>
@@ -66,14 +84,8 @@
<body class="swagger-section">
<div id='header'>
<div class="swagger-ui-wrap">
<a id="logo" href="http://swagger.wordnik.com">swagger</a>
<a id="logo" href="http://swagger.io">swagger</a>
<form id='api_selector'>
<div class='input icon-btn'>
<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis">
</div>
<div class='input icon-btn'>
<img id="show-wordnik-dev-icon" src="images/wordnik_api.png" title="Show Wordnik Developer Apis">
</div>
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
<div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
<div class='input'><a id="explore" href="#">Explore</a></div>
+1 -5
View File
@@ -66,7 +66,7 @@ log = function(){
log.history = log.history || [];
log.history.push(arguments);
if(this.console){
console.log( Array.prototype.slice.call(arguments) );
console.log( Array.prototype.slice.call(arguments)[0] );
}
};
@@ -91,7 +91,6 @@ var Docs = {
switch (fragments.length) {
case 1:
// Expand all operations for the resource and scroll to it
log('shebang resource:' + fragments[0]);
var dom_id = 'resource_' + fragments[0];
Docs.expandEndpointListForResource(fragments[0]);
@@ -99,7 +98,6 @@ var Docs = {
break;
case 2:
// Refer to the endpoint DOM element, e.g. #words_get_search
log('shebang endpoint: ' + fragments.join('_'));
// Expand Resource
Docs.expandEndpointListForResource(fragments[0]);
@@ -109,8 +107,6 @@ var Docs = {
var li_dom_id = fragments.join('_');
var li_content_dom_id = li_dom_id + "_content";
log("li_dom_id " + li_dom_id);
log("li_content_dom_id " + li_content_dom_id);
Docs.expandOperation($('#'+li_content_dom_id));
$('#'+li_dom_id).slideto({highlight: false});
+1 -1
View File
@@ -80,4 +80,4 @@
padding-top: 10px;
}
}
}
+8 -5
View File
@@ -671,17 +671,20 @@
display: inline-block;
font-size: 0.9em;
}
img {
display: block;
clear: none;
float: right;
}
input.submit {
display: block;
clear: none;
float: left;
padding: 6px 8px;
}
span.response_throbber {
background-image: url('../images/throbber.gif');
width: 128px;
height: 16px;
display: block;
clear: none;
float: right;
}
}
form {
input[type='text'].error {
@@ -0,0 +1,9 @@
<div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div>
<div class='auth_container' id='apikey_container'>
<div class='key_input_container'>
<div class='auth_label'>{{keyName}}</div>
<input placeholder="api_key" class="auth_input" id="input_apiKey_entry" name="apiKey" type="text"/>
<div class='auth_submit'><a class='auth_submit_button' id="apply_api_key" href="#">apply</a></div>
</div>
</div>
@@ -0,0 +1,11 @@
<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>
<div class='auth_container' id='basic_auth_container'>
<div class='key_input_container'>
<div class="auth_label">Username</div>
<input placeholder="username" class="auth_input" id="input_username" name="username" type="text"/>
<div class="auth_label">Password</div>
<input placeholder="password" class="auth_input" id="input_password" name="password" type="password"/>
<div class='auth_submit'><a class='auth_submit_button' id="apply_basic_auth" href="#">apply</a></div>
</div>
</div>
+18 -14
View File
@@ -1,22 +1,26 @@
<div class='info' id='api_info'>
{{#if info}}
<div class="info_title">{{info.title}}</div>
<div class="info_description">{{{info.description}}}</div>
{{#if info.termsOfServiceUrl}}<div class="info_tos"><a href="{{info.termsOfServiceUrl}}">Terms of service</a></div>{{/if}}
{{#if info.contact}}<div class='info_contact'><a href="mailto:{{info.contact}}">Contact the developer</a></div>{{/if}}
{{#if info.license}}<div class='info_license'><a href='{{info.licenseUrl}}'>{{info.license}}</a></div>{{/if}}
<div class="info_title">{{info.title}}</div>
<div class="info_description">{{{info.description}}}</div>
{{#if info.termsOfServiceUrl}}<div class="info_tos"><a href="{{info.termsOfServiceUrl}}">Terms of service</a></div>{{/if}}
{{#if info.contact}}<div class='info_contact'><a href="mailto:{{info.contact.name}}">Contact the developer</a></div>{{/if}}
{{#if info.license}}<div class='info_license'><a href='{{info.license.url}}'>{{info.license.name}}</a></div>{{/if}}
{{/if}}
</div>
<div class='container' id='resources_container'>
<ul id='resources'>
</ul>
<ul id='resources'></ul>
<div class="footer">
<br>
<br>
<h4 style="color: #999">[ <span style="font-variant: small-caps">base url</span>: {{basePath}}
{{#if apiVersion}}
, <span style="font-variant: small-caps">api version</span>: {{apiVersion}}
{{/if}}]</h4>
<div class="footer">
<br>
<br>
<h4 style="color: #999">[ <span style="font-variant: small-caps">base url</span>: {{basePath}}
{{#if info.version}}
, <span style="font-variant: small-caps">api version</span>: {{info.version}}
{{/if}}]
{{#if validatorUrl}}
<span style="float:right"><a href="{{validatorUrl}}/debug?url={{url}}"><img id="validator" src="{{validatorUrl}}?url={{url}}"></a>
</span>
{{/if}}
</h4>
</div>
</div>
+7 -4
View File
@@ -7,7 +7,7 @@
<a href='#!/{{parentId}}/{{nickname}}' class="toggleOperation">{{method}}</a>
</span>
<span class='path'>
<a href='#!/{{parentId}}/{{nickname}}' class="toggleOperation">{{path}}</a>
<a href='#!/{{parentId}}/{{nickname}}' class="toggleOperation {{#if deprecated}}deprecated{{/if}}">{{path}}</a>
</span>
</h3>
<ul class='options'>
@@ -17,9 +17,12 @@
</ul>
</div>
<div class='content' id='{{parentId}}_{{nickname}}_content' style='display:none'>
{{#if notes}}
{{#if deprecated}}
<h4>Warning: Deprecated</h4>
{{/if}}
{{#if description}}
<h4>Implementation Notes</h4>
<p>{{{notes}}}</p>
<p>{{{description}}}</p>
{{/if}}
{{#oauth}}
<div class="auth">
@@ -83,7 +86,7 @@
<div class='sandbox_header'>
<input class='submit' name='commit' type='button' value='Try it out!' />
<a href='#' class='response_hider' style='display:none'>Hide Response</a>
<img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />
<span class='response_throbber' style='display:none'></span>
</div>
{{/if}}
</form>
+10 -5
View File
@@ -6,8 +6,8 @@
<input type="file" name='{{name}}'/>
<div class="parameter-content-type" />
{{else}}
{{#if defaultValue}}
<textarea class='body-textarea' name='{{name}}'>{{defaultValue}}</textarea>
{{#if default}}
<textarea class='body-textarea' name='{{name}}'>{{default}}</textarea>
{{else}}
<textarea class='body-textarea' name='{{name}}'></textarea>
<br />
@@ -15,10 +15,15 @@
{{/if}}
{{/if}}
{{else}}
{{#if defaultValue}}
<input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value='{{defaultValue}}'/>
{{#if isFile}}
<input type="file" name='{{name}}'/>
<div class="parameter-content-type" />
{{else}}
<input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value=''/>
{{#if default}}
<input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value='{{default}}'/>
{{else}}
<input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value=''/>
{{/if}}
{{/if}}
{{/if}}
+1 -1
View File
@@ -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}}
+3 -3
View File
@@ -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}}
@@ -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}}
+4 -4
View File
@@ -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 />
@@ -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}}
+6 -7
View File
@@ -1,25 +1,24 @@
<div class='heading'>
<h2>
<a href='#!/{{id}}' onclick="Docs.toggleEndpointListForResource('{{id}}');">{{name}}</a> {{#description}} : {{/description}}{{{description}}}
<a href='#!/{{id}}' class="toggleEndpointList" data-id="{{id}}">{{name}}</a> {{#summary}} : {{/summary}}{{{summary}}}
</h2>
<ul class='options'>
<li>
<a href='#!/{{id}}' id='endpointListTogger_{{id}}'
onclick="Docs.toggleEndpointListForResource('{{id}}');">Show/Hide</a>
<a href='#!/{{id}}' id='endpointListTogger_{{id}}' class="toggleEndpointList" data-id="{{id}}">Show/Hide</a>
</li>
<li>
<a href='#' onclick="Docs.collapseOperationsForResource('{{id}}'); return false;">
<a href='#' class="collapseResource" data-id="{{id}}">
List Operations
</a>
</li>
<li>
<a href='#' onclick="Docs.expandOperationsForResource('{{id}}'); return false;">
<a href='#' class="expandResource" data-id={{id}}>
Expand Operations
</a>
</li>
<li>
{{#url}}<li>
<a href='{{url}}'>Raw</a>
</li>
</li>{{/url}}
</ul>
</div>
<ul class='endpoints' id='{{id}}_endpoint_list' style='display:none'>
+9 -9
View File
@@ -1,18 +1,18 @@
<div>
<ul class="signature-nav">
<li><a class="description-link" href="#">Model</a></li>
<li><a class="snippet-link" href="#">Model Schema</a></li>
<li><a class="description-link" href="#">Model</a></li>
<li><a class="snippet-link" href="#">Model Schema</a></li>
</ul>
<div>
<div class="signature-container">
<div class="description">
{{{signature}}}
</div>
<div class="description">
{{{signature}}}
</div>
<div class="snippet">
<pre><code>{{sampleJSON}}</code></pre>
<small class="notice"></small>
</div>
<div class="snippet">
<pre><code>{{sampleJSON}}</code></pre>
<small class="notice"></small>
</div>
</div>