Compare commits

...
134 Commits
Author SHA1 Message Date
Ron c7439c7913 Merge pull request #3134 from ZuzannaSt/2.x
Add translations for each Authorize tag in 2.x
2017-05-30 15:47:54 -07:00
Zuzanna Stolińska bfe55894e7 Add translations for each Authorize tag 2017-05-26 08:52:48 +02:00
Ron 7e72281527 Merge pull request #2883 from aline-matos/patch-1
Create pt-br.js
2017-04-07 15:05:29 -07:00
Aline Matos 5eebb4ce08 Create pt-br.js
Translation to portuguese of Brazil
2017-04-07 17:06:19 -03:00
Ron 1a11eb912f Merge pull request #2781 from raupachz/2.x
added language support German
2017-03-24 08:16:04 -07:00
Björn Raupach cddb022f40 added language support German 2017-03-24 14:00:58 +01:00
Tony Tam ccf7f03dab Merge pull request #2677 from banders/param-descriptions-cutoff
Prevent long words in parameter descriptions from stretching table
2017-03-01 20:34:12 -05:00
Ron 61d5e988f4 Merge pull request #2701 from jessemcdowell-AI/patch-1
Point 2.2.10 tag url to correct tag
2017-02-27 10:36:52 -08:00
Jesse McDowell 91381ffcfb Point 2.2.10 tag url to correct tag 2017-02-27 10:23:56 -08:00
Tony Tam 0beaf61f94 Merge pull request #2691 from hochzehn/docker-exitable
Attach nginx process to PID 1 so the container can be stopped properly.
2017-02-23 21:29:06 -08:00
janpapenbrock b2e313f3e3 Attach nginx process to PID 1 so the container can be stopped properly. 2017-02-23 17:55:16 +01:00
Tony Tam 6f1b09e7ef Merge pull request #2685 from scottohara/json-editor-v0.7.28
Update jsoneditor from v0.7.22 to v0.7.28 (Fixes #2659)
2017-02-21 17:08:27 -08:00
Scott O'Hara 911b9e0057 Update jsoneditor from v0.7.22 to v0.7.28 (Fixes #2659) 2017-02-22 11:58:01 +11:00
Tony Tam 3b4cbeb6c0 Merge pull request #2684 from stephendonner/typos
Minor typo fixes
2017-02-21 16:53:32 -08:00
Stephen Donner 0993e7818a Minor typo fixes
I didn't go hog-wild; let me know if I should grab some other occurrences of "javascript" + "css" etc. - I only got the more-obvious (to me) uses, in a read-through.
2017-02-21 16:50:26 -08:00
Brock Anderson 5da72aaa4d changes to prevent the parameter description column from expanding (e.g. due to very long words in the content that cannot wrap). the new behaviour is that the long content just spills into the adjacent column. 2017-02-17 16:23:20 -08:00
Tony Tam 38f74164a7 Merge pull request #2612 from oprince/master
Swagger-ui not displayed when parameter schema is missing
2017-01-23 15:51:49 -08:00
Orit Prince 27b1eb971d Fix: Swagger-ui not displayed when parameter schema is missing 2017-01-15 09:35:05 +02:00
Tony Tam a83a1ce5f2 Update README.md 2017-01-13 09:34:03 -08:00
Tony Tam 3e585d6977 rebuilt 2017-01-12 12:00:02 -08:00
Tony Tam a676aba23d updated swagger-js version 2017-01-12 11:59:57 -08:00
Orit Prince d8a83c6baf Fix: Swagger-ui not displayed when parameter schema is missing 2017-01-12 11:39:30 +02:00
Ron c9d2a70341 Update README.md 2017-01-11 11:51:30 -08:00
Tony Tam 2972c3c9b8 Merge pull request #2600 from eikonomega/patch-1
Fix grammar error in readme.md
2017-01-05 12:04:53 -08:00
Michael Dunn 0e2272b1af Fix grammar error in readme.md
There is a small verb tense error that needs fixing.

Cheers!
2017-01-05 14:56:12 -05:00
Tony Tam 64dc3060b3 updated versions 2017-01-05 00:57:09 -08:00
Tony Tam ae4961ded9 updated versions 2017-01-05 00:55:17 -08:00
Tony Tam a7aea6784a applied swagger-js patch 2017-01-05 00:43:18 -08:00
Tony Tam 6e7f2effec Merge branch 'issue-2593' 2017-01-04 17:45:18 -08:00
Tony Tam 35d8dc101b bumped version 2017-01-04 17:44:35 -08:00
Tony Tam 8b877cafc9 Merge pull request #2597 from swagger-api/issue-2593
removed `extend`, which made the operation object unreachable
2017-01-04 17:34:36 -08:00
Tony Tam d073c0a908 removed extend, which made the operation object unreachable 2017-01-04 17:30:14 -08:00
Tony Tam 90021ad100 Merge pull request #2567 from monkeyFeathers/swagger-ui#2561
Replace resource ID special characters to fix path expansion issue
2017-01-04 16:17:49 -08:00
Javier Quiroz 673613129f Replace resource ID special characters to fix path expansion issue 2017-01-03 10:09:56 -08:00
Tony Tam 58460145f3 empty string check 2017-01-02 20:42:55 -08:00
Tony Tam d9e81fdb4c fixed tagging 2017-01-02 20:31:37 -08:00
Tony Tam 10ad489439 updated script 2017-01-02 15:05:44 -07:00
Tony Tam 4fe23ac2fe rebuilt 2017-01-02 14:59:10 -07:00
Tony Tam 0f7aa4518c rebuilt 2017-01-02 14:58:06 -07:00
Tony Tam 6763652f65 updated script 2017-01-02 14:54:43 -07:00
Tony Tam 0d41d7d893 updated script 2017-01-02 14:48:46 -07:00
Tony Tam fdbdf177fe updated script 2017-01-02 14:42:34 -07:00
Tony Tam 02da09efa2 updated readme 2017-01-02 14:37:53 -07:00
Tony Tam 5ca6c8972e Merge pull request #2592 from swagger-api/issue-2591
Updated swagger-js
2017-01-02 14:25:30 -07:00
Tony Tam 921f76e7ee updated readme 2017-01-02 14:23:59 -07:00
Tony Tam daf225ee0a added docker to travis 2017-01-02 14:23:55 -07:00
Tony Tam cb5f9b643d added docker push 2017-01-02 14:09:21 -07:00
Tony Tam b055fb176b rebuilt 2017-01-02 14:04:39 -07:00
Tony Tam 68cd5d0d1b updated with master 2017-01-02 14:03:25 -07:00
Tony Tam 38750aec58 Merge pull request #2424 from dolmen/feature/responseHooks
Feature: add responseHooks option for callbacks on responses
2017-01-02 13:57:12 -07:00
Tony Tam c0ab1dd4db Merge branch 'Pchelolo-filename' 2017-01-02 13:54:29 -07:00
Tony Tam ed6a330d5d merged 2017-01-02 13:54:22 -07:00
Tony Tam e4c2236a68 Merge pull request #2474 from simo9000/master
Added meta tag to force IE11 to use edge document mode
2017-01-02 13:52:19 -07:00
Tony Tam 6a753a4bc8 Merge pull request #2558 from sreeshas/topic/sreeshas/fix_escape_resource_name
Fix escaping resource name.
2017-01-02 13:50:54 -07:00
Tony Tam 2905068997 Merge pull request #2553 from IlyaPomaskin/patch-1
Resizable container for "Model Schema"
2017-01-02 13:49:17 -07:00
Tony Tam f386054a53 Merge pull request #2568 from tobigun/showOperationIds
Add option "showOperationIds"
2017-01-02 13:46:39 -07:00
Tony Tam 1e19281a7b Merge branch 'turkeylurkey-2460-requiredFile' 2017-01-02 13:45:46 -07:00
Tony Tam f8db172158 merged 2017-01-02 13:45:37 -07:00
Tony Tam 78b3678f74 Merge pull request #2587 from moses-palmer/feature-token-as-vendor-property
OAuth2 access token name as vendor property
2017-01-02 13:43:32 -07:00
Tony Tam fa5de88f5d Merge pull request #2581 from ritesh-garg/issue-2577
Issue 2577
2017-01-02 13:42:35 -07:00
Tony Tam 6bfec976a0 updated version 2017-01-02 13:40:22 -07:00
Tony Tam 353c8a39c5 updated swagger-js, rebuilt 2017-01-02 11:08:45 -07:00
Moses Palmér 4f467b4073 Prefer tokenName as vendor extension in auth view 2016-12-29 10:06:39 +01:00
Moses Palmér 43760ec29f Prefer tokenName as vendor extension 2016-12-29 10:06:39 +01:00
Moses Palmér 7ca8cdeffb Read token name using function in auth view 2016-12-29 10:06:39 +01:00
Moses Palmér fd3eb4f65a Read token name using function 2016-12-29 10:06:39 +01:00
Ritesh Garg 1142f01da1 Adding the check for model.definition 2016-12-23 20:02:29 -05:00
Ritesh Garg d9e14e1e7d Commenting getName function as names are now determined beforehand and the prefix part is exposed as a separate function 2016-12-23 12:16:12 -05:00
Ritesh Garg af068f787a Merge branch 'issue-2577' of https://github.com/ritesh-garg/swagger-ui into issue-2577 2016-12-23 11:52:20 -05:00
Ritesh Garg 8b01247192 Change to fix the naming for elements for an array from the element name(XmlElement) defined with array rather than determining it from the element model definition(XmlRootElement) 2016-12-23 11:48:11 -05:00
Ritesh Garg 8155330ae3 Change to set name for array elements from items.xml.name if it is set. Another issue after fixing this was for complex objects, that the name for element (from xmlelement annotation) was getting overridden by ref name (from xmlelementwrapper annotation) 2016-12-22 14:00:38 -05:00
Paul Gooderham 37d158bdc1 Issue #2460 Use only one class= in param_required isFile 2016-12-21 17:32:30 -05:00
Tobias Gunkel 26d8aced96 Add option "showOperationIds" 2016-12-18 23:20:13 +01:00
Sreenidhi Sreesha 878dad251d Fix escaping resource name. 2016-12-08 11:55:40 -08:00
Ron 2ba1c100ae Merge pull request #2397 from MugeSo/implement-oauth2-password-flow
Implement OAuth2 password flow
2016-12-06 08:52:16 -08:00
Tony Tam 0b7c6f048c Merge pull request #2557 from xor-xor/missing-images
[CSS] Remove refs to images that don't exist anymore.
2016-12-05 08:44:19 -08:00
Tomasz Mieszkowski 3787de8038 [CSS] Remove refs to images that don't exist anymore. 2016-12-05 15:49:59 +01:00
Ilya Pomaskin 0f12d5d45c Resizable container for "Model Schema" 2016-12-02 19:15:50 +03:00
Tony Tam 4e234cc3c7 Merge pull request #2549 from wangchunyang/master
Upgrade to alpine:3.4 and fix issues
2016-12-01 17:46:03 -08:00
Chunyang Wang 7f0de6312e Use absolute path for root directory 2016-12-01 16:57:34 +08:00
Chunyang Wang f8e5e57540 create required directory to store nginx pid 2016-12-01 16:55:59 +08:00
Tony Tam bfc6dbd50f Merge pull request #2540 from whoan/patch-1
Enable CORS by default in the nginx file
2016-11-28 22:12:22 -08:00
Juan Eugenio Abadie 842f477620 Enable CORS by default in the nginx file
Enable CORS in the nginx file used by Docker.
2016-11-29 01:39:43 -03:00
Tony Tam a0cce8e746 Merge pull request #2532 from stephaneLeroy/master
Fix jsonEditor parameters when an operation is on multiple tags
2016-11-28 12:51:06 -08:00
Tony Tam 7e1a02be83 Merge pull request #2534 from joelittlejohn/test-fragment
On complete, ignore fragments that don't contain useful information
2016-11-28 09:40:22 -08:00
Joe Littlejohn 90f641059f On complete, ignore fragments that don't contain useful information
Auth providers like Facebook and Google tend to add garbage fragments
onto OAuth 2.0 redirect URIs to stop malicious fragments being
maintained through the flow. This change ensures that those fragments
aren't mistakenly used to attempt to complete login.

If the fragment contains a code, token or error, it is assumed to be the
correct place to find data provided by the auth provider.
2016-11-27 17:16:10 +00:00
Stéphane Leroy 5def48cf99 Fix jsonEditor parameters when an operation is on multiple tags 2016-11-25 18:20:15 +01:00
TANAKA Koichi 3494d44d3f Implement OAuth2 client authentication for password and application flow 2016-11-24 17:30:52 +09:00
TANAKA Koichi f2a1caa379 Add validation for oauth password flow 2016-11-24 17:04:41 +09:00
TANAKA Koichi 7cdf83a932 Implement OAuth2 password flow 2016-11-24 17:04:41 +09:00
Tony Tam 776325b993 updated version 2016-11-23 23:45:33 -08:00
Tony Tam c04b81c51e Merge pull request #2529 from swagger-api/issue-2528
removed blob special logic for strings
2016-11-23 23:44:13 -08:00
Tony Tam 3c0fac249f removed blob special logic for strings 2016-11-23 23:40:03 -08:00
Tony Tam 23515834e8 Merge pull request #2527 from swagger-api/issue-2497
only pass selected scopes
2016-11-23 20:59:56 -08:00
Tony Tam d963302c72 only pass selected scopes 2016-11-23 20:54:54 -08:00
Tony Tam 9e5c4b2efe rebuilt 2016-11-23 20:20:15 -08:00
Tony Tam 99b351835e Merge branch 'thinkWhere-minify-dist-tasks' 2016-11-23 20:20:02 -08:00
Tony Tam 770fcc19c0 Merge branch 'minify-dist-tasks' of https://github.com/thinkWhere/swagger-ui into thinkWhere-minify-dist-tasks 2016-11-23 20:17:00 -08:00
Tony Tam 0dfc59fc21 Merge pull request #2489 from joelittlejohn/patch-1
Avoid using Facebook garbage fragment to complete login
2016-11-23 20:16:01 -08:00
Tony Tam 1d9365d407 Merge branch 'Vayu-fix_model_rendering' 2016-11-23 20:12:47 -08:00
Tony Tam 4b63c7009f Merge branch 'master' of github.com:swagger-api/swagger-ui 2016-11-23 20:12:40 -08:00
Tony Tam 941b3feb3d rebuilt 2016-11-23 20:12:32 -08:00
Tony Tam ee3556490a Merge branch 'fix_model_rendering' of https://github.com/Vayu/swagger-ui into Vayu-fix_model_rendering 2016-11-23 20:10:21 -08:00
Tony Tam 95553a597b Merge pull request #2514 from tcaesvk/master
fix authorization code grant to work
2016-11-23 20:00:13 -08:00
Tony Tam 49a1169878 merged 2016-11-23 16:47:04 -08:00
Tony Tam 83468e64a2 updated swagger-js version 2016-11-23 16:46:16 -08:00
Tony Tam 20aa9643d3 Merge branch 'issue-2427' 2016-11-23 16:45:37 -08:00
Tony Tam 7e426ac0cd preservation, proper parsing of examples 2016-11-23 16:30:49 -08:00
Tony Tam 5d75d7d7af rebuilt 2016-11-23 12:03:53 -08:00
Tony Tam 65d81745ed blob handling, render download link for application/octet-stream 2016-11-23 12:00:13 -08:00
Tony Tam 30f0848ac2 Merge pull request #2521 from swagger-api/issue-2483
fixed scopes issue
2016-11-23 08:26:16 -08:00
Tony Tam da7ec89471 rebuilt 2016-11-22 19:46:52 -08:00
Tony Tam 4885a8abdb updated version 2016-11-22 19:46:48 -08:00
Tony Tam 47ab2a32c0 added sanitization of scopes per #2483 2016-11-22 19:46:42 -08:00
김 재석 bc494dac56 fix authorization code grant to work 2016-11-22 11:56:45 +09:00
Tony Tam 46fbae2f4f Merge pull request #2513 from matrix-org/rav/fix_sourcemaps
Use gulp-sourcemaps to generate a sourcemap
2016-11-21 16:30:08 -08:00
Richard van der Hoff edeba22a2a Use gulp-sourcemaps to generate a sourcemap
Chrome gets very confused by the sourceMappingURL from swagger-client.js. Use
gulp-sourcemaps to generate our own sourcemap which it is happier with (and
means that the other bits of swagger-ui.js are also correctly sourcemapped).
2016-11-21 19:00:22 +00:00
Tony Tam 2cd11efa9d Merge pull request #2506 from swagger-api/issue-2499
Remove globals, regression in v2.2.6
2016-11-18 09:05:13 -08:00
Iain Hunter 5f9fd934af Reorder vars as per review request 2016-11-17 15:58:55 +00:00
Valery Yundin 3bd42590cc Extend list of allowed tags to fix Model rendering. Fixes 2504 2016-11-17 16:50:45 +01:00
Tony Tam 81e897a07a checks for window 2016-11-14 11:34:50 -08:00
Tony Tam a63dc0c51b use model variables instead of window 2016-11-14 11:00:04 -08:00
Joe Littlejohn 1b18429eca Avoid using Facebook garbage fragment to complete login
Facebook adds a nonsense fragment to all redirect URIs when returning a code. This stops a fragments being surreptitiously passed through the authorization flow.

See http://stackoverflow.com/questions/7131909/facebook-callback-appends-to-return-url

Before this change, the presence of Facebook's garbage fragment would break the Swagger UI complete page, as having any fragment value at all will cause the complete page to ignore the query string. This change avoids using the fragment if it looks to be useless.
2016-11-07 14:58:13 +00:00
Tony Tam bf60526e63 Merge pull request #2487 from spapad/el-lang-fix
Fix typo in el translation; Supply el.js to dist/
2016-11-04 12:29:10 -07:00
Stavros Papadakis 7166ba7802 Fix typo in el translation; Supply el.js to dist/ 2016-11-04 15:17:20 +02:00
Iain Hunter 5f2beb16a9 Add missing semi-colon 2016-11-04 11:05:55 +00:00
Iain Hunter 085d84e16e Add tasks to gulpfile to minify all CSS and JS libs when building dist 2016-11-04 10:48:42 +00:00
Tony Tam 1f2a5d7dd7 Merge pull request #2481 from dsem/fix-tags-in-README
Fix tag names in README
2016-11-03 11:23:11 -04:00
Dylan Semler fede96b7b2 Fix tag names in README
The repo's tag names don't start with a `.`.
2016-11-03 07:33:15 -04:00
Petr Pchelko 1dc709446a Use filename from content-disposition in a download link 2016-11-01 14:00:07 -07:00
morrissh 60cf928e51 Added meta tag to force IE11 to use edge document mode 2016-10-31 08:28:44 -07:00
Tony Tam 3fb29ecc61 Merge pull request #2464 from spapad/el-lang
Initial Greek language translation
2016-10-25 07:22:10 -07:00
Stavros Papadakis d9b3db4399 Initial Greek language translation 2016-10-25 15:13:02 +03:00
Olivier Mengué d2c9189a7c Feature: add responseHooks option for callbacks on responses
Add a responseHooks option that allows the user to process the response
of an API call.
The responseHooks option is an object where key is an operationId and
value is a function that receives the XHR response object and the
OperationView object.

Use case: process authentication requests done with the "Try out!"
button to inject apiKey in the AuthView and the router on success.
2016-09-30 12:03:34 +02:00
68 changed files with 2107 additions and 12055 deletions
+14
View File
@@ -1,5 +1,7 @@
sudo: false
language: node_js
services:
- docker
node_js:
- '4.2'
install:
@@ -7,3 +9,15 @@ install:
- sh -e /etc/init.d/xvfb start
- npm i -g jshint
- npm install
env:
- DOCKER_IMAGE_NAME=swaggerapi/swagger-ui
after_success:
- if [ $DOCKER_HUB_USERNAME ]; then
docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD;
docker build -t $DOCKER_IMAGE_NAME .;
if [ "$TRAVIS_TAG" != "master" && -z "$TRAVIS_TAG"]; then
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$TRAVIS_TAG;
fi;
docker push $DOCKER_IMAGE_NAME;
fi;
+3 -2
View File
@@ -1,12 +1,13 @@
FROM alpine:3.3
FROM alpine:3.4
MAINTAINER Roman Tarnavski
RUN apk add --update nginx
RUN mkdir -p /run/nginx
COPY nginx.conf /etc/nginx/
ADD ./dist/ /usr/share/nginx/html
EXPOSE 8080
CMD nginx -g 'daemon off;'
CMD exec nginx -g 'daemon off;'
+19 -9
View File
@@ -8,7 +8,7 @@
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
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?
@@ -24,12 +24,14 @@ The OpenAPI Specification has undergone 4 revisions since initial creation in 20
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
------------------ | ------------ | -------------------------- | ----- | ------
2.2.6 | 2016-10-14 | 1.1, 1.2, 2.0 | [tag v.2.2.6](https://github.com/swagger-api/swagger-ui/tree/v2.2.6) |
2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v.2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) |
2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) |
2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) |
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) |
**Note:** Support for versions older than 1.2 is limited and you may experience issues we cannot improve and support. We highly recommend that you upgrade your spec to the latest version.
## How to Use It
### Download
@@ -41,7 +43,8 @@ Swagger UI works in all evergreen desktop browsers (Chrome, Safari, Firefox). In
### Build
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:
### Windows Users: Please install [Python](https://www.python.org/downloads/windows/) before follow below guidelines for node-gyp rebuild to run.
* Ensure you have `nodejs` 4.0 or greater installed, and on your classpath.
* Windows Users: Please install [Python](https://www.python.org/downloads/windows/) before following the guidelines below for node-gyp rebuild to run.
1. `npm install`
2. `npm run build`
@@ -50,9 +53,16 @@ You can rebuild swagger-ui on your own to tweak it or just so you can say you di
### Development
Use `npm run serve` to make a new build, watch for changes, and serve the result at http://localhost:8080/.
### Running with Docker
```
docker pull swaggerapi/swagger-ui
docker run -p 80:8080 swaggerapi/swagger-ui
```
### Build using Docker
To build swagger-ui using a docker container:
To build swagger-ui using a Docker container:
```
docker build -t swagger-ui-builder .
@@ -62,7 +72,7 @@ docker run -p 80:8080 swagger-ui-builder
This will start Swagger UI at `http://localhost`.
### Use
Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.io/v2/swagger.json) service and show its APIs. You can enter your own server url and click explore to view the API.
Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.io/v2/swagger.json) service and show its APIs. You can enter your own server url and click 'Explore' to view the API.
### Customize
You may choose to customize Swagger UI for your organization. Here is an overview of what's in its various directories:
@@ -142,9 +152,9 @@ swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorizat
Note! You can pass multiple header params on a single request, just use unique names for them (`key` is used in the above example).
### Localization and translation
The localization files are in the [lang](/lang) directory. Note that language files and translator is not included in SwaggerUI by default. You need to add them manually.
The localization files are in the [lang](/lang) directory. Note that language files and translator are not included in SwaggerUI by default. You need to add them manually.
To enable translation you should append next two lines in your Swagger's index.html (or another entry point you use)
To enable translation, you should append the next two lines in your Swagger's index.html (or another entry point you use)
```html
<script src='lang/translator.js' type='text/javascript'></script>
<script src='lang/en.js' type='text/javascript'></script>
@@ -169,7 +179,7 @@ At this moment only inner html, title-attribute and value-attribute are going to
## CORS Support
### OR: How to deal with "Can't read from server. It may not have the appropriate access-control-origin settings."
CORS is a technique to prevent websites from doing bad things with your personal data. Most browsers + javascript toolkits not only support CORS but enforce it, which has implications for your API server which supports Swagger.
CORS is a technique to prevent websites from doing bad things with your personal data. Most browsers + JavaScript toolkits not only support CORS but enforce it, which has implications for your API server which supports Swagger.
You can read about CORS here: http://www.w3.org/TR/cors.
+23 -23
View File
@@ -1,24 +1,24 @@
{
"name": "swagger-api/swagger-ui",
"description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"keywords": [
"Swagger",
"OpenAPI",
"specification",
"documentation",
"API",
"UI"
],
"homepage": "http://swagger.io",
"license": "Apache-2.0",
"authors": [
{
"name": "Tony Tam",
"email": "fehguy@gmail.com"
},
{
"name": "Mohsen Azimi",
"email": "me@azimi.me"
}
]
}
"name": "swagger-api/swagger-ui",
"description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"keywords": [
"Swagger",
"OpenAPI",
"specification",
"documentation",
"API",
"UI"
],
"homepage": "http://swagger.io",
"license": "Apache-2.0",
"authors": [
{
"name": "Tony Tam",
"email": "fehguy@gmail.com"
},
{
"name": "Mohsen Azimi",
"email": "me@azimi.me"
}
]
}
+1 -1367
View File
File diff suppressed because one or more lines are too long
+1 -125
View File
@@ -1,125 +1 @@
/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-collapse:collapse;border-spacing:0}
+1 -1494
View File
File diff suppressed because one or more lines are too long
+1 -250
View File
@@ -1,250 +1 @@
.swagger-section #header a#logo {
font-size: 1.5em;
font-weight: bold;
text-decoration: none;
background: transparent url(../images/logo.png) no-repeat left center;
padding: 20px 0 20px 40px;
}
#text-head {
font-size: 80px;
font-family: 'Roboto', sans-serif;
color: #ffffff;
float: right;
margin-right: 20%;
}
.navbar-fixed-top .navbar-nav {
height: auto;
}
.navbar-fixed-top .navbar-brand {
height: auto;
}
.navbar-header {
height: auto;
}
.navbar-inverse {
background-color: #000;
border-color: #000;
}
#navbar-brand {
margin-left: 20%;
}
.navtext {
font-size: 10px;
}
.h1,
h1 {
font-size: 60px;
}
.navbar-default .navbar-header .navbar-brand {
color: #a2dfee;
}
/* tag titles */
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a {
color: #393939;
font-family: 'Arvo', serif;
font-size: 1.5em;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover {
color: black;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 {
color: #525252;
padding-left: 0px;
display: block;
clear: none;
float: left;
font-family: 'Arvo', serif;
font-weight: bold;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #0A0A0A;
}
.container1 {
width: 1500px;
margin: auto;
margin-top: 0;
background-image: url('../images/shield.png');
background-repeat: no-repeat;
background-position: -40px -20px;
margin-bottom: 210px;
}
.container-inner {
width: 1200px;
margin: auto;
background-color: rgba(223, 227, 228, 0.75);
padding-bottom: 40px;
padding-top: 40px;
border-radius: 15px;
}
.header-content {
padding: 0;
width: 1000px;
}
.title1 {
font-size: 80px;
font-family: 'Vollkorn', serif;
color: #404040;
text-align: center;
padding-top: 40px;
padding-bottom: 100px;
}
#icon {
margin-top: -18px;
}
.subtext {
font-size: 25px;
font-style: italic;
color: #08b;
text-align: right;
padding-right: 250px;
}
.bg-primary {
background-color: #00468b;
}
.navbar-default .nav > li > a,
.navbar-default .nav > li > a:focus {
color: #08b;
}
.navbar-default .nav > li > a,
.navbar-default .nav > li > a:hover {
color: #08b;
}
.navbar-default .nav > li > a,
.navbar-default .nav > li > a:focus:hover {
color: #08b;
}
.text-faded {
font-size: 25px;
font-family: 'Vollkorn', serif;
}
.section-heading {
font-family: 'Vollkorn', serif;
font-size: 45px;
padding-bottom: 10px;
}
hr {
border-color: #00468b;
padding-bottom: 10px;
}
.description {
margin-top: 20px;
padding-bottom: 200px;
}
.description li {
font-family: 'Vollkorn', serif;
font-size: 25px;
color: #525252;
margin-left: 28%;
padding-top: 5px;
}
.gap {
margin-top: 200px;
}
.troubleshootingtext {
color: rgba(255, 255, 255, 0.7);
padding-left: 30%;
}
.troubleshootingtext li {
list-style-type: circle;
font-size: 25px;
padding-bottom: 5px;
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1000;
}
.block.response_body.json:hover {
cursor: pointer;
}
.backdrop {
color: blue;
}
#myModal {
height: 100%;
}
.modal-backdrop {
bottom: 0;
position: fixed;
}
.curl {
padding: 10px;
font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
font-size: 0.9em;
max-height: 400px;
margin-top: 5px;
overflow-y: auto;
background-color: #fcf6db;
border: 1px solid #e5e0c6;
border-radius: 4px;
}
.curl_title {
font-size: 1.1em;
margin: 0;
padding: 15px 0 5px;
font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
font-weight: 500;
line-height: 1.1;
}
.footer {
display: none;
}
.swagger-section .swagger-ui-wrap h2 {
padding: 0;
}
h2 {
margin: 0;
margin-bottom: 5px;
}
.markdown p {
font-size: 15px;
font-family: 'Arvo', serif;
}
.swagger-section .swagger-ui-wrap .code {
font-size: 15px;
font-family: 'Arvo', serif;
}
.swagger-section .swagger-ui-wrap b {
font-family: 'Arvo', serif;
}
#signin:hover {
cursor: pointer;
}
.dropdown-menu {
padding: 15px;
}
.navbar-right .dropdown-menu {
left: 0;
right: auto;
}
#signinbutton {
width: 100%;
height: 32px;
font-size: 13px;
font-weight: bold;
color: #08b;
}
.navbar-default .nav > li .details {
color: #000000;
text-transform: none;
font-size: 15px;
font-weight: normal;
font-family: 'Open Sans', sans-serif;
font-style: italic;
line-height: 20px;
top: -2px;
}
.navbar-default .nav > li .details:hover {
color: black;
}
#signout {
width: 100%;
height: 32px;
font-size: 13px;
font-weight: bold;
color: #08b;
}
.swagger-section #header a#logo{font-size:1.5em;font-weight:700;text-decoration:none;padding:20px 0 20px 40px}#text-head{font-size:80px;font-family:Roboto,sans-serif;color:#fff;float:right;margin-right:20%}.navbar-fixed-top .navbar-brand,.navbar-fixed-top .navbar-nav,.navbar-header{height:auto}.navbar-inverse{background-color:#000;border-color:#000}#navbar-brand{margin-left:20%}.navtext{font-size:10px}.h1,h1{font-size:60px}.navbar-default .navbar-header .navbar-brand{color:#a2dfee}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a{color:#393939;font-family:Arvo,serif;font-size:1.5em}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover{color:#000}.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2{color:#525252;padding-left:0;display:block;clear:none;float:left;font-family:Arvo,serif;font-weight:700}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#0a0a0a}.container1{width:1500px;margin:auto;margin-top:0;background-repeat:no-repeat;background-position:-40px -20px;margin-bottom:210px}.container-inner{width:1200px;margin:auto;background-color:hsla(192,8%,88%,.75);padding-bottom:40px;padding-top:40px;border-radius:15px}.header-content{padding:0;width:1000px}.title1{font-size:80px;font-family:Vollkorn,serif;color:#404040;text-align:center;padding-top:40px;padding-bottom:100px}#icon{margin-top:-18px}.subtext{font-size:25px;font-style:italic;color:#08b;text-align:right;padding-right:250px}.bg-primary{background-color:#00468b}.navbar-default .nav>li>a,.navbar-default .nav>li>a:focus,.navbar-default .nav>li>a:focus:hover,.navbar-default .nav>li>a:hover{color:#08b}.text-faded{font-size:25px;font-family:Vollkorn,serif}.section-heading{font-family:Vollkorn,serif;font-size:45px;padding-bottom:10px}hr{border-color:#00468b;padding-bottom:10px}.description{margin-top:20px;padding-bottom:200px}.description li{font-family:Vollkorn,serif;font-size:25px;color:#525252;margin-left:28%;padding-top:5px}.gap{margin-top:200px}.troubleshootingtext{color:hsla(0,0%,100%,.7);padding-left:30%}.troubleshootingtext li{list-style-type:circle;font-size:25px;padding-bottom:5px}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}.block.response_body.json:hover{cursor:pointer}.backdrop{color:blue}#myModal{height:100%}.modal-backdrop{bottom:0;position:fixed}.curl{padding:10px;font-family:Anonymous Pro,Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;font-size:.9em;max-height:400px;margin-top:5px;overflow-y:auto;background-color:#fcf6db;border:1px solid #e5e0c6;border-radius:4px}.curl_title{font-size:1.1em;margin:0;padding:15px 0 5px;font-family:Open Sans,Helvetica Neue,Arial,sans-serif;font-weight:500;line-height:1.1}.footer{display:none}.swagger-section .swagger-ui-wrap h2{padding:0}h2{margin:0;margin-bottom:5px}.markdown p,.swagger-section .swagger-ui-wrap .code{font-size:15px;font-family:Arvo,serif}.swagger-section .swagger-ui-wrap b{font-family:Arvo,serif}#signin:hover{cursor:pointer}.dropdown-menu{padding:15px}.navbar-right .dropdown-menu{left:0;right:auto}#signinbutton{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b}.navbar-default .nav>li .details{color:#000;text-transform:none;font-size:15px;font-weight:400;font-family:Open Sans,sans-serif;font-style:italic;line-height:20px;top:-2px}.navbar-default .nav>li .details:hover{color:#000}#signout{width:100%;height:32px;font-size:13px;font-weight:700;color:#08b}
-14
View File
@@ -1,14 +0,0 @@
/* Google Font's Droid Sans */
@font-face {
font-family: 'Droid Sans';
font-style: normal;
font-weight: 400;
src: local('Droid Sans'), local('DroidSans'), url('../fonts/DroidSans.ttf') format('truetype');
}
/* Google Font's Droid Sans Bold */
@font-face {
font-family: 'Droid Sans';
font-style: normal;
font-weight: 700;
src: local('Droid Sans Bold'), local('DroidSans-Bold'), url('../fonts/DroidSans-Bold.ttf') format('truetype');
}
+3 -1
View File
@@ -2,6 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge">
<title>Swagger UI</title>
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
@@ -74,7 +75,8 @@
docExpansion: "none",
jsonEditor: false,
defaultModelRendering: 'schema',
showRequestHeaders: false
showRequestHeaders: false,
showOperationIds: false
});
window.swaggerUi.load();
+56
View File
@@ -0,0 +1,56 @@
'use strict';
/* jshint quotmark: double */
window.SwaggerTranslator.learn({
"Warning: Deprecated":"Προειδοποίηση: Έχει αποσυρθεί",
"Implementation Notes":"Σημειώσεις Υλοποίησης",
"Response Class":"Απόκριση",
"Status":"Κατάσταση",
"Parameters":"Παράμετροι",
"Parameter":"Παράμετρος",
"Value":"Τιμή",
"Description":"Περιγραφή",
"Parameter Type":"Τύπος Παραμέτρου",
"Data Type":"Τύπος Δεδομένων",
"Response Messages":"Μηνύματα Απόκρισης",
"HTTP Status Code":"Κωδικός Κατάστασης HTTP",
"Reason":"Αιτιολογία",
"Response Model":"Μοντέλο Απόκρισης",
"Request URL":"URL Αιτήματος",
"Response Body":"Σώμα Απόκρισης",
"Response Code":"Κωδικός Απόκρισης",
"Response Headers":"Επικεφαλίδες Απόκρισης",
"Hide Response":"Απόκρυψη Απόκρισης",
"Headers":"Επικεφαλίδες",
"Try it out!":"Δοκιμάστε το!",
"Show/Hide":"Εμφάνιση/Απόκρυψη",
"List Operations":"Λίστα Λειτουργιών",
"Expand Operations":"Ανάπτυξη Λειτουργιών",
"Raw":"Ακατέργαστο",
"can't parse JSON. Raw result":"αδυναμία ανάλυσης JSON. Ακατέργαστο αποτέλεσμα",
"Example Value":"Παράδειγμα Τιμής",
"Model Schema":"Σχήμα Μοντέλου",
"Model":"Μοντέλο",
"Click to set as parameter value":"Πατήστε για να θέσετε τιμή παραμέτρου",
"apply":"εφαρμογή",
"Username":"Όνομα χρήση",
"Password":"Κωδικός πρόσβασης",
"Terms of service":"Όροι χρήσης",
"Created by":"Δημιουργήθηκε από",
"See more at":"Δείτε περισσότερα στο",
"Contact the developer":"Επικοινωνήστε με τον προγραμματιστή",
"api version":"έκδοση api",
"Response Content Type":"Τύπος Περιεχομένου Απόκρισης",
"Parameter content type:":"Τύπος περιεχομένου παραμέτρου:",
"fetching resource":"παραλαβή πόρου",
"fetching resource list":"παραλαβή λίστας πόρων",
"Explore":"Εξερεύνηση",
"Show Swagger Petstore Example Apis":"Εμφάνιση Api Δειγμάτων Petstore του Swagger",
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Αδυναμία ανάγνωσης από τον εξυπηρετητή. Μπορεί να μην έχει κατάλληλες ρυθμίσεις για access-control-origin.",
"Please specify the protocol for":"Παρακαλώ προσδιορίστε το πρωτόκολλο για",
"Can't read swagger JSON from":"Αδυναμία ανάγνωσης swagger JSON από",
"Finished Loading Resource Information. Rendering Swagger UI":"Ολοκλήρωση Φόρτωσης Πληροφορικών Πόρου. Παρουσίαση Swagger UI",
"Unable to read api":"Αδυναμία ανάγνωσης api",
"from path":"από το μονοπάτι",
"server returned":"ο εξυπηρετηρής επέστρεψε"
});
+1 -15
View File
File diff suppressed because one or more lines are too long
+1 -2065
View File
File diff suppressed because one or more lines are too long
+3 -4608
View File
File diff suppressed because one or more lines are too long
+1 -2
View File
File diff suppressed because one or more lines are too long
+1 -34
View File
@@ -1,34 +1 @@
'use strict';
(function () {
var configure, highlightBlock;
configure = hljs.configure;
// "extending" hljs.configure method
hljs.configure = function _configure (options) {
var size = options.highlightSizeThreshold;
// added highlightSizeThreshold option to set maximum size
// of processed string. Set to null if not a number
hljs.highlightSizeThreshold = size === +size ? size : null;
configure.call(this, options);
};
highlightBlock = hljs.highlightBlock;
// "extending" hljs.highlightBlock method
hljs.highlightBlock = function _highlightBlock (el) {
var innerHTML = el.innerHTML;
var size = hljs.highlightSizeThreshold;
// check if highlightSizeThreshold is not set or element innerHTML
// is less than set option highlightSizeThreshold
if (size == null || size > innerHTML.length) {
// proceed with hljs.highlightBlock
highlightBlock.call(hljs, el);
}
};
})();
"use strict";!function(){var h,l;h=hljs.configure,hljs.configure=function(l){var i=l.highlightSizeThreshold;hljs.highlightSizeThreshold=i===+i?i:null,h.call(this,l)},l=hljs.highlightBlock,hljs.highlightBlock=function(h){var i=h.innerHTML,g=hljs.highlightSizeThreshold;(null==g||g>i.length)&&l.call(hljs,h)}}();
+3 -2
View File
File diff suppressed because one or more lines are too long
+1 -18
View File
@@ -1,18 +1 @@
/*
* jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
* http://benalman.com/projects/jquery-bbq-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M<N?O[P]||(R[M+1]&&isNaN(R[M+1])?{}:[]):J}}else{if($.isArray(H[P])){H[P].push(J)}else{if(H[P]!==i){H[P]=[H[P],J]}else{H[P]=J}}}}else{if(P){H[P]=F?i:""}}});return H};function z(H,F,G){if(F===i||typeof F==="boolean"){G=F;F=a[H?D:A]()}else{F=E(F)?F.replace(H?w:x,""):F}return l(F,G)}l[A]=B(z,0);l[D]=v=B(z,1);$[y]||($[y]=function(F){return $.extend(C,F)})({a:k,base:k,iframe:t,img:t,input:t,form:"action",link:k,script:t});j=$[y];function s(I,G,H,F){if(!E(H)&&typeof H!=="object"){F=H;H=G;G=i}return this.each(function(){var L=$(this),J=G||j()[(this.nodeName||"").toLowerCase()]||"",K=J&&L.attr(J)||"";L.attr(J,a[I](K,H,F))})}$.fn[A]=B(s,A);$.fn[D]=B(s,D);b.pushState=q=function(I,F){if(E(I)&&/^#/.test(I)&&F===i){F=2}var H=I!==i,G=c(p[g][k],H?I:{},H?F:2);p[g][k]=G+(/#/.test(G)?"":"#")};b.getState=u=function(F,G){return F===i||typeof F==="boolean"?v(F):v(G)[F]};b.removeState=function(F){var G={};if(F!==i){G=u();$.each($.isArray(F)?F:arguments,function(I,H){delete G[H]})}q(G,2)};e[d]=$.extend(e[d],{add:function(F){var H;function G(J){var I=J[D]=c();J.getState=function(K,L){return K===i||typeof K==="boolean"?l(I,K):l(I,L)[K]};H.apply(this,arguments)}if($.isFunction(F)){H=F;return G}else{H=F.handler;F.handler=G}}})})(jQuery,this);
/*
* jQuery hashchange event - v1.2 - 2/11/2010
* http://benalman.com/projects/jquery-hashchange-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);
!function(e,t){function n(e){return"string"==typeof e}function r(e){var t=g.call(arguments,1);return function(){return e.apply(this,t.concat(g.call(arguments)))}}function o(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}function a(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function i(r,o,a,i,c){var u,s,p,h,d;return i!==f?(p=a.match(r?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/),d=p[3]||"",2===c&&n(i)?s=i.replace(r?R:E,""):(h=l(p[2]),i=n(i)?l[r?A:w](i):i,s=2===c?i:1===c?e.extend({},i,h):e.extend({},h,i),s=b(s),r&&(s=s.replace(m,y))),u=p[1]+(r?"#":s||!p[1]?"?":"")+s+d):u=o(a!==f?a:t[S][q]),u}function c(e,t,r){return t===f||"boolean"==typeof t?(r=t,t=b[e?A:w]()):t=n(t)?t.replace(e?R:E,""):t,l(t,r)}function u(t,r,o,a){return n(o)||"object"==typeof o||(a=o,o=r,r=f),this.each(function(){var n=e(this),i=r||v()[(this.nodeName||"").toLowerCase()]||"",c=i&&n.attr(i)||"";n.attr(i,b[t](c,o,a))})}var f,s,l,p,h,d,v,m,g=Array.prototype.slice,y=decodeURIComponent,b=e.param,$=e.bbq=e.bbq||{},x=e.event.special,j="hashchange",w="querystring",A="fragment",N="elemUrlAttr",S="location",q="href",C="src",E=/^.*\?|#.*$/g,R=/^.*\#/,U={};b[w]=r(i,0,a),b[A]=s=r(i,1,o),s.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);m=new RegExp(n.join("|"),"g")},s.noEscape(",/"),e.deparam=l=function(t,n){var r={},o={"true":!0,"false":!1,"null":null};return e.each(t.replace(/\+/g," ").split("&"),function(t,a){var i,c=a.split("="),u=y(c[0]),s=r,l=0,p=u.split("]["),h=p.length-1;if(/\[/.test(p[0])&&/\]$/.test(p[h])?(p[h]=p[h].replace(/\]$/,""),p=p.shift().split("[").concat(p),h=p.length-1):h=0,2===c.length)if(i=y(c[1]),n&&(i=i&&!isNaN(i)?+i:"undefined"===i?f:o[i]!==f?o[i]:i),h)for(;l<=h;l++)u=""===p[l]?s.length:p[l],s=s[u]=l<h?s[u]||(p[l+1]&&isNaN(p[l+1])?{}:[]):i;else e.isArray(r[u])?r[u].push(i):r[u]!==f?r[u]=[r[u],i]:r[u]=i;else u&&(r[u]=n?f:"")}),r},l[w]=r(c,0),l[A]=p=r(c,1),e[N]||(e[N]=function(t){return e.extend(U,t)})({a:q,base:q,iframe:C,img:C,input:C,form:"action",link:q,script:C}),v=e[N],e.fn[w]=r(u,w),e.fn[A]=r(u,A),$.pushState=h=function(e,r){n(e)&&/^#/.test(e)&&r===f&&(r=2);var o=e!==f,a=s(t[S][q],o?e:{},o?r:2);t[S][q]=a+(/#/.test(a)?"":"#")},$.getState=d=function(e,t){return e===f||"boolean"==typeof e?p(e):p(t)[e]},$.removeState=function(t){var n={};t!==f&&(n=d(),e.each(e.isArray(t)?t:arguments,function(e,t){delete n[t]})),h(n,2)},x[j]=e.extend(x[j],{add:function(t){function n(e){var t=e[A]=s();e.getState=function(e,n){return e===f||"boolean"==typeof e?l(t,e):l(t,n)[e]},r.apply(this,arguments)}var r;return e.isFunction(t)?(r=t,n):(r=t.handler,void(t.handler=n))}})}(jQuery,this),function(e,t,n){function r(e){return e=e||t[i][u],e.replace(/^[^#]*#?(.*)$/,"$1")}var o,a=e.event.special,i="location",c="hashchange",u="href",f=e.browser,s=document.documentMode,l=f.msie&&(s===n||s<8),p="on"+c in t&&!l;e[c+"Delay"]=100,a[c]=e.extend(a[c],{setup:function(){return!p&&void e(o.start)},teardown:function(){return!p&&void e(o.stop)}}),o=function(){function n(){f=s=function(e){return e},l&&(a=e('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow,s=function(){return r(a.document[i][u])},(f=function(e,t){if(e!==t){var n=a.document;n.open().close(),n[i].hash="#"+e}})(r()))}var o,a,f,s,p={};return p.start=function(){if(!o){var a=r();f||n(),function l(){var n=r(),p=s(a);n!==a?(f(a=n,p),e(t).trigger(c)):p!==a&&(t[i][u]=t[i][u].replace(/#.*/,"")+"#"+p),o=setTimeout(l,e[c+"Delay"])}()}},p.stop=function(){a||(o&&clearTimeout(o),o=0)},p}()}(jQuery,this);
+1 -1
View File
@@ -1 +1 @@
(function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery);
!function(i){i.fn.slideto=function(o){return o=i.extend({slide_duration:"slow",highlight_duration:3e3,highlight:!0,highlight_color:"#FFFF99"},o),this.each(function(){obj=i(this),i("body").animate({scrollTop:obj.offset().top},o.slide_duration,function(){o.highlight&&i.ui.version&&obj.effect("highlight",{color:o.highlight_color},o.highlight_duration)})})}}(jQuery);
+1 -8
View File
@@ -1,8 +1 @@
/*
jQuery Wiggle
Author: WonderGroup, Jordan Thomas
URL: http://labs.wondergroup.com/demos/mini-ui/index.html
License: MIT (http://en.wikipedia.org/wiki/MIT_License)
*/
jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('<div class="wiggle-wrap"></div>').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);}
if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});};
jQuery.fn.wiggle=function(e){var a={speed:50,wiggles:3,travel:5,callback:null},e=jQuery.extend(a,e);return this.each(function(){var a=this,l=(jQuery(this).wrap('<div class="wiggle-wrap"></div>').css("position","relative"),0);for(i=1;i<=e.wiggles;i++)jQuery(this).animate({left:"-="+e.travel},e.speed).animate({left:"+="+2*e.travel},2*e.speed).animate({left:"-="+e.travel},e.speed,function(){l++,jQuery(a).parent().hasClass("wiggle-wrap")&&jQuery(a).parent().replaceWith(a),l==e.wiggles&&jQuery.isFunction(e.callback)&&e.callback()})})};
+2 -3
View File
File diff suppressed because one or more lines are too long
+5 -11
View File
File diff suppressed because one or more lines are too long
+2 -102
View File
File diff suppressed because one or more lines are too long
+1 -1272
View File
File diff suppressed because one or more lines are too long
+1 -23
View File
@@ -1,23 +1 @@
if (typeof Object.assign != 'function') {
(function () {
Object.assign = function (target) {
'use strict';
if (target === undefined || target === null) {
throw new TypeError('Cannot convert undefined or null to object');
}
var output = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source !== undefined && source !== null) {
for (var nextKey in source) {
if (Object.prototype.hasOwnProperty.call(source, nextKey)) {
output[nextKey] = source[nextKey];
}
}
}
}
return output;
};
})();
}
"function"!=typeof Object.assign&&!function(){Object.assign=function(n){"use strict";if(void 0===n||null===n)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(n),o=1;o<arguments.length;o++){var r=arguments[o];if(void 0!==r&&null!==r)for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}}();
+4 -6
View File
File diff suppressed because one or more lines are too long
+1 -347
View File
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -1,6 +1,6 @@
<script>
var qp = null;
if(window.location.hash) {
if(/code|token|error/.test(window.location.hash)) {
qp = location.hash.substring(1);
}
else {
@@ -11,10 +11,10 @@ qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
return key===""?value:decodeURIComponent(value) }
):{}
if (window.opener.swaggerUi.tokenUrl)
if (window.opener.swaggerUiAuth.tokenUrl)
window.opener.processOAuthCode(qp);
else
window.opener.onOAuthComplete(qp);
window.close();
</script>
</script>
+429 -118
View File
File diff suppressed because one or more lines are too long
+15 -14
View File
File diff suppressed because one or more lines are too long
+28 -1
View File
@@ -13,7 +13,11 @@ var connect = require('gulp-connect');
var header = require('gulp-header');
var order = require('gulp-order');
var jshint = require('gulp-jshint');
var runSequence = require('run-sequence');
var cssnano = require('gulp-cssnano');
var pkg = require('./package.json');
var sourcemaps = require('gulp-sourcemaps');
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
@@ -58,10 +62,12 @@ function _dist() {
.src(['./src/main/template/templates.js'])
.on('error', log)
)
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(order(['scripts.js', 'templates.js']))
.pipe(concat('swagger-ui.js'))
.pipe(wrap('(function(){<%= contents %>}).call(this);'))
.pipe(header(banner, { pkg: pkg }))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./dist'))
.pipe(uglify())
.on('error', log)
@@ -126,6 +132,23 @@ gulp.task('copy-local-specs', function () {
.on('error', log);
});
gulp.task('minify-css', function() {
/** Minify all CSS within dist folder, runs after dist process*/
return gulp.src('./dist/css/*.css')
.pipe(cssnano())
.pipe(gulp.dest('./dist/css'));
});
gulp.task('uglify-libs', function() {
/**
* Minify all JS libs within the dist folder. A nice TODO would be to use versions from CDN
*/
gulp.src('./dist/lib/*.js')
.pipe(uglify())
.pipe(gulp.dest('./dist/lib'));
});
/**
* Watch for changes and recompile
*/
@@ -162,7 +185,11 @@ gulp.task('handlebars', function () {
.on('error', log);
});
gulp.task('default', ['dist', 'copy']);
gulp.task('default', function(callback) {
runSequence(['dist', 'copy'],
['uglify-libs', 'minify-css'],
callback);
});
gulp.task('serve', ['connect', 'watch']);
gulp.task('dev', ['default'], function () {
gulp.start('serve');
+57
View File
@@ -0,0 +1,57 @@
'use strict';
/* jshint quotmark: double */
window.SwaggerTranslator.learn({
"Warning: Deprecated":"Warnung: Deprecated",
"Implementation Notes":"Implementierungshinweise",
"Response Class":"Response Class",
"Status":"Status",
"Parameters":"Parameter",
"Parameter":"Parameter",
"Value":"Wert",
"Description":"Beschreibung",
"Parameter Type":"Parametertyp",
"Data Type":"Datentyp",
"Response Messages":"Response Messages",
"HTTP Status Code":"HTTP Status Code",
"Reason":"Grund",
"Response Model":"Response Model",
"Request URL":"Request URL",
"Response Body":"Response Body",
"Response Code":"Response Code",
"Response Headers":"Response Headers",
"Hide Response":"Response ausblenden",
"Headers":"Headers",
"Try it out!":"Ausprobieren",
"Show/Hide":"Einblenden/Ausblenden",
"List Operations":"Endpunkte anzeigen",
"Expand Operations":"Endpunkte ausklappen",
"Raw":"Raw",
"can't parse JSON. Raw result":"Parsen von JSON fehlgeschlagen. Raw result",
"Example Value":"Beispielwert",
"Model Schema":"Schemamodell",
"Model":"Modell",
"Click to set as parameter value":"Klicken um Parameter zu setzen",
"apply":"anlegen",
"Username":"Benutzername",
"Password":"Passwort",
"Terms of service":"Nutzungsbedingungen",
"Created by":"Erstellt von",
"See more at":"Mehr unter",
"Contact the developer":"Entwickler kontaktieren",
"api version":"API-Version",
"Response Content Type":"Response Content Type",
"Parameter content type:":"Parameter Content Type:",
"fetching resource":"Lade Ressourcen",
"fetching resource list":"Lade Liste der Ressourcen",
"Explore":"Erkunde",
"Show Swagger Petstore Example Apis":"Anzeigen der Swagger Petstore Example Apis",
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Lesen vom Server nicht möglich. Prüfen Sie die 'access-control-origin' Einstellungen.",
"Please specify the protocol for":"Bitte geben Sie das Protokoll an",
"Can't read swagger JSON from":"Swagger JSON kann nicht gelesen werden",
"Finished Loading Resource Information. Rendering Swagger UI":"Ressourceninformationen sind geladen. Rendern der Swagger UI",
"Unable to read api":"API kann nicht gelesen werden",
"from path":"von Pfad",
"server returned":"Server antwortet",
"Authorize":"Autorisieren"
});
+56
View File
@@ -0,0 +1,56 @@
'use strict';
/* jshint quotmark: double */
window.SwaggerTranslator.learn({
"Warning: Deprecated":"Προειδοποίηση: Έχει αποσυρθεί",
"Implementation Notes":"Σημειώσεις Υλοποίησης",
"Response Class":"Απόκριση",
"Status":"Κατάσταση",
"Parameters":"Παράμετροι",
"Parameter":"Παράμετρος",
"Value":"Τιμή",
"Description":"Περιγραφή",
"Parameter Type":"Τύπος Παραμέτρου",
"Data Type":"Τύπος Δεδομένων",
"Response Messages":"Μηνύματα Απόκρισης",
"HTTP Status Code":"Κωδικός Κατάστασης HTTP",
"Reason":"Αιτιολογία",
"Response Model":"Μοντέλο Απόκρισης",
"Request URL":"URL Αιτήματος",
"Response Body":"Σώμα Απόκρισης",
"Response Code":"Κωδικός Απόκρισης",
"Response Headers":"Επικεφαλίδες Απόκρισης",
"Hide Response":"Απόκρυψη Απόκρισης",
"Headers":"Επικεφαλίδες",
"Try it out!":"Δοκιμάστε το!",
"Show/Hide":"Εμφάνιση/Απόκρυψη",
"List Operations":"Λίστα Λειτουργιών",
"Expand Operations":"Ανάπτυξη Λειτουργιών",
"Raw":"Ακατέργαστο",
"can't parse JSON. Raw result":"αδυναμία ανάλυσης JSON. Ακατέργαστο αποτέλεσμα",
"Example Value":"Παράδειγμα Τιμής",
"Model Schema":"Σχήμα Μοντέλου",
"Model":"Μοντέλο",
"Click to set as parameter value":"Πατήστε για να θέσετε τιμή παραμέτρου",
"apply":"εφαρμογή",
"Username":"Όνομα χρήση",
"Password":"Κωδικός πρόσβασης",
"Terms of service":"Όροι χρήσης",
"Created by":"Δημιουργήθηκε από",
"See more at":"Δείτε περισσότερα στο",
"Contact the developer":"Επικοινωνήστε με τον προγραμματιστή",
"api version":"έκδοση api",
"Response Content Type":"Τύπος Περιεχομένου Απόκρισης",
"Parameter content type:":"Τύπος περιεχομένου παραμέτρου:",
"fetching resource":"παραλαβή πόρου",
"fetching resource list":"παραλαβή λίστας πόρων",
"Explore":"Εξερεύνηση",
"Show Swagger Petstore Example Apis":"Εμφάνιση Api Δειγμάτων Petstore του Swagger",
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Αδυναμία ανάγνωσης από τον εξυπηρετητή. Μπορεί να μην έχει κατάλληλες ρυθμίσεις για access-control-origin.",
"Please specify the protocol for":"Παρακαλώ προσδιορίστε το πρωτόκολλο για",
"Can't read swagger JSON from":"Αδυναμία ανάγνωσης swagger JSON από",
"Finished Loading Resource Information. Rendering Swagger UI":"Ολοκλήρωση Φόρτωσης Πληροφορικών Πόρου. Παρουσίαση Swagger UI",
"Unable to read api":"Αδυναμία ανάγνωσης api",
"from path":"από το μονοπάτι",
"server returned":"ο εξυπηρετηρής επέστρεψε"
});
+2 -1
View File
@@ -52,5 +52,6 @@ window.SwaggerTranslator.learn({
"Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI",
"Unable to read api":"Unable to read api",
"from path":"from path",
"server returned":"server returned"
"server returned":"server returned",
"Authorize":"Authorize"
});
+2 -1
View File
@@ -50,5 +50,6 @@ window.SwaggerTranslator.learn({
"Finished Loading Resource Information. Rendering Swagger UI":"Chargement des informations terminé. Affichage de Swagger UI",
"Unable to read api":"Impossible de lire l'api",
"from path":"à partir du chemin",
"server returned":"réponse du serveur"
"server returned":"réponse du serveur",
"Authorize":"Autorisez"
});
+2 -1
View File
@@ -48,5 +48,6 @@ window.SwaggerTranslator.learn({
"Finished Loading Resource Information. Rendering Swagger UI":"Lettura informazioni risorse termianta. Swagger UI viene mostrata",
"Unable to read api":"Impossibile leggere la api",
"from path":"da cartella",
"server returned":"il server ha restituito"
"server returned":"il server ha restituito",
"Authorize":"Autorizzare"
});
+2 -1
View File
@@ -49,5 +49,6 @@ window.SwaggerTranslator.learn({
"Finished Loading Resource Information. Rendering Swagger UI":"Ukończono Ładowanie Informacji o Zasobie. Renderowanie Swagger UI",
"Unable to read api":"Nie można odczytać api",
"from path":"ze ścieżki",
"server returned":"serwer zwrócił"
"server returned":"serwer zwrócił",
"Authorize":"Autoryzuj"
});
+54
View File
@@ -0,0 +1,54 @@
'use strict';
/* jshint quotmark: double */
window.SwaggerTranslator.learn({
"Warning: Deprecated":"Aviso: Descontinuado",
"Implementation Notes":"Notas de Implementação",
"Response Class":"Classe de resposta",
"Status":"Status",
"Parameters":"Parâmetros",
"Parameter":"Parâmetro",
"Value":"Valor",
"Description":"Descrição",
"Parameter Type":"Tipo de parâmetro",
"Data Type":"Tipo de dados",
"Response Messages":"Mensagens de resposta",
"HTTP Status Code":"Código de status HTTP",
"Reason":"Razão",
"Response Model":"Modelo de resposta",
"Request URL":"Requisição URL",
"Response Body":"Corpo da resposta",
"Response Code":"Código da resposta",
"Response Headers":"Cabeçalho da resposta",
"Headers":"Cabeçalhos",
"Hide Response":"Esconder resposta",
"Try it out!":"Tente agora!",
"Show/Hide":"Mostrar/Esconder",
"List Operations":"Listar operações",
"Expand Operations":"Expandir operações",
"Raw":"Cru",
"can't parse JSON. Raw result":"Falha ao analisar JSON. Resulto cru",
"Model Schema":"Esquema do modelo",
"Model":"Modelo",
"apply":"Aplicar",
"Username":"Usuário",
"Password":"Senha",
"Terms of service":"Termos de serviço",
"Created by":"Criado por",
"See more at":"Veja mais em",
"Contact the developer":"Contate o desenvolvedor",
"api version":"Versão da api",
"Response Content Type":"Tipo do conteúdo de resposta",
"fetching resource":"buscar recurso",
"fetching resource list":"buscar lista de recursos",
"Explore":"Explorar",
"Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis",
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Não é possível ler do servidor. Ele pode não ter as configurações apropriadas de access-control-origin",
"Please specify the protocol for":"Por favor especifique o protocolo",
"Can't read swagger JSON from":"Não é possível ler o JSON Swagger de",
"Finished Loading Resource Information. Rendering Swagger UI":"Carregamento de informação de recurso finalizada. Renderizando Swagger UI",
"Unable to read api":"Não foi possível ler a api",
"from path":"do caminho",
"server returned":"servidor retornou",
"Example Value":"Exemplo de Valores"
});
+855 -7
View File
File diff suppressed because one or more lines are too long
+26 -14
View File
@@ -11,7 +11,7 @@ var additionalQueryStringParams;
function handleLogin() {
var scopes = [];
var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
var auths = window.swaggerUiAuth.authSchemes || window.swaggerUiAuth.securityDefinitions;
if(auths) {
var key;
var defs = auths;
@@ -36,8 +36,7 @@ function handleLogin() {
}
}
if(window.swaggerUi.api
&& window.swaggerUi.api.info) {
if(window.swaggerUi.api && window.swaggerUi.api.info) {
appName = window.swaggerUi.api.info.title;
}
@@ -54,7 +53,7 @@ function handleLogin() {
'<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 class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button" data-sw-translate>Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
'</div>',
'</div>'].join(''));
$(document.body).append(popupDialog);
@@ -122,7 +121,18 @@ function handleLogin() {
//TODO: merge not replace if scheme is different from any existing
//(needs to be aware of schemes to do so correctly)
window.enabledScopes=scopes;
/**
* Returns the name of the access token parameter returned by the server.
*
* @param dets
* The authorisation scheme configuration.
* @return the name of the access token parameter
*/
function getTokenName(dets) {
return dets.vendorExtensions['x-tokenName'] || dets.tokenName;
}
for (var key in authSchemes) {
if (authSchemes.hasOwnProperty(key) && OAuthSchemeKeys.indexOf(key) != -1) { //only look at keys that match this scope.
var flow = authSchemes[key].flow;
@@ -130,13 +140,13 @@ function handleLogin() {
if(authSchemes[key].type === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {
var dets = authSchemes[key];
url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
window.swaggerUi.tokenName = getTokenName(dets) || 'access_token';
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
state = key;
}
else if(authSchemes[key].type === 'oauth2' && flow && (flow === 'application')) {
var dets = authSchemes[key];
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
window.swaggerUi.tokenName = getTokenName(dets) || 'access_token';
clientCredentialsFlow(scopes, dets.tokenUrl, key);
return;
}
@@ -148,13 +158,13 @@ function handleLogin() {
var dets = o[t];
var ep = dets.loginEndpoint.url;
url = dets.loginEndpoint.url + '?response_type=token';
window.swaggerUi.tokenName = dets.tokenName;
window.swaggerUi.tokenName = getTokenName(dets);
}
else if (o.hasOwnProperty(t) && t === 'accessCode') {
var dets = o[t];
var ep = dets.tokenRequestEndpoint.url;
url = dets.tokenRequestEndpoint.url + '?response_type=code';
window.swaggerUi.tokenName = dets.tokenName;
window.swaggerUi.tokenName = getTokenName(dets);
}
}
}
@@ -271,7 +281,7 @@ window.processOAuthCode = function processOAuthCode(data) {
$.ajax(
{
url : window.swaggerUi.tokenUrl,
url : window.swaggerUiAuth.tokenUrl,
type: "POST",
data: params,
success:function(data, textStatus, jqXHR)
@@ -285,7 +295,7 @@ window.processOAuthCode = function processOAuthCode(data) {
});
};
window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
window.onOAuthComplete = function onOAuthComplete(token, OAuthSchemeKey) {
if(token) {
if(token.error) {
var checkbox = $('input[type=checkbox],.secured')
@@ -295,7 +305,7 @@ window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
alert(token.error);
}
else {
var b = token[window.swaggerUi.tokenName];
var b = token[window.swaggerUiAuth.tokenName];
if (!OAuthSchemeKey){
OAuthSchemeKey = token.state;
}
@@ -339,8 +349,10 @@ window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
}
}
});
window.swaggerUi.api.clientAuthorizations.add(window.OAuthSchemeKey, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
window.swaggerUi.load();
if(typeof window.swaggerUi !== 'undefined') {
window.swaggerUi.api.clientAuthorizations.add(window.swaggerUiAuth.OAuthSchemeKey, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
window.swaggerUi.load();
}
}
}
}
+27 -2
View File
@@ -17,8 +17,33 @@ http {
server_name localhost;
location / {
root html;
root /usr/share/nginx/html;
index index.html index.htm;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
}
}
}
}
+5 -2
View File
@@ -8,7 +8,7 @@
}
],
"description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"version": "2.2.6",
"version": "2.2.10",
"homepage": "http://swagger.io",
"license": "Apache-2.0",
"main": "dist/swagger-ui.js",
@@ -37,12 +37,14 @@
"gulp-clean": "^0.3.1",
"gulp-concat": "^2.5.2",
"gulp-connect": "^2.2.0",
"gulp-cssnano": "^2.1.2",
"gulp-declare": "^0.3.0",
"gulp-header": "^1.2.2",
"gulp-jshint": "^1.10.0",
"gulp-less": "^3.0.1",
"gulp-order": "^1.1.1",
"gulp-rename": "^1.2.0",
"gulp-sourcemaps": "^2.2.0",
"gulp-uglify": "^1.1.0",
"gulp-watch": "^4.1.1",
"gulp-wrap": "^0.11.0",
@@ -58,8 +60,9 @@
"less": "^2.4.0",
"mocha": "^2.1.0",
"phantomjs": "1.9.19",
"run-sequence": "^1.2.2",
"selenium-webdriver": "^2.45.0",
"sinon-chai": "2.8.0",
"swagger-client": "2.1.23"
"swagger-client": "2.1.32"
}
}
+11 -1
View File
@@ -422,7 +422,8 @@
font-size: .85em;
line-height: 1.2em;
overflow: auto;
max-height: 200px;
height: 200px;
resize: vertical;
cursor: pointer;
}
.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav {
@@ -837,6 +838,11 @@
padding: 0;
line-height: inherit;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .nickname {
color: #aaaaaa;
padding: 0;
line-height: inherit;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access {
color: black;
}
@@ -1344,6 +1350,10 @@
.swagger-section .api-popup-actions {
padding-top: 10px;
}
.swagger-section fieldset {
padding-bottom: 10px;
padding-left: 20px;
}
#header {
display: none;
}
+11 -1
View File
@@ -422,7 +422,8 @@
font-size: .85em;
line-height: 1.2em;
overflow: auto;
max-height: 200px;
height: 200px;
resize: vertical;
cursor: pointer;
}
.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav {
@@ -837,6 +838,11 @@
padding: 0;
line-height: inherit;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a .nickname {
color: #aaaaaa;
padding: 0;
line-height: inherit;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access {
color: black;
}
@@ -1344,6 +1350,10 @@
.swagger-section .api-popup-actions {
padding-top: 10px;
}
.swagger-section fieldset {
padding-bottom: 10px;
padding-left: 20px;
}
.swagger-section .access {
float: right;
}
-2
View File
@@ -2,7 +2,6 @@
font-size: 1.5em;
font-weight: bold;
text-decoration: none;
background: transparent url(../images/logo.png) no-repeat left center;
padding: 20px 0 20px 40px;
}
#text-head {
@@ -64,7 +63,6 @@ h1 {
width: 1500px;
margin: auto;
margin-top: 0;
background-image: url('../images/shield.png');
background-repeat: no-repeat;
background-position: -40px -20px;
margin-bottom: 210px;
+3 -1
View File
@@ -2,6 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge">
<title>Swagger UI</title>
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
@@ -74,7 +75,8 @@
docExpansion: "none",
jsonEditor: false,
defaultModelRendering: 'schema',
showRequestHeaders: false
showRequestHeaders: false,
showOperationIds: false
});
window.swaggerUi.load();
+3 -3
View File
@@ -1,6 +1,6 @@
<script>
var qp = null;
if(window.location.hash) {
if(/code|token|error/.test(window.location.hash)) {
qp = location.hash.substring(1);
}
else {
@@ -11,10 +11,10 @@ qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
return key===""?value:decodeURIComponent(value) }
):{}
if (window.opener.swaggerUi.tokenUrl)
if (window.opener.swaggerUiAuth.tokenUrl)
window.opener.processOAuthCode(qp);
else
window.opener.onOAuthComplete(qp);
window.close();
</script>
</script>
+5 -2
View File
@@ -7,10 +7,13 @@ Handlebars.registerHelper('sanitize', function (text) {
if (text === undefined) { return ''; }
result = sanitizeHtml(text, {
allowedTags: [ 'div', 'span', 'b', 'i', 'em', 'strong', 'a' ],
allowedTags: [ 'div', 'span', 'b', 'i', 'em', 'strong', 'a', 'br', 'table', 'tbody', 'tr', 'th', 'td' ],
allowedAttributes: {
'div': [ 'class' ],
'span': [ 'class' ],
'table': [ 'class' ],
'td': [ 'class' ],
'th': [ 'colspan' ],
'a': [ 'href' ]
}
});
@@ -20,7 +23,7 @@ Handlebars.registerHelper('sanitize', function (text) {
Handlebars.registerHelper('renderTextParam', function(param) {
var result, type = 'text', idAtt = '';
var paramType = param.type || param.schema && param.schema.type || '';
var paramType = (param.schema) ? param.type || param.schema.type || '' : param.type || '';
var isArray = paramType.toLowerCase() === 'array' || param.allowMultiple;
var defaultValue = isArray && Array.isArray(param.default) ? param.default.join('\n') : param.default;
var name = Handlebars.Utils.escapeExpression(param.name);
+2 -2
View File
@@ -1,8 +1,8 @@
'use strict';
window.SwaggerUi.utils = {
parseSecurityDefinitions: function (security) {
var auths = Object.assign({}, window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions);
parseSecurityDefinitions: function (security, securityDefinitions) {
var auths = Object.assign({}, securityDefinitions);
var oauth2Arr = [];
var authsArr = [];
var scopes = [];
+59 -17
View File
@@ -98,25 +98,45 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
var url = null;
var scopes = _.map(auth.get('scopes'), function (scope) {
return scope.scope;
if(scope.checked) {
return scope.scope;
}
});
var container = window.swaggerUiAuth || (window.swaggerUiAuth = {});
var state, dets, ep;
window.OAuthSchemeKey = auth.get('title');
container.OAuthSchemeKey = auth.get('title');
window.enabledScopes = scopes;
var flow = auth.get('flow');
/**
* Returns the name of the access token parameter returned by the server.
*
* @param dets
* The authorisation scheme configuration.
* @return the name of the access token parameter
*/
function getTokenName(dets) {
return dets.vendorExtensions['x-tokenName'] || dets.tokenName;
}
if(auth.get('type') === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {
dets = auth.attributes;
url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
state = window.OAuthSchemeKey;
container.tokenName = getTokenName(dets) || 'access_token';
container.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
state = container.OAuthSchemeKey;
}
else if(auth.get('type') === 'oauth2' && flow && (flow === 'application')) {
dets = auth.attributes;
window.swaggerUi.tokenName = dets.tokenName || 'access_token';
this.clientCredentialsFlow(scopes, dets.tokenUrl, window.OAuthSchemeKey);
container.tokenName = getTokenName(dets) || 'access_token';
this.clientCredentialsFlow(scopes, dets, container.OAuthSchemeKey);
return;
}
else if(auth.get('type') === 'oauth2' && flow && (flow === 'password')) {
dets = auth.attributes;
container.tokenName = getTokenName(dets) || 'access_token';
this.passwordFlow(scopes, dets, container.OAuthSchemeKey);
return;
}
else if(auth.get('grantTypes')) {
@@ -127,13 +147,13 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
dets = o[t];
ep = dets.loginEndpoint.url;
url = dets.loginEndpoint.url + '?response_type=token';
window.swaggerUi.tokenName = dets.tokenName;
container.tokenName = getTokenName(dets);
}
else if (o.hasOwnProperty(t) && t === 'accessCode') {
dets = o[t];
ep = dets.tokenRequestEndpoint.url;
url = dets.tokenRequestEndpoint.url + '?response_type=code';
window.swaggerUi.tokenName = dets.tokenName;
container.tokenName = getTokenName(dets);
}
}
}
@@ -153,17 +173,40 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
},
// taken from lib/swagger-oauth.js
clientCredentialsFlow: function (scopes, tokenUrl, OAuthSchemeKey) {
var params = {
'client_id': clientId,
'client_secret': clientSecret,
clientCredentialsFlow: function (scopes, oauth, OAuthSchemeKey) {
this.accessTokenRequest(scopes, oauth, OAuthSchemeKey, 'client_credentials');
},
passwordFlow: function (scopes, oauth, OAuthSchemeKey) {
this.accessTokenRequest(scopes, oauth, OAuthSchemeKey, 'password', {
'username': oauth.username,
'password': oauth.password
});
},
accessTokenRequest: function (scopes, oauth, OAuthSchemeKey, grantType, params) {
params = $.extend({}, {
'scope': scopes.join(' '),
'grant_type': 'client_credentials'
};
'grant_type': grantType
}, params);
var headers= {};
switch (oauth.clientAuthenticationType) {
case 'basic':
headers.Authorization = 'Basic ' + btoa(oauth.clientId + ':' + oauth.clientSecret);
break;
case 'request-body':
params.client_id = oauth.clientId;
params.client_secret = oauth.clientSecret;
break;
}
$.ajax({
url : tokenUrl,
url : oauth.tokenUrl,
type: 'POST',
data: params,
headers: headers,
success: function (data)
{
onOAuthComplete(data, OAuthSchemeKey);
@@ -174,5 +217,4 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
}
});
}
});
+5 -1
View File
@@ -66,7 +66,11 @@ SwaggerUi.Collections.AuthsCollection = Backbone.Collection.extend({
},
parse: function (data) {
var authz = Object.assign({}, window.swaggerUi.api.clientAuthorizations.authz);
var authz = {};
if(typeof window.swaggerUi !== 'undefined') {
authz = Object.assign({}, window.swaggerUi.api.clientAuthorizations.authz);
}
return _.map(data, function (auth, name) {
var isBasic = authz[name] && auth.type === 'basic' && authz[name].username && authz[name].password;
+1 -1
View File
@@ -111,7 +111,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
addResource: function(resource, auths){
// Render a resource and add it to resources li
resource.id = resource.id.replace(/\s/g, '_');
resource.id = resource.id.replace(/[^a-zA-Z\d]/g, function(str) { return str.charCodeAt(0); });
// Make all definitions available at the root of the resource so that they can
// be loaded by the JSonEditor
+33 -1
View File
@@ -2,10 +2,32 @@
SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({
defaults: {
scopes: {}
scopes: {},
isPasswordFlow: false,
clientAuthenticationType: 'none'
},
initialize: function () {
if(this.attributes && this.attributes.scopes) {
var attributes = _.cloneDeep(this.attributes);
var i, scopes = [];
for(i in attributes.scopes) {
var scope = attributes.scopes[i];
if(typeof scope.description === 'string') {
scopes[scope] = attributes.scopes[i];
scopes.push(attributes.scopes[i]);
}
}
attributes.scopes = scopes;
this.attributes = attributes;
}
if (this.attributes && this.attributes.flow) {
var flow = this.attributes.flow;
this.set('isPasswordFlow', flow === 'password');
this.set('requireClientAuthentication', flow === 'application');
this.set('clientAuthentication', flow === 'password' || flow === 'application');
}
this.on('change', this.validate);
},
@@ -22,6 +44,16 @@ SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({
validate: function () {
var valid = false;
if (this.get('isPasswordFlow') &&
(!this.get('username'))) {
return false;
}
if (this.get('clientAuthenticationType') in ['basic', 'request-body'] &&
(!this.get('clientId'))) {
return false;
}
var scp = this.get('scopes');
var idx = _.findIndex(scp, function (o) {
return o.checked === true;
+62 -1
View File
@@ -2,11 +2,20 @@
SwaggerUi.Views.Oauth2View = Backbone.View.extend({
events: {
'change .oauth-scope': 'scopeChange'
'change .oauth-scope': 'scopeChange',
'change .oauth-username': 'setUsername',
'change .oauth-password': 'setPassword',
'change .oauth-client-authentication-type': 'setClientAuthenticationType',
'change .oauth-client-id': 'setClientId',
'change .oauth-client-secret': 'setClientSecret'
},
template: Handlebars.templates.oauth2,
cls: {
error: 'error'
},
render: function () {
this.$el.html(this.template(this.model.toJSON()));
@@ -18,5 +27,57 @@ SwaggerUi.Views.Oauth2View = Backbone.View.extend({
var scope = $(e.target).data('scope');
this.model.setScopes(scope, val);
},
setUsername: function (e) {
var val= $(e.target).val();
this.model.set('username', val);
if (val) {
$(e.target).removeClass(this.cls.error);
}
},
setPassword: function (e) {
this.model.set('password', $(e.target).val());
},
setClientAuthenticationType: function (e) {
var type = $(e.target).val();
var $el = this.$el;
this.model.set('clientAuthenticationType', type);
switch(type) {
case 'none':
$el.find('.oauth-client-authentication').hide();
break;
case 'basic':
case 'request-body':
$el.find('.oauth-client-id').removeClass(this.cls.error);
$el.find('.oauth-client-authentication').show();
break;
}
},
setClientId: function (e) {
var val = $(e.target).val();
this.model.set('clientId', val);
if (val) {
$(e.target).removeClass(this.cls.error);
}
},
setClientSecret: function (e) {
this.model.set('clientSecret', $(e.target).val());
$(e.target).removeClass('error');
},
highlightInvalid: function () {
if (!this.model.get('username')) {
this.$el.find('.oauth-username').addClass(this.cls.error);
}
if (!this.model.get('clientId')) {
this.$el.find('.oauth-client-id').addClass(this.cls.error);
}
}
});
+20 -5
View File
@@ -27,6 +27,10 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
if (opts.swaggerOptions.showRequestHeaders) {
this.model.showRequestHeaders = true;
}
if (opts.swaggerOptions.showOperationIds) {
this.model.showOperationIds = true;
}
}
return this;
},
@@ -83,7 +87,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
},
// Note: copied from CoffeeScript compiled file
// TODO: redactor
// TODO: refactor
render: function() {
var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, produces, isXML, isJSON;
isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
@@ -258,9 +262,9 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
}
if (Array.isArray(this.model.security)) {
var authsModel = SwaggerUi.utils.parseSecurityDefinitions(this.model.security);
var authsModel = SwaggerUi.utils.parseSecurityDefinitions(this.model.security, this.model.parent.securityDefinitions);
authsModel.isLogout = !_.isEmpty(window.swaggerUi.api.clientAuthorizations.authz);
authsModel.isLogout = !_.isEmpty(this.model.clientAuthorizations.authz);
this.authView = new SwaggerUi.Views.AuthButtonView({
data: authsModel,
router: this.router,
@@ -672,6 +676,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
contentType = contentType.split(';')[0].trim();
}
}
$('.response_body', $(this.el)).removeClass('json');
$('.response_body', $(this.el)).removeClass('xml');
@@ -682,12 +687,15 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
var pre;
var code;
var skipHighlight = false;
if (!content) {
code = $('<code />').text('no content');
pre = $('<pre class="json" />').append(code);
// JSON
} else if (headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
} else if (
contentType === 'application/octet-stream' ||
headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {
@@ -714,6 +722,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
var responseFilename = /filename=([^;]*);?/.exec(disposition);
if(responseFilename !== null && responseFilename.length > 1) {
download = responseFilename[1];
fileName = download;
}
}
@@ -722,6 +731,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
a.innerText = 'Download ' + fileName;
pre = $('<div/>').append(a);
skipHighlight = true;
} else {
pre = $('<pre class="json" />').append('Download headers detected but your browser does not support downloading binary via XHR (Blob).');
}
@@ -795,9 +805,14 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
$('.request_headers', $(this.el)).html('<pre>' + _.escape(JSON.stringify(requestHeaders, null, ' ')).replace(/\n/g, '<br>') + '</pre>');
}
// Call user-defined hook
if (opts.responseHooks && opts.responseHooks[this.nickname]) {
opts.responseHooks[this.nickname](response, this);
}
var response_body_el = $('.response_body', $(this.el))[0];
// only highlight the response if response is less than threshold, default state is highlight response
if (opts.highlightSizeThreshold && typeof response.data !== 'undefined' && response.data.length > opts.highlightSizeThreshold) {
if (opts.highlightSizeThreshold && typeof response.data !== 'undefined' && response.data.length > opts.highlightSizeThreshold || skipHighlight) {
return response_body_el;
} else {
return hljs.highlightBlock(response_body_el);
+62 -19
View File
@@ -553,14 +553,30 @@ SwaggerUi.partials.signature = (function () {
modelsToIgnore[value.name] = value;
// Response support
if (value.examples && _.isPlainObject(value.examples) && value.examples['application/json']) {
value.definition.example = value.examples['application/json'];
if (value.examples && _.isPlainObject(value.examples)) {
value = _.cloneDeep(value);
var keys = Object.keys(value.examples);
if (_.isString(value.definition.example)) {
value.definition.example = jsyaml.safeLoad(value.definition.example);
_.forEach(keys, function(key) {
if(key.indexOf('application/json') === 0) {
var example = value.examples[key];
if (_.isString(example)) {
example = jsyaml.safeLoad(example);
}
value.definition.example = example;
return schemaToJSON(value.definition, example, modelsToIgnore, value.modelPropertyMacro);
}
});
}
if (value.examples) {
value = _.cloneDeep(value);
var example = value.examples;
if (_.isString(example)) {
example = jsyaml.safeLoad(example);
}
} else if (!value.definition.example) {
value.definition.example = value.examples;
value.definition.example = example;
return schemaToJSON(value.definition, example, modelsToIgnore, value.modelPropertyMacro);
}
return schemaToJSON(value.definition, value.models, modelsToIgnore, value.modelPropertyMacro);
@@ -673,7 +689,8 @@ SwaggerUi.partials.signature = (function () {
return str.join('');
};
var getName = function (name, xml) {
// Commenting this funtion as the names are now determined beforehand and the prefix part is exposed as a separate function | https://github.com/swagger-api/swagger-ui/issues/2577
/** var getName = function (name, xml) {
var result = name || '';
xml = xml || {};
@@ -688,6 +705,19 @@ SwaggerUi.partials.signature = (function () {
return result;
};
*/
var getPrefix = function (name, xml) {
var result = name || '';
xml = xml || {};
if (xml.prefix) {
result = xml.prefix + ':' + result;
}
return result;
};
var getNamespace = function (xml) {
var namespace = '';
@@ -723,9 +753,12 @@ SwaggerUi.partials.signature = (function () {
var attributes = [];
if (!items) { return getErrorMessage(); }
value = createSchemaXML(name, items, models, config);
var key = name;
// If there is a name specified for the array elements, use that for the array elements name | https://github.com/swagger-api/swagger-ui/issues/2577
if(items.xml && items.xml.name) {
key = items.xml.name;
}
value = createSchemaXML(key, items, models, config);
if (namespace) {
attributes.push(namespace);
}
@@ -811,7 +844,7 @@ SwaggerUi.partials.signature = (function () {
if (namespace) {
attrs.push(namespace);
}
}
if (!properties && !additionalProperties) { return getErrorMessage(); }
@@ -856,9 +889,10 @@ SwaggerUi.partials.signature = (function () {
var output, index;
config = config || {};
config.modelsToIgnore = config.modelsToIgnore || [];
var descriptor = _.isString($ref) ? getDescriptorByRef($ref, name, models, config)
: getDescriptor(name, definition, models, config);
if (!descriptor) {
return getErrorMessage();
}
@@ -888,10 +922,10 @@ SwaggerUi.partials.signature = (function () {
if (arguments.length < 4) {
throw new Error();
}
this.config = config || {};
this.config.modelsToIgnore = this.config.modelsToIgnore || [];
this.name = getName(name, definition.xml);
// name is already set by getDescriptorByRef or getDescriptor function depending on the type. Only prefix, if present is needed to be set here | https://github.com/swagger-api/swagger-ui/issues/2577
this.name = getPrefix(name, definition.xml);
this.definition = definition;
this.models = models;
this.type = type;
@@ -901,8 +935,15 @@ SwaggerUi.partials.signature = (function () {
var modelType = simpleRef($ref);
var model = models[modelType] || {};
var type = model.definition && model.definition.type ? model.definition.type : 'object';
name = name || model.name;
// If model definition xml name is present, then that will be preferred over model name. This is the case of preferring XmlElement name over XmlRootElement name if XmlElement name is provided | https://github.com/swagger-api/swagger-ui/issues/2577
if(model.definition && model.definition.xml && model.definition.xml.name) {
name = name || model.definition.xml.name || model.name;
}
// else only model name will be considered for determination | https://github.com/swagger-api/swagger-ui/issues/2577
else {
name = name || model.name;
}
if (config.modelsToIgnore.indexOf($ref) > -1) {
type = 'loop';
config.loopTo = modelType;
@@ -913,13 +954,15 @@ SwaggerUi.partials.signature = (function () {
if (!model.definition) {
return null;
}
return new Descriptor(name, type, model.definition, models, config);
return new Descriptor(name, type, model.definition, models, config);
}
function getDescriptor (name, definition, models, config){
var type = definition.type || 'object';
// If definition xml name is present, then that will be preferred over name | https://github.com/swagger-api/swagger-ui/issues/2577
if(definition.xml && definition.xml.name) {
name = definition.xml.name || name;
}
if (!definition) {
return null;
}
+5
View File
@@ -201,4 +201,9 @@
}
.api-popup-actions { padding-top: 10px; }
fieldset {
padding-bottom: 10px;
padding-left: 20px;
}
}
+27 -1
View File
@@ -44,6 +44,26 @@
table {
border-collapse: collapse;
border-spacing: 0;
.param-name-col {
width: 100px;
max-width: 100px;
}
.param-value-col {
width: 310px;
max-width: 310px;
}
.param-description-col {
width: 200px;
max-width: 200px;
}
.param-type-col {
width: 100px;
max-width: 100px;
}
.param-data-type-col {
width: 220px;
max-width: 230px;
}
thead {
tr {
th {
@@ -250,7 +270,8 @@
font-size: .85em;
line-height: 1.2em;
overflow: auto;
max-height: 200px;
height: 200px;
resize: vertical;
cursor: pointer;
}
ul.signature-nav {
@@ -708,6 +729,11 @@
padding: 0;
line-height: inherit;
}
.nickname {
color: #aaaaaa;
padding: 0;
line-height: inherit;
}
}
}
}
-2
View File
@@ -4,7 +4,6 @@
font-size: 1.5em;
font-weight: bold;
text-decoration: none;
background: transparent url(../images/logo.png) no-repeat left center;
padding: 20px 0 20px 40px;
}
@@ -84,7 +83,6 @@
width: 1500px;
margin: auto;
margin-top: 0;
background-image: url('../images/shield.png');
background-repeat: no-repeat;
background-position: -40px -20px;
margin-bottom: 210px;
+1 -1
View File
@@ -1 +1 @@
<a class='authorize__btn' href="#">Authorize</a>
<a class='authorize__btn' href="#" data-sw-translate>Authorize</a>
+28 -4
View File
@@ -1,12 +1,36 @@
<div>
<h3 class="auth__title">Select OAuth2.0 Scopes</h3>
<h3 class="auth__title">OAuth2.0</h3>
<p>{{{sanitize description}}}</p>
{{#if authorizationUrl}}<p>Authorization URL: {{{sanitize authorizationUrl}}}</p>{{/if}}
{{#if tokenUrl}}<p>Token URL: {{{sanitize tokenUrl}}}</p>{{/if}}
<p>flow: {{{escape flow}}}</p>
{{#if isPasswordFlow}}
<p>Please input username and password for password flow authorization</p>
<fieldset>
<div><label>Username: <input class="oauth-username" type="text" name="username"></label></div>
<div><label>Password: <input class="oauth-password" type="password" name="password"></label></div>
</fieldset>
{{/if}}
{{#if clientAuthentication}}
<p>Setup client authentication.{{#if requireClientAuthenticaiton}}(Required){{/if}}</p>
<fieldset>
<div><label>Type:
<select class="oauth-client-authentication-type" name="client-authentication-type">
<option value="none" selected>None or other</option>
<option value="basic">Basic auth</option>
<option value="request-body">Request body</option>
</select>
</label></div>
<div class="oauth-client-authentication" hidden>
<div><label>ClientId: <input class="oauth-client-id" type="text" name="client-id"></label></div>
<div><label>Secret: <input class="oauth-client-secret" type="text" name="client-secret"></label></div>
</div>
</fieldset>
{{/if}}
<p><strong> {{{escape appName}}} </strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>
<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> {{{escape appName}}} </strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>
<p>Authorization URL: {{{sanitize authorizationUrl}}}</p>
<p>flow: {{{escape flow}}}</p>
<ul class="api-popup-scopes">
{{#each scopes}}
<li>
+10 -5
View File
@@ -10,6 +10,11 @@
</span>
</h3>
<ul class='options'>
{{#if showOperationIds}}
<li>
<a href='#!/{{sanitize encodedParentId}}/{{sanitize nickname}}' class="toggleOperation"><span class="nickname">{{{escape nickname}}}()</span></a>
</li>
{{/if}}
<li>
<a href='#!/{{sanitize encodedParentId}}/{{sanitize nickname}}' class="toggleOperation"><span class="markdown">{{{escape summary}}}</span></a>
</li>
@@ -67,11 +72,11 @@
<table class='fullwidth parameters'>
<thead>
<tr>
<th style="width: 100px; max-width: 100px" data-sw-translate>Parameter</th>
<th style="width: 310px; max-width: 310px" data-sw-translate>Value</th>
<th style="width: 200px; max-width: 200px" data-sw-translate>Description</th>
<th style="width: 100px; max-width: 100px" data-sw-translate>Parameter Type</th>
<th style="width: 220px; max-width: 230px" data-sw-translate>Data Type</th>
<th class="param-name-col" data-sw-translate>Parameter</th>
<th class="param-value-col" data-sw-translate>Value</th>
<th class="param-description-col" data-sw-translate>Description</th>
<th class="param-type-col" data-sw-translate>Parameter Type</th>
<th class="param-data-type-col" data-sw-translate>Data Type</th>
</tr>
</thead>
<tbody class="operation-params">
+1 -1
View File
@@ -29,7 +29,7 @@
{{/if}}
</td>
<td class="markdown">{{{sanitize description}}}</td>
<td class="markdown param-description-col">{{{sanitize description}}}</td>
<td>{{{escape paramType}}}</td>
<td>
<span class="model-signature"></span>
+1 -1
View File
@@ -14,6 +14,6 @@
</select>
</td>
<td class="markdown">{{#if required}}<strong>{{/if}}{{{description}}}{{#if required}}</strong>{{/if}}</td>
<td class="markdown param-description-col">{{#if required}}<strong>{{/if}}{{{description}}}{{#if required}}</strong>{{/if}}</td>
<td>{{{escape paramType}}}</td>
<td><span class="model-signature"></span></td>
+1 -1
View File
@@ -11,6 +11,6 @@
{{/if}}
{{/if}}
</td>
<td class="markdown">{{{sanitize description}}}</td>
<td class="markdown param-description-col">{{{sanitize description}}}</td>
<td>{{{escape paramType}}}</td>
<td><span class="model-signature"></span></td>
@@ -10,6 +10,6 @@
{{/if}}
{{/if}}
</td>
<td class="markdown">{{{sanitize description}}}</td>
<td class="markdown param-description-col">{{{sanitize description}}}</td>
<td>{{{escape paramType}}}</td>
<td><span class="model-signature"></span></td>
+2 -2
View File
@@ -18,7 +18,7 @@
{{/if}}
{{else}}
{{#if isFile}}
<input class='parameter' class='required' type='file' name='{{{sanitize name}}}' id='{{{escape valueId}}}'/>
<input class='parameter required' type='file' name='{{{sanitize name}}}' id='{{{escape valueId}}}'/>
{{else}}
{{#renderTextParam this}}
{{/renderTextParam}}
@@ -26,7 +26,7 @@
{{/if}}
</td>
<td>
<strong><span class="markdown">{{{sanitize description}}}</span></strong>
<strong><span class="markdown param-description-col">{{{sanitize description}}}</span></strong>
</td>
<td>{{{escape paramType}}}</td>
<td><span class="model-signature"></span></td>
+39 -12
View File
@@ -23,7 +23,7 @@ templates['apikey_auth'] = template({"1":function(container,depth0,helpers,parti
+ " </div>\n </div>\n</div>\n";
},"useData":true});
templates['auth_button'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
return "<a class='authorize__btn' href=\"#\">Authorize</a>\n";
return "<a class='authorize__btn' href=\"#\" data-sw-translate>Authorize</a>\n";
},"useData":true});
templates['auth_button_operation'] = template({"1":function(container,depth0,helpers,partials,data) {
return " authorize__btn_operation_login\n";
@@ -212,6 +212,28 @@ templates['main'] = template({"1":function(container,depth0,helpers,partials,dat
+ " </h4>\n </div>\n</div>\n";
},"useData":true});
templates['oauth2'] = template({"1":function(container,depth0,helpers,partials,data) {
var stack1;
return "<p>Authorization URL: "
+ ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.authorizationUrl : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "")
+ "</p>";
},"3":function(container,depth0,helpers,partials,data) {
var stack1;
return "<p>Token URL: "
+ ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || helpers.helperMissing).call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.tokenUrl : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "")
+ "</p>";
},"5":function(container,depth0,helpers,partials,data) {
return " <p>Please input username and password for password flow authorization</p>\n <fieldset>\n <div><label>Username: <input class=\"oauth-username\" type=\"text\" name=\"username\"></label></div>\n <div><label>Password: <input class=\"oauth-password\" type=\"password\" name=\"password\"></label></div>\n </fieldset>\n";
},"7":function(container,depth0,helpers,partials,data) {
var stack1;
return " <p>Setup client authentication."
+ ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.requireClientAuthenticaiton : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "</p>\n <fieldset>\n <div><label>Type:\n <select class=\"oauth-client-authentication-type\" name=\"client-authentication-type\">\n <option value=\"none\" selected>None or other</option>\n <option value=\"basic\">Basic auth</option>\n <option value=\"request-body\">Request body</option>\n </select>\n </label></div>\n <div class=\"oauth-client-authentication\" hidden>\n <div><label>ClientId: <input class=\"oauth-client-id\" type=\"text\" name=\"client-id\"></label></div>\n <div><label>Secret: <input class=\"oauth-client-secret\" type=\"text\" name=\"client-secret\"></label></div>\n </div>\n </fieldset>\n";
},"8":function(container,depth0,helpers,partials,data) {
return "(Required)";
},"10":function(container,depth0,helpers,partials,data) {
var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;
return " <li>\n <input class=\"oauth-scope\" type=\"checkbox\" data-scope=\""
@@ -223,9 +245,9 @@ templates['oauth2'] = template({"1":function(container,depth0,helpers,partials,d
+ "</label><br/>\n <span class=\"api-scope-desc\">"
+ ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "")
+ "\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.OAuthSchemeKey : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.OAuthSchemeKey : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </span>\n </li>\n";
},"2":function(container,depth0,helpers,partials,data) {
},"11":function(container,depth0,helpers,partials,data) {
var stack1;
return " ("
@@ -234,16 +256,21 @@ templates['oauth2'] = template({"1":function(container,depth0,helpers,partials,d
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;
return "<div>\n <h3 class=\"auth__title\">Select OAuth2.0 Scopes</h3>\n <p>"
return "<div>\n <h3 class=\"auth__title\">OAuth2.0</h3>\n <p>"
+ ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.description : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "")
+ "</p>\n <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.\n <a href=\"#\">Learn how to use</a>\n </p>\n <p><strong> "
+ ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.appName : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "")
+ " </strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>\n <p>Authorization URL: "
+ ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.authorizationUrl : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "")
+ "</p>\n <p>flow: "
+ "</p>\n "
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.authorizationUrl : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n "
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tokenUrl : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n <p>flow: "
+ ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.flow : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "")
+ "</p>\n <ul class=\"api-popup-scopes\">\n"
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.scopes : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "</p>\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isPasswordFlow : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.clientAuthentication : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " <p><strong> "
+ ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.appName : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "")
+ " </strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>\n <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.\n <a href=\"#\">Learn how to use</a>\n </p>\n <ul class=\"api-popup-scopes\">\n"
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.scopes : depth0),{"name":"each","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </ul>\n</div>";
},"useData":true});
templates['operation'] = template({"1":function(container,depth0,helpers,partials,data) {
@@ -585,7 +612,7 @@ templates['param_required'] = template({"1":function(container,depth0,helpers,pa
},"10":function(container,depth0,helpers,partials,data) {
var stack1, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing;
return " <input class='parameter' class='required' type='file' name='"
return " <input class='parameter required' type='file' name='"
+ ((stack1 = (helpers.sanitize || (depth0 && depth0.sanitize) || alias2).call(alias1,(depth0 != null ? depth0.name : depth0),{"name":"sanitize","hash":{},"data":data})) != null ? stack1 : "")
+ "' id='"
+ ((stack1 = (helpers.escape || (depth0 && depth0.escape) || alias2).call(alias1,(depth0 != null ? depth0.valueId : depth0),{"name":"escape","hash":{},"data":data})) != null ? stack1 : "")