Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49a1169878 | ||
|
|
83468e64a2 | ||
|
|
20aa9643d3 | ||
|
|
7e426ac0cd | ||
|
|
5d75d7d7af | ||
|
|
65d81745ed | ||
|
|
30f0848ac2 | ||
|
|
da7ec89471 | ||
|
|
4885a8abdb | ||
|
|
47ab2a32c0 | ||
|
|
46fbae2f4f | ||
|
|
edeba22a2a | ||
|
|
2cd11efa9d | ||
|
|
81e897a07a | ||
|
|
a63dc0c51b | ||
|
|
bf60526e63 | ||
|
|
7166ba7802 | ||
|
|
1f2a5d7dd7 | ||
|
|
fede96b7b2 | ||
|
|
3fb29ecc61 | ||
|
|
d9b3db4399 |
@@ -24,8 +24,8 @@ 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.6 | 2016-10-14 | 1.1, 1.2, 2.0 | [tag v2.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 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) |
|
||||
|
||||
Vendored
+56
@@ -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":"ο εξυπηρετηρής επέστρεψε"
|
||||
});
|
||||
Vendored
+8
-7
@@ -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;
|
||||
}
|
||||
|
||||
@@ -285,7 +284,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 +294,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 +338,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -11,7 +11,7 @@ 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);
|
||||
|
||||
Vendored
+105
-41
File diff suppressed because one or more lines are too long
Vendored
+8
-8
File diff suppressed because one or more lines are too long
@@ -14,6 +14,8 @@ var header = require('gulp-header');
|
||||
var order = require('gulp-order');
|
||||
var jshint = require('gulp-jshint');
|
||||
var pkg = require('./package.json');
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
|
||||
|
||||
var banner = ['/**',
|
||||
' * <%= pkg.name %> - <%= pkg.description %>',
|
||||
@@ -58,10 +60,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)
|
||||
|
||||
+56
@@ -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":"ο εξυπηρετηρής επέστρεψε"
|
||||
});
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -285,7 +284,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 +294,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 +338,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -43,6 +43,7 @@
|
||||
"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",
|
||||
@@ -60,6 +61,6 @@
|
||||
"phantomjs": "1.9.19",
|
||||
"selenium-webdriver": "^2.45.0",
|
||||
"sinon-chai": "2.8.0",
|
||||
"swagger-client": "2.1.23"
|
||||
"swagger-client": "2.1.25"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ 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);
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -100,8 +100,9 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
|
||||
var scopes = _.map(auth.get('scopes'), function (scope) {
|
||||
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');
|
||||
@@ -109,14 +110,14 @@ SwaggerUi.Views.AuthView = Backbone.View.extend({
|
||||
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 = dets.tokenName || '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 = dets.tokenName || 'access_token';
|
||||
this.clientCredentialsFlow(scopes, dets.tokenUrl, container.OAuthSchemeKey);
|
||||
return;
|
||||
}
|
||||
else if(auth.get('grantTypes')) {
|
||||
@@ -127,13 +128,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 = dets.tokenName;
|
||||
}
|
||||
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 = dets.tokenName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,6 +6,19 @@ SwaggerUi.Models.Oauth2Model = Backbone.Model.extend({
|
||||
},
|
||||
|
||||
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;
|
||||
}
|
||||
this.on('change', this.validate);
|
||||
},
|
||||
|
||||
|
||||
@@ -83,7 +83,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 +258,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 +672,17 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
|
||||
contentType = contentType.split(';')[0].trim();
|
||||
}
|
||||
}
|
||||
if(contentType) {
|
||||
if(typeof content === 'string') {
|
||||
var arrayBuffer = new ArrayBuffer(content.length);
|
||||
var uint8Array = new Uint8Array(arrayBuffer);
|
||||
for (var i = 0; i < content.length; i++) {
|
||||
uint8Array[i] = content.charCodeAt(i);
|
||||
}
|
||||
|
||||
content = new Blob([uint8Array], { type: contentType });
|
||||
}
|
||||
}
|
||||
$('.response_body', $(this.el)).removeClass('json');
|
||||
$('.response_body', $(this.el)).removeClass('xml');
|
||||
|
||||
@@ -687,7 +698,9 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
|
||||
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'])) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user