Merge remote-tracking branch 'swagger-api/master'

This commit is contained in:
Anna Bodnia
2016-01-18 17:59:13 +02:00
25 changed files with 262 additions and 84 deletions

View File

@@ -1,4 +1,3 @@
SwaggerUI uses [SwaggerJS](https://github.com/swagger-api/swagger-js) library for many internal operations. If you see errors in SwaggerUI uses [SwaggerJS](https://github.com/swagger-api/swagger-js) library for many internal operations. If you see errors in swagger-client.js code, you should probably open the issue in [SwaggerJS](https://github.com/swagger-api/swagger-js) repository.
[`swagger-client.js`](lib/swagger-client.js) file, you should probably open the issue in [SwaggerJS](https://github.com/swagger-api/swagger-js) repository.
Please open issues related to Swagger specifications in [Swagger Specs](https://github.com/swagger-api/swagger-spec) repository. Please open issues related to OpenAPI Specifications in [OpenAPI Specs](https://github.com/OAI/OpenAPI-Specification) repository.

View File

@@ -1,4 +1,4 @@
Copyright 2015 SmartBear Software Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@@ -16,15 +16,15 @@ generate beautiful documentation and sandbox from a Swagger-compliant API. Becau
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service. The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service.
Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more. Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more.
## Compatibility ## Compatibility
The Swagger Specification has undergone 4 revisions since initial creation in 2010. Compatibility between swagger-ui and the Swagger specification is as follows: The OpenAPI Specification has undergone 4 revisions since initial creation in 2010. Compatibility between swagger-ui and the OpenAPI Specification is as follows:
Swagger UI Version | Release Date | Swagger Spec compatibility | Notes | Status Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
------------------ | ------------ | -------------------------- | ----- | ------ ------------------ | ------------ | -------------------------- | ----- | ------
2.1.1 | 2015-07-23 | 1.1, 1.2, 2.0 | [tag v.2.1.1](https://github.com/swagger-api/swagger-ui/tree/v2.1.1) | 2.1.4 | 2016-01-06 | 1.1, 1.2, 2.0 | [tag v.2.1.4](https://github.com/swagger-api/swagger-ui/tree/v2.1.1) |
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) | 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.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) | 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) |
@@ -89,9 +89,9 @@ swaggerUi.load();
Parameter Name | Description Parameter Name | Description
--- | --- --- | ---
url | The url pointing to `swagger.json` (Swagger 2.0) or the resource listing (earlier versions) as per [Swagger Spec](https://github.com/swagger-api/swagger-spec/). url | The url pointing to `swagger.json` (Swagger 2.0) or the resource listing (earlier versions) as per [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification/).
authorizations | An authorization object to be passed to swagger-js. Setting it here will trigger inclusion of any authorization or custom signing logic when fetching the swagger description file. Note the object structure should be `{ key: AuthorizationObject }` authorizations | An authorization object to be passed to swagger-js. Setting it here will trigger inclusion of any authorization or custom signing logic when fetching the swagger description file. Note the object structure should be `{ key: AuthorizationObject }`
spec | A JSON object describing the Swagger specification. When used, the `url` parameter will not be parsed. This is useful for testing manually-generated specifications without hosting them. Works for Swagger 2.0 specs only. spec | A JSON object describing the OpenAPI Specification. When used, the `url` parameter will not be parsed. This is useful for testing manually-generated specifications without hosting them. Works for Swagger 2.0 specs only.
validatorUrl | By default, Swagger-UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it to `null` will disable validation. This parameter is relevant for Swagger 2.0 specs only. validatorUrl | By default, Swagger-UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it to `null` will disable validation. This parameter is relevant for Swagger 2.0 specs only.
dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger. dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger.
booleanValues | SwaggerUI renders boolean data types as a dropdown. By default it provides a 'true' and 'false' string as the possible choices. You can use this parameter to change the values in dropdown to be something else, for example 0 and 1 by setting booleanValues to new Array(0, 1). booleanValues | SwaggerUI renders boolean data types as a dropdown. By default it provides a 'true' and 'false' string as the possible choices. You can use this parameter to change the values in dropdown to be something else, for example 0 and 1 by setting booleanValues to new Array(0, 1).
@@ -236,7 +236,7 @@ Please see [releases](https://github.com/swagger-api/swagger-ui/releases) for ch
## License ## License
Copyright 2011-2015 SmartBear Software Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@@ -12,7 +12,7 @@
"Swagger", "Swagger",
"API" "API"
], ],
"license": "Copyright 2015 SmartBear Software", "license": "Copyright 2016 SmartBear Software",
"homepage": "http://swagger.io", "homepage": "http://swagger.io",
"private": true, "private": true,
"ignore": [ "ignore": [

2
dist/css/print.css vendored
View File

@@ -82,7 +82,7 @@
.swagger-section pre .vhdl .attribute, .swagger-section pre .vhdl .attribute,
.swagger-section pre .clojure .attribute, .swagger-section pre .clojure .attribute,
.swagger-section pre .coffeescript .property { .swagger-section pre .coffeescript .property {
color: #88F; color: #8888ff;
} }
.swagger-section pre .keyword, .swagger-section pre .keyword,
.swagger-section pre .id, .swagger-section pre .id,

2
dist/css/screen.css vendored
View File

@@ -82,7 +82,7 @@
.swagger-section pre .vhdl .attribute, .swagger-section pre .vhdl .attribute,
.swagger-section pre .clojure .attribute, .swagger-section pre .clojure .attribute,
.swagger-section pre .coffeescript .property { .swagger-section pre .coffeescript .property {
color: #88F; color: #8888ff;
} }
.swagger-section pre .keyword, .swagger-section pre .keyword,
.swagger-section pre .id, .swagger-section pre .id,

Binary file not shown.

Binary file not shown.

2
dist/lang/en.js vendored
View File

@@ -30,6 +30,7 @@ window.SwaggerTranslator.learn({
"can't parse JSON. Raw result":"can't parse JSON. Raw result", "can't parse JSON. Raw result":"can't parse JSON. Raw result",
"Model Schema":"Model Schema", "Model Schema":"Model Schema",
"Model":"Model", "Model":"Model",
"Click to set as parameter value":"Click to set as parameter value",
"apply":"apply", "apply":"apply",
"Username":"Username", "Username":"Username",
"Password":"Password", "Password":"Password",
@@ -39,6 +40,7 @@ window.SwaggerTranslator.learn({
"Contact the developer":"Contact the developer", "Contact the developer":"Contact the developer",
"api version":"api version", "api version":"api version",
"Response Content Type":"Response Content Type", "Response Content Type":"Response Content Type",
"Parameter content type:":"Parameter content type:",
"fetching resource":"fetching resource", "fetching resource":"fetching resource",
"fetching resource list":"fetching resource list", "fetching resource list":"fetching resource list",
"Explore":"Explore", "Explore":"Explore",

53
dist/lang/pl.js vendored Normal file
View File

@@ -0,0 +1,53 @@
'use strict';
/* jshint quotmark: double */
window.SwaggerTranslator.learn({
"Warning: Deprecated":"Uwaga: Wycofane",
"Implementation Notes":"Uwagi Implementacji",
"Response Class":"Klasa Odpowiedzi",
"Status":"Status",
"Parameters":"Parametry",
"Parameter":"Parametr",
"Value":"Wartość",
"Description":"Opis",
"Parameter Type":"Typ Parametru",
"Data Type":"Typ Danych",
"Response Messages":"Wiadomości Odpowiedzi",
"HTTP Status Code":"Kod Statusu HTTP",
"Reason":"Przyczyna",
"Response Model":"Model Odpowiedzi",
"Request URL":"URL Wywołania",
"Response Body":"Treść Odpowiedzi",
"Response Code":"Kod Odpowiedzi",
"Response Headers":"Nagłówki Odpowiedzi",
"Hide Response":"Ukryj Odpowiedź",
"Headers":"Nagłówki",
"Try it out!":"Wypróbuj!",
"Show/Hide":"Pokaż/Ukryj",
"List Operations":"Lista Operacji",
"Expand Operations":"Rozwiń Operacje",
"Raw":"Nieprzetworzone",
"can't parse JSON. Raw result":"nie można przetworzyć pliku JSON. Nieprzetworzone dane",
"Model Schema":"Schemat Modelu",
"Model":"Model",
"apply":"użyj",
"Username":"Nazwa użytkownika",
"Password":"Hasło",
"Terms of service":"Warunki używania",
"Created by":"Utworzone przez",
"See more at":"Zobacz więcej na",
"Contact the developer":"Kontakt z deweloperem",
"api version":"wersja api",
"Response Content Type":"Typ Zasobu Odpowiedzi",
"fetching resource":"ładowanie zasobu",
"fetching resource list":"ładowanie listy zasobów",
"Explore":"Eksploruj",
"Show Swagger Petstore Example Apis":"Pokaż Przykładowe Api Swagger Petstore",
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Brak połączenia z serwerem. Może on nie mieć odpowiednich ustawień access-control-origin.",
"Please specify the protocol for":"Proszę podać protokół dla",
"Can't read swagger JSON from":"Nie można odczytać swagger JSON z",
"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ł"
});

11
dist/lang/ru.js vendored
View File

@@ -2,7 +2,7 @@
/* jshint quotmark: double */ /* jshint quotmark: double */
window.SwaggerTranslator.learn({ window.SwaggerTranslator.learn({
"Warning: Deprecated":"Ворнинг: Депрекейтед", "Warning: Deprecated":"Предупреждение: Устарело",
"Implementation Notes":"Заметки", "Implementation Notes":"Заметки",
"Response Class":"Пример ответа", "Response Class":"Пример ответа",
"Status":"Статус", "Status":"Статус",
@@ -20,6 +20,7 @@ window.SwaggerTranslator.learn({
"Response Code":"HTTP код ответа", "Response Code":"HTTP код ответа",
"Response Headers":"Заголовки ответа", "Response Headers":"Заголовки ответа",
"Hide Response":"Спрятать ответ", "Hide Response":"Спрятать ответ",
"Headers":"Заголовки",
"Response Messages":"Что может прийти в ответ", "Response Messages":"Что может прийти в ответ",
"Try it out!":"Попробовать!", "Try it out!":"Попробовать!",
"Show/Hide":"Показать/Скрыть", "Show/Hide":"Показать/Скрыть",
@@ -29,6 +30,7 @@ window.SwaggerTranslator.learn({
"can't parse JSON. Raw result":"Не удается распарсить ответ:", "can't parse JSON. Raw result":"Не удается распарсить ответ:",
"Model Schema":"Структура", "Model Schema":"Структура",
"Model":"Описание", "Model":"Описание",
"Click to set as parameter value":"Нажмите, чтобы испльзовать в качестве значения параметра",
"apply":"применить", "apply":"применить",
"Username":"Имя пользователя", "Username":"Имя пользователя",
"Password":"Пароль", "Password":"Пароль",
@@ -38,12 +40,13 @@ window.SwaggerTranslator.learn({
"Contact the developer":"Связаться с разработчиком", "Contact the developer":"Связаться с разработчиком",
"api version":"Версия API", "api version":"Версия API",
"Response Content Type":"Content Type ответа", "Response Content Type":"Content Type ответа",
"Parameter content type:":"Content Type параметра:",
"fetching resource":"Получение ресурса", "fetching resource":"Получение ресурса",
"fetching resource list":"Получение ресурсов", "fetching resource list":"Получение ресурсов",
"Explore":"Поехали", "Explore":"Показать",
"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.":"Не удается получить ответ от сервера. Возможно, какая-то лажа с настройками доступа", "Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, проблема с настройками доступа",
"Please specify the protocol for":"Пожалуйста, укажите протогол для", "Please specify the protocol for":"Пожалуйста, укажите протокол для",
"Can't read swagger JSON from":"Не получается прочитать swagger json из", "Can't read swagger JSON from":"Не получается прочитать swagger json из",
"Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим", "Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим",
"Unable to read api":"Не удалось прочитать api", "Unable to read api":"Не удалось прочитать api",

139
dist/swagger-ui.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -30,6 +30,7 @@ window.SwaggerTranslator.learn({
"can't parse JSON. Raw result":"can't parse JSON. Raw result", "can't parse JSON. Raw result":"can't parse JSON. Raw result",
"Model Schema":"Model Schema", "Model Schema":"Model Schema",
"Model":"Model", "Model":"Model",
"Click to set as parameter value":"Click to set as parameter value",
"apply":"apply", "apply":"apply",
"Username":"Username", "Username":"Username",
"Password":"Password", "Password":"Password",
@@ -39,6 +40,7 @@ window.SwaggerTranslator.learn({
"Contact the developer":"Contact the developer", "Contact the developer":"Contact the developer",
"api version":"api version", "api version":"api version",
"Response Content Type":"Response Content Type", "Response Content Type":"Response Content Type",
"Parameter content type:":"Parameter content type:",
"fetching resource":"fetching resource", "fetching resource":"fetching resource",
"fetching resource list":"fetching resource list", "fetching resource list":"fetching resource list",
"Explore":"Explore", "Explore":"Explore",

53
lang/pl.js Normal file
View File

@@ -0,0 +1,53 @@
'use strict';
/* jshint quotmark: double */
window.SwaggerTranslator.learn({
"Warning: Deprecated":"Uwaga: Wycofane",
"Implementation Notes":"Uwagi Implementacji",
"Response Class":"Klasa Odpowiedzi",
"Status":"Status",
"Parameters":"Parametry",
"Parameter":"Parametr",
"Value":"Wartość",
"Description":"Opis",
"Parameter Type":"Typ Parametru",
"Data Type":"Typ Danych",
"Response Messages":"Wiadomości Odpowiedzi",
"HTTP Status Code":"Kod Statusu HTTP",
"Reason":"Przyczyna",
"Response Model":"Model Odpowiedzi",
"Request URL":"URL Wywołania",
"Response Body":"Treść Odpowiedzi",
"Response Code":"Kod Odpowiedzi",
"Response Headers":"Nagłówki Odpowiedzi",
"Hide Response":"Ukryj Odpowiedź",
"Headers":"Nagłówki",
"Try it out!":"Wypróbuj!",
"Show/Hide":"Pokaż/Ukryj",
"List Operations":"Lista Operacji",
"Expand Operations":"Rozwiń Operacje",
"Raw":"Nieprzetworzone",
"can't parse JSON. Raw result":"nie można przetworzyć pliku JSON. Nieprzetworzone dane",
"Model Schema":"Schemat Modelu",
"Model":"Model",
"apply":"użyj",
"Username":"Nazwa użytkownika",
"Password":"Hasło",
"Terms of service":"Warunki używania",
"Created by":"Utworzone przez",
"See more at":"Zobacz więcej na",
"Contact the developer":"Kontakt z deweloperem",
"api version":"wersja api",
"Response Content Type":"Typ Zasobu Odpowiedzi",
"fetching resource":"ładowanie zasobu",
"fetching resource list":"ładowanie listy zasobów",
"Explore":"Eksploruj",
"Show Swagger Petstore Example Apis":"Pokaż Przykładowe Api Swagger Petstore",
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Brak połączenia z serwerem. Może on nie mieć odpowiednich ustawień access-control-origin.",
"Please specify the protocol for":"Proszę podać protokół dla",
"Can't read swagger JSON from":"Nie można odczytać swagger JSON z",
"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ł"
});

View File

@@ -2,7 +2,7 @@
/* jshint quotmark: double */ /* jshint quotmark: double */
window.SwaggerTranslator.learn({ window.SwaggerTranslator.learn({
"Warning: Deprecated":"Ворнинг: Депрекейтед", "Warning: Deprecated":"Предупреждение: Устарело",
"Implementation Notes":"Заметки", "Implementation Notes":"Заметки",
"Response Class":"Пример ответа", "Response Class":"Пример ответа",
"Status":"Статус", "Status":"Статус",
@@ -20,6 +20,7 @@ window.SwaggerTranslator.learn({
"Response Code":"HTTP код ответа", "Response Code":"HTTP код ответа",
"Response Headers":"Заголовки ответа", "Response Headers":"Заголовки ответа",
"Hide Response":"Спрятать ответ", "Hide Response":"Спрятать ответ",
"Headers":"Заголовки",
"Response Messages":"Что может прийти в ответ", "Response Messages":"Что может прийти в ответ",
"Try it out!":"Попробовать!", "Try it out!":"Попробовать!",
"Show/Hide":"Показать/Скрыть", "Show/Hide":"Показать/Скрыть",
@@ -29,6 +30,7 @@ window.SwaggerTranslator.learn({
"can't parse JSON. Raw result":"Не удается распарсить ответ:", "can't parse JSON. Raw result":"Не удается распарсить ответ:",
"Model Schema":"Структура", "Model Schema":"Структура",
"Model":"Описание", "Model":"Описание",
"Click to set as parameter value":"Нажмите, чтобы испльзовать в качестве значения параметра",
"apply":"применить", "apply":"применить",
"Username":"Имя пользователя", "Username":"Имя пользователя",
"Password":"Пароль", "Password":"Пароль",
@@ -38,12 +40,13 @@ window.SwaggerTranslator.learn({
"Contact the developer":"Связаться с разработчиком", "Contact the developer":"Связаться с разработчиком",
"api version":"Версия API", "api version":"Версия API",
"Response Content Type":"Content Type ответа", "Response Content Type":"Content Type ответа",
"Parameter content type:":"Content Type параметра:",
"fetching resource":"Получение ресурса", "fetching resource":"Получение ресурса",
"fetching resource list":"Получение ресурсов", "fetching resource list":"Получение ресурсов",
"Explore":"Поехали", "Explore":"Показать",
"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.":"Не удается получить ответ от сервера. Возможно, какая-то лажа с настройками доступа", "Can't read from server. It may not have the appropriate access-control-origin settings.":"Не удается получить ответ от сервера. Возможно, проблема с настройками доступа",
"Please specify the protocol for":"Пожалуйста, укажите протогол для", "Please specify the protocol for":"Пожалуйста, укажите протокол для",
"Can't read swagger JSON from":"Не получается прочитать swagger json из", "Can't read swagger JSON from":"Не получается прочитать swagger json из",
"Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим", "Finished Loading Resource Information. Rendering Swagger UI":"Загрузка информации о ресурсах завершена. Рендерим",
"Unable to read api":"Не удалось прочитать api", "Unable to read api":"Не удалось прочитать api",

View File

@@ -50,6 +50,6 @@
"less": "^2.4.0", "less": "^2.4.0",
"mocha": "^2.1.0", "mocha": "^2.1.0",
"selenium-webdriver": "^2.45.0", "selenium-webdriver": "^2.45.0",
"swagger-client": "2.1.9" "swagger-client": "2.1.11"
} }
} }

View File

@@ -82,7 +82,7 @@
.swagger-section pre .vhdl .attribute, .swagger-section pre .vhdl .attribute,
.swagger-section pre .clojure .attribute, .swagger-section pre .clojure .attribute,
.swagger-section pre .coffeescript .property { .swagger-section pre .coffeescript .property {
color: #88F; color: #8888ff;
} }
.swagger-section pre .keyword, .swagger-section pre .keyword,
.swagger-section pre .id, .swagger-section pre .id,

View File

@@ -82,7 +82,7 @@
.swagger-section pre .vhdl .attribute, .swagger-section pre .vhdl .attribute,
.swagger-section pre .clojure .attribute, .swagger-section pre .clojure .attribute,
.swagger-section pre .coffeescript .property { .swagger-section pre .coffeescript .property {
color: #88F; color: #8888ff;
} }
.swagger-section pre .keyword, .swagger-section pre .keyword,
.swagger-section pre .id, .swagger-section pre .id,

View File

@@ -57,7 +57,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
if ('validatorUrl' in opts.swaggerOptions) { if ('validatorUrl' in opts.swaggerOptions) {
// Validator URL specified explicitly // Validator URL specified explicitly
this.model.validatorUrl = opts.swaggerOptions.validatorUrl; this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
} else if (this.model.url.indexOf('localhost') > 0) { } else if (this.model.url.indexOf('localhost') > 0 || this.model.url.indexOf('127.0.0.1') > 0) {
// Localhost override // Localhost override
this.model.validatorUrl = null; this.model.validatorUrl = null;
} else { } else {

View File

@@ -19,10 +19,10 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
this.parentId = this.model.parentId; this.parentId = this.model.parentId;
this.nickname = this.model.nickname; this.nickname = this.model.nickname;
this.model.encodedParentId = encodeURIComponent(this.parentId); this.model.encodedParentId = encodeURIComponent(this.parentId);
if (opts.swaggerOptions) { if (opts.swaggerOptions) {
this.model.defaultRendering = opts.swaggerOptions.defaultModelRendering; this.model.defaultRendering = opts.swaggerOptions.defaultModelRendering;
if (opts.swaggerOptions.showRequestHeaders) { if (opts.swaggerOptions.showRequestHeaders) {
this.model.showRequestHeaders = true; this.model.showRequestHeaders = true;
} }
@@ -275,7 +275,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// This is required for JsonEditor to display the root properly // This is required for JsonEditor to display the root properly
if(!param.schema.type){ if(!param.schema.type){
param.schema.type = 'object'; param.schema.type = 'object';
} }
// This is the title that will be used by JsonEditor for the root // This is the title that will be used by JsonEditor for the root
// Since we already display the parameter's name in the Parameter column // Since we already display the parameter's name in the Parameter column
// We set this to space, we can't set it to null or space otherwise JsonEditor // We set this to space, we can't set it to null or space otherwise JsonEditor
@@ -283,7 +283,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
if(!param.schema.title){ if(!param.schema.title){
param.schema.title = ' '; param.schema.title = ' ';
} }
} }
var paramView = new SwaggerUi.Views.ParameterView({ var paramView = new SwaggerUi.Views.ParameterView({
model: param, model: param,
@@ -704,7 +704,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// adds curl output // adds curl output
var curlCommand = this.model.asCurl(this.map, {responseContentType: contentType}); var curlCommand = this.model.asCurl(this.map, {responseContentType: contentType});
curlCommand = curlCommand.replace('!', '!'); curlCommand = curlCommand.replace('!', '!');
$( 'div.curl', $(this.el)).html('<pre>' + curlCommand + '</pre>'); $( 'div.curl', $(this.el)).html('<pre>' + _.escape(curlCommand) + '</pre>');
// only highlight the response if response is less than threshold, default state is highlight response // only highlight the response if response is less than threshold, default state is highlight response
var opts = this.options.swaggerOptions; var opts = this.options.swaggerOptions;

View File

@@ -2,7 +2,7 @@
<select name="contentType" id="{{contentTypeId}}"> <select name="contentType" id="{{contentTypeId}}">
{{#if produces}} {{#if produces}}
{{#each produces}} {{#each produces}}
<option value="{{this}}">{{{this}}}</option> <option value="{{this}}">{{this}}</option>
{{/each}} {{/each}}
{{else}} {{else}}
<option value="application/json">application/json</option> <option value="application/json">application/json</option>

View File

@@ -1,8 +1,8 @@
<label for="{{parameterContentTypeId}}">Parameter content type:</label> <label for="{{parameterContentTypeId}}" data-sw-translate>Parameter content type:</label>
<select name="parameterContentType" id="{{parameterContentTypeId}}"> <select name="parameterContentType" id="{{parameterContentTypeId}}">
{{#if consumes}} {{#if consumes}}
{{#each consumes}} {{#each consumes}}
<option value="{{this}}">{{{this}}}</option> <option value="{{this}}">{{this}}</option>
{{/each}} {{/each}}
{{else}} {{else}}
<option value="application/json">application/json</option> <option value="application/json">application/json</option>

View File

@@ -2,7 +2,7 @@
<select name="responseContentType" id="{{responseContentTypeId}}"> <select name="responseContentType" id="{{responseContentTypeId}}">
{{#if produces}} {{#if produces}}
{{#each produces}} {{#each produces}}
<option value="{{this}}">{{{this}}}</option> <option value="{{this}}">{{this}}</option>
{{/each}} {{/each}}
{{else}} {{else}}
<option value="application/json">application/json</option> <option value="application/json">application/json</option>

View File

@@ -12,7 +12,7 @@
<div class="snippet"> <div class="snippet">
<pre><code>{{sampleJSON}}</code></pre> <pre><code>{{sampleJSON}}</code></pre>
<small class="notice"></small> <small class="notice" data-sw-translate></small>
</div> </div>
</div> </div>