Compare commits

...
97 Commits
Author SHA1 Message Date
Kyle Shockey db8bd52f16 v3.0.6 2017-04-14 21:08:42 -07:00
Kyle Shockey 7172ed6fe9 Rebuild dist 2017-04-14 21:05:22 -07:00
Kyle Shockey 48e0cb10b5 Revert "Fix bug where reducer dies on empty operation"
This reverts commit 08b3c38b8a.
2017-04-14 21:00:56 -07:00
Kyle Shockey bedd509a4a Rebuild dist 2017-04-14 20:19:13 -07:00
shockey c6279e5f25 Merge pull request #2917 from shockey/ft/base-layout
Base layout
2017-04-14 19:07:21 -07:00
Kyle Shockey 81f74d9d51 Move loadingStatus code into StandaloneLayout (where it belongs!) 2017-04-14 19:01:57 -07:00
Kyle Shockey 208694e9a8 Fix linter & tests 2017-04-14 18:46:27 -07:00
Kyle Shockey ba7a1369b8 Dist rebuild 2017-04-14 18:41:34 -07:00
Kyle Shockey d1d663b35f Consume BaseLayout in UI standalone 2017-04-14 18:39:31 -07:00
Kyle Shockey cf80839d11 Add BaseLayout to core 2017-04-14 18:38:59 -07:00
Kyle Shockey de92f8deb4 Merge branch 'master' of github.com:swagger-api/swagger-ui 2017-04-14 18:22:29 -07:00
Kyle Shockey 99b8543562 Merge branch 'show_readonly_values_in_responses' of https://github.com/furkanayhan/swagger-ui into furkanayhan-show_readonly_values_in_responses 2017-04-14 18:21:44 -07:00
Tony Tam ef60fb07a4 added push 2017-04-14 17:35:09 -07:00
Kyle Shockey c45e5a3158 Rebuild dist 2017-04-14 17:16:25 -07:00
Kyle Shockey 08b3c38b8a Fix bug where reducer dies on empty operation 2017-04-14 17:15:27 -07:00
shockey c7ae644c96 Merge pull request #2912 from shockey/bug/2904-try-it-out
Fix inferring issues with Try-It-Out
2017-04-14 16:42:04 -07:00
Tony Tam 283722a20e added push 2017-04-14 14:36:29 -07:00
Tony Tam 89adefe392 Merge pull request #2916 from swagger-api/feature/docker-tag-fix
Feature/docker tag fix
2017-04-14 17:28:20 -04:00
Tony Tam 205197d04f fixed variable 2017-04-14 14:19:52 -07:00
Tony Tam 74008954c3 update tag logic to latest and unstable 2017-04-14 14:13:11 -07:00
Tony Tam 2b159372a9 removed dead line 2017-04-14 14:12:55 -07:00
Kyle Shockey 5be31ac909 Pass around contextUrl correctly 2017-04-13 19:24:02 -07:00
Kyle Shockey fce0916dca Merge branch 'bug/2760-infer-host' into bug/2904-try-it-out 2017-04-13 19:12:39 -07:00
Kyle Shockey 4c1a5488bb Parse spec url when deciding scheme for operation 2017-04-13 17:26:47 -07:00
Furkan Ayhan 2e91ab0a2e Add react-test-renderer as devDependencies 2017-04-13 16:36:35 +03:00
Furkan Ayhan 6965a496fb Show readOnly values in responses 2017-04-13 16:01:29 +03:00
Tony Tam e33efa1b36 Merge pull request #2901 from swagger-api/feature/docker-config
added variables for docker
2017-04-11 17:07:26 -04:00
Tony Tam 3ce9baee30 added variables for docker 2017-04-11 13:59:34 -07:00
Tony Tam 1f424afe0f Merge pull request #2900 from swagger-api/issue-2899
updated docker push logic
2017-04-11 16:48:59 -04:00
Tony Tam 4da6126d10 Merge branch 'master' into issue-2899 2017-04-11 16:43:13 -04:00
Tony Tam 9465d1251b updated docker push logic 2017-04-11 13:42:26 -07:00
shockey f7c5515dff Merge pull request #2894 from shockey/bug/2763-malformed-security-render-error
Protect AuthorizeOperationBtn from malformed security values
2017-04-10 14:03:49 -07:00
shockey 44ea2773cf Merge branch 'master' into bug/2763-malformed-security-render-error 2017-04-10 13:58:48 -07:00
Kyle Shockey 3c98939732 Fix name masking for render error messages 2017-04-10 13:58:18 -07:00
Kyle Shockey f2ae188722 Fix #2763 2017-04-10 13:50:51 -07:00
shockey 5e571fac51 Merge pull request #2821 from jeffweeksio/master
Update utils.js to allow negative numbers
2017-04-10 11:29:25 -07:00
shockey 8e60343417 Merge branch 'master' into master 2017-04-10 11:21:23 -07:00
Kyle Shockey 1b6da44cb5 v3.0.5 2017-04-07 21:44:40 -07:00
Kyle Shockey b120c115aa Use latest swagger-client; rebuild dist 2017-04-07 21:41:27 -07:00
Kyle Shockey e2b1757f8f Infer contextUrl through documentation scheme + host if spec url is relative 2017-04-07 20:51:07 -07:00
Anna 3c0fe96dde Merge pull request #2877 from bodnia/config-with-url
config passed with configUrl in constructor
2017-04-07 16:04:05 +03:00
Anna Bodnia eb4fa2a6b4 Merge remote-tracking branch 'upstream/master' into config-with-url 2017-04-07 15:57:24 +03:00
Anna 4fd5d9f643 Merge pull request #2878 from bodnia/fix-auth-schemes-display
fix schemes auth button display #2816
2017-04-07 15:51:24 +03:00
Anna Bodnia cfb9ddd675 removed not used variable 2017-04-07 15:43:25 +03:00
Anna Bodnia 63edfc739b fix schemes auth button display #2816 2017-04-07 15:39:59 +03:00
Anna Bodnia 8130168c97 config passed with configUrl in constructor 2017-04-07 15:17:27 +03:00
shockey c9e90fd975 Merge pull request #2860 from swagger-api/public-gone
gone with the public
2017-04-06 17:01:17 -07:00
shockey dc67698a48 Merge branch 'master' into public-gone 2017-04-06 16:51:38 -07:00
Kyle Shockey 5f9efc09cb Merge branch 'master' of https://github.com/marcgibbons/swagger-ui into marcgibbons-master 2017-04-06 16:44:47 -07:00
Anna 724c8c51d5 Merge pull request #2864 from misi/master
Implement Application/Client Credentials  Flow
2017-04-06 15:50:39 +03:00
Mészáros Mihály 81abe37a31 add fn.fetch instead of native fetch 2017-04-06 14:46:04 +02:00
Mészáros Mihály 4066d1920e move out the code according @bodnia guide 2017-04-06 13:12:28 +02:00
Mészáros Mihály 9b35b7bf5c Merge branch 'master' of github.com:misi/swagger-ui 2017-04-06 08:19:35 +02:00
Mészáros Mihály 593e8de4c8 fix rm unintentieonaly staged file 2017-04-06 08:17:39 +02:00
misi c7f2cd6543 Merge branch 'master' into master 2017-04-06 08:08:34 +02:00
Mészáros Mihály a4500d1763 fix error handling 2017-04-06 08:03:36 +02:00
Mészáros Mihály ec1ba7a124 fix most lint errors 2017-04-06 06:08:52 +02:00
shockey 5f3a7a2e82 Merge pull request #2865 from shockey/bug/no-line-numbers-without-jumptoline
Improve spec error messaging
2017-04-05 16:08:32 -07:00
Kyle Shockey 9cfc18c8ee Merge branch 'master' into bug/no-line-numbers-without-jumptoline 2017-04-05 15:50:55 -07:00
Kyle Shockey 8bae745f78 Improve spec error messaging 2017-04-05 15:42:22 -07:00
Mészáros Mihály c8aaf0d3f3 Merge branch 'master' of github.com:misi/swagger-ui 2017-04-05 20:22:01 +02:00
Mészáros Mihály ae33b7f46a Implement application/client_credentials flow 2017-04-05 20:20:23 +02:00
Mészáros Mihály 823dcf0fd7 Authenticate Application/client_credentials flow 2017-04-05 20:16:34 +02:00
Mészáros Mihály ac8ac340af add posdt for application and get token 2017-04-05 15:53:26 +02:00
Anna 7a0cc20b5c Merge pull request #2863 from bodnia/fix-2816
fix #2816
2017-04-05 16:02:11 +03:00
Anna Bodnia f27f1b7808 fix #2816 2017-04-05 15:57:23 +03:00
shockey 8b64f475d7 Merge pull request #2861 from shockey/bug/jump-line-missing
Fix render issues that occur when jumpToLine isn't provided
2017-04-04 17:54:54 -07:00
shockey 05b2605545 Merge branch 'master' into bug/jump-line-missing 2017-04-04 17:51:16 -07:00
Kyle Shockey 0ee0236666 Fix render issues that occurs when jumpToLine isn't provided 2017-04-04 17:45:37 -07:00
shockey 8c023c907d Update paths in index.html 2017-04-04 15:38:34 -07:00
Ron 7f525a8730 gone with the public 2017-04-04 14:37:45 -07:00
Ron ad4fe9cbd5 Merge pull request #2836 from pwielgolaski/patch-1
Fix location of index.html in README.md
2017-04-04 14:01:47 -07:00
Ron e08df745dd Merge branch 'master' into patch-1 2017-04-04 13:57:59 -07:00
Ron 96f855ece7 Merge pull request #2859 from swagger-api/Update-composer
Update composer.json
2017-04-04 12:28:42 -07:00
Ron 95f7d6546a Update composer.json 2017-04-04 12:25:07 -07:00
Ron 28267b7bb0 Merge pull request #2858 from swagger-api/PHP-Composer
Create composer.json
2017-04-04 12:04:48 -07:00
Jeff Weeks 2535758adf Merge branch 'master' into master 2017-04-04 14:26:48 -04:00
Ron a4ef2be656 Merge branch 'master' into PHP-Composer 2017-04-04 11:26:36 -07:00
shockey d829b4a840 Merge pull request #2857 from swagger-api/UI-Customization
Update README.md
2017-04-04 11:19:41 -07:00
Kyle Shockey f2fc7e2af0 Merge branch 'master' into UI-Customization 2017-04-04 11:13:46 -07:00
Ron ac9c8b5460 Create composer.json 2017-04-04 11:07:55 -07:00
shockey e4c47717eb Update utils.js 2017-04-04 11:06:33 -07:00
Ron e24bc7635f Update README.md 2017-04-04 10:41:22 -07:00
Ron 0c00e03330 Update README.md 2017-04-04 10:34:22 -07:00
Anna b9c1402882 Merge pull request #2853 from bodnia/build-dist
latest build
2017-04-04 16:50:49 +03:00
Anna Bodnia dd8fb58fcd latest build 2017-04-04 16:50:19 +03:00
Anna 381070f655 Merge pull request #2851 from bodnia/fix-2456
fix #2456
2017-04-04 16:10:14 +03:00
Anna Bodnia 59ecaf40ee fix #2456 2017-04-04 16:09:28 +03:00
Anna 436586a661 Merge pull request #2850 from bodnia/fix-2807
fix #2807
2017-04-04 15:08:05 +03:00
Anna Bodnia 5be1ae582c fix #2807 2017-04-04 15:07:34 +03:00
Anna 3ed8efe736 Merge pull request #2848 from bodnia/fix-2839
fix #2839
2017-04-04 14:35:23 +03:00
Anna Bodnia fde75d408e fix #2839 2017-04-04 14:34:59 +03:00
Anna 52331ab494 Merge pull request #2846 from bodnia/fix-2800
fix #2800
2017-04-04 12:40:04 +03:00
Anna Bodnia c86199a506 fix #2800 2017-04-04 12:39:26 +03:00
Piotr Wielgolaski 6cce7713e1 Fix location of index.html in README.md
There is no index.html in `public` folder, so we should use `dist`  I suppose.
2017-04-01 16:30:46 +02:00
Marc Gibbons a1e5f2198e Allow any HTTP headers, send cookies on same origin 2017-03-29 17:18:41 -04:00
Jeff Weeks 2a6ecb2d38 Update utils.js 2017-03-29 16:30:25 -04:00
46 changed files with 527 additions and 196 deletions
+16 -5
View File
@@ -23,10 +23,21 @@ deploy:
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;
if [ ! -z "$TRAVIS_TAG" ]; then
DOCKER_IMAGE_TAG=$TRAVIS_TAG;
else
DOCKER_IMAGE_TAG=unstable;
fi;
docker build -t $DOCKER_IMAGE_NAME .;
if [ ! -z "$TRAVIS_TAG" ]; then
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG;
docker push $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG;
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:latest;
docker push $DOCKER_IMAGE_NAME:latest;
else
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG;
docker push $DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG;
fi;
fi;
+14 -2
View File
@@ -2,15 +2,27 @@ FROM alpine:3.4
MAINTAINER fehguy
ENV VERSION "v2.2.10"
ENV FOLDER "swagger-ui-2.2.10"
ENV API_URL "http://petstore.swagger.io/v2/swagger.json"
ENV API_KEY "**None**"
ENV OAUTH_CLIENT_ID "**None**"
ENV OAUTH_CLIENT_SECRET "**None**"
ENV OAUTH_REALM "**None**"
ENV OAUTH_APP_NAME "**None**"
ENV OAUTH_ADDITIONAL_PARAMS "**None**"
ENV SWAGGER_JSON "/app/swagger.json"
ENV PORT 80
RUN apk add --update nginx
RUN mkdir -p /run/nginx
COPY nginx.conf /etc/nginx/
# copy swagger files to the `/js` folder
ADD ./public/* /usr/share/nginx/html/
ADD ./dist/* /usr/share/nginx/html/
ADD ./docker-run.sh /usr/share/nginx/
EXPOSE 8080
CMD exec nginx -g 'daemon off;'
CMD ["sh", "/usr/share/nginx/docker-run.sh"]
+32 -3
View File
@@ -15,7 +15,7 @@ The OpenAPI Specification has undergone 4 revisions since initial creation in 20
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
------------------ | ------------ | -------------------------- | ----- | ------
3.0.4 | 2017-03-19 | 2.0 | [tag v3.0.4](https://github.com/swagger-api/swagger-ui/tree/v3.0.4) |
3.0.6 | 2017-03-19 | 2.0 | [tag v3.0.6](https://github.com/swagger-api/swagger-ui/tree/v3.0.6) |
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) |
@@ -39,7 +39,7 @@ Will start nginx with swagger-ui on port 80.
- Node 6.x
- NPM 3.x
If you just want to see your specs, open `public/index.html` in your browser directly from your filesystem.
If you just want to see your specs, open `dist/index.html` in your browser directly from your filesystem.
If you'd like to make modifications to the codebase, run the dev server with: `npm run dev`.
@@ -50,13 +50,42 @@ Swagger UI works in the latest versions of Chrome, Safari, Firefox, Edge and IE1
To help with the migration, here are the currently known issues with 3.X. This list will update regularly, and will not include features that were not implemented in previous versions.
- Currently, the only configuration options available are the `url` and `spec`.
- Only part of the [parameters](#parameters) previously supported are available.
- The JSON Form Editor is not implemented.
- Shebang URL support for operations is missing.
- Support for `collectionFormat` is partial.
- l10n (translations) is not implemented.
- Relative path support for external files is not implemented.
### SwaggerUIBundle
To use swagger-ui you should take a look at the [source of swagger-ui html page](https://github.com/swagger-api/swagger-ui/blob/master/dist/index.html) and customize it. This basically requires you to instantiate a SwaggerUi object and call load() on it as below:
```javascript
const ui = SwaggerUIBundle({
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
```
#### Parameters
Parameter Name | Description
--- | ---
url | The url pointing to API definition (normally `swagger.json` or `swagger.yaml`).
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.
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.
dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger.
oauth2RedirectUrl | OAuth redirect URL
## CORS Support
+40
View File
@@ -0,0 +1,40 @@
{
"name": "swagger-api/swagger-ui",
"description": " Swagger UI is a 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": "Anna Bodnia",
"email": "anna.bodnia@gmail.com"
},
{
"name": "Buu Nguyen",
"email": "buunguyen@gmail.com"
},
{
"name": "Josh Ponelat",
"email": "jponelat@gmail.com"
},
{
"name": "Kyle Shockey",
"email": "kyleshockey1@gmail.com"
},
{
"name": "Robert Barnwell",
"email": "robert@robertismy.name"
},
{
"name": "Sahar Jafari",
"email": "shr.jafari@gmail.com"
}
]
}
+2 -2
View File
@@ -6,8 +6,8 @@
<title>Swagger UI</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="../public/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="../public/favicon-16x16.png" sizes="16x16" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 445 B

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

+3 -3
View File
@@ -6,8 +6,8 @@
<title>Swagger UI</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="../public/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="../public/favicon-16x16.png" sizes="16x16" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
@@ -90,4 +90,4 @@ window.onload = function() {
</script>
</body>
</html>
</html>
+46 -45
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AAsdA;;;;;;AAoIA;AAk7FA;AAmtCA;;;;;AA0uIA;AAq7IA;AAo7FA;AA0wGA;AAglFA;AA0jFA;AAq9CA;AA6jDA;AAgrCA;AAgtEA;AAgkIA;;;;;;;;;;;;;;AAw4GA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AAyxDA;AAm+BA;;;;;;AAmsEA;AA2zFA;;;;;AA+1CA;AA2qFA;AAo2CA;AAokCA;AAkhDA;AAwvEA;AAs+FA;;;;;;;;;AA+xBA;AA2zIA;AAg4DA;AA0vDA","sourceRoot":""}
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0dA;AAkoJA;AAyiCA;;;;;AAskCA;AA66IA;AA20FA;AAg3GA;AAonEA;AA+9CA;AA6/CA;AA+rCA;AA+3EA;AA68HA;;;;;;;;;;;;;;AA8tGA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AAyxDA;AAw6BA;;;;;;AAs0EA;AA24FA;;;;;AAy3CA;AA2qFA;AAw2CA;AA2kCA;AAq/CA;AAwwEA;AA48FA;;;;;;;;;AA81BA;AA2zIA;AAi4DA;AAqlDA;;;;;;AA4kCA;AA8iHA;AAipGA","sourceRoot":""}
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AAqTA;AAyiGA","sourceRoot":""}
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA6PA;AAyiGA","sourceRoot":""}
+1 -1
View File
File diff suppressed because one or more lines are too long
+14 -8
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAsoGA;AAy4HA;AA+7FA;AA2mCA;AAw/BA;AA2hCA;AAs5BA","sourceRoot":""}
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AAuwCA;AAoyHA;AAmxHA;AAo8FA;AAooCA;AAghCA;AA0gCA;AA06BA","sourceRoot":""}
+45
View File
@@ -0,0 +1,45 @@
#! /bin/sh
set -e
INDEX_FILE=/usr/share/nginx/html/index.html
replace_in_index () {
if [ "$1" != "**None**" ]; then
sed -i "s|/\*||g" $INDEX_FILE
sed -i "s|\*/||g" $INDEX_FILE
sed -i "s|$1|$2|g" $INDEX_FILE
fi
}
replace_or_delete_in_index () {
if [ -z "$2" ]; then
sed -i "/$1/d" $INDEX_FILE
else
replace_in_index $1 $2
fi
}
replace_in_index myApiKeyXXXX123456789 $API_KEY
replace_or_delete_in_index your-client-id $OAUTH_CLIENT_ID
replace_or_delete_in_index your-client-secret-if-required $OAUTH_CLIENT_SECRET
replace_or_delete_in_index your-realms $OAUTH_REALM
replace_or_delete_in_index your-app-name $OAUTH_APP_NAME
if [ "$OAUTH_ADDITIONAL_PARAMS" != "**None**" ]; then
replace_in_index "additionalQueryStringParams: {}" "additionalQueryStringParams: {$OAUTH_ADDITIONAL_PARAMS}"
fi
if [[ -f $SWAGGER_JSON ]]; then
sed -i "s|http://petstore.swagger.io/v2/swagger.json|swagger.json|g" $INDEX_FILE
sed -i "s|http://example.com/api|swagger.json|g" $INDEX_FILE
else
sed -i "s|http://petstore.swagger.io/v2/swagger.json|$API_URL|g" $INDEX_FILE
sed -i "s|http://example.com/api|$API_URL|g" $INDEX_FILE
fi
if [[ -n "$VALIDATOR_URL" ]]; then
sed -i "s|.*validatorUrl:.*$||g" $INDEX_FILE
sed -i "s|\(url: url,.*\)|\1\n validatorUrl: \"${VALIDATOR_URL}\",|g" $INDEX_FILE
fi
exec nginx -g 'daemon off;'
+4 -3
View File
@@ -1,6 +1,6 @@
{
"name": "swagger-ui",
"version": "3.0.4",
"version": "3.0.6",
"main": "dist/swagger-ui.js",
"repository": "git@github.com:swagger-api/swagger-ui.git",
"contributors": [
@@ -37,7 +37,6 @@
"dependencies": {
"babel-polyfill": "^6.23.0",
"brace": "0.7.0",
"btoa": "^1.1.2",
"deep-extend": "0.4.1",
"expect": "1.20.2",
"getbase": "^2.8.2",
@@ -68,7 +67,8 @@
"reselect": "2.5.3",
"serialize-error": "2.0.0",
"shallowequal": "0.2.2",
"swagger-client": "^3.0.4",
"swagger-client": "^3.0.5",
"url-parse": "^1.1.8",
"whatwg-fetch": "0.11.1",
"worker-loader": "^0.7.1",
"xml": "1.0.1",
@@ -112,6 +112,7 @@
"postcss-loader": "0.7.0",
"raw-loader": "0.5.1",
"react-hot-loader": "^1.3.1",
"react-test-renderer": "^15.5.4",
"rimraf": "^2.6.0",
"sass-loader": "^6.0.2",
"standard": "^8.6.0",
@@ -16,6 +16,10 @@ export default class AuthorizeOperationBtn extends React.Component {
let isAuthorized = authSelectors.isAuthorized(security)
if(isAuthorized === null) {
return null
}
return (
<button className={isAuthorized ? "authorization__btn locked" : "authorization__btn unlocked"} onClick={ this.onClick }>
<svg width="20" height="20">
+3 -3
View File
@@ -145,7 +145,7 @@ export default class Oauth2 extends React.Component {
}
{
( flow === IMPLICIT || flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "none") ) &&
( flow === APPLICATION || flow === IMPLICIT || flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "none") ) &&
( !isAuthorized || isAuthorized && this.state.clientId) && <Row>
<label htmlFor="client_id">client_id:</label>
<Col tablet={10} desktop={10}>
@@ -159,7 +159,7 @@ export default class Oauth2 extends React.Component {
}
{
( flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "none") ) && <Row>
( flow === APPLICATION || flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "none") ) && <Row>
<label htmlFor="client_secret">client_secret:</label>
<Col tablet={10} desktop={10}>
{
@@ -205,7 +205,7 @@ export default class Oauth2 extends React.Component {
} )
}
<div className="auth-btn-wrapper">
{ isValid && flow !== APPLICATION &&
{ isValid &&
( isAuthorized ? <Button className="btn modal-btn auth authorize" onClick={ this.logout }>Logout</Button>
: <Button className="btn modal-btn auth authorize" onClick={ this.authorize }>Authorize</Button>
)
+1 -1
View File
@@ -19,7 +19,7 @@ export default class Curl extends React.Component {
<div>
<h4>Curl</h4>
<div className="copy-paste">
<textarea onFocus={this.handleFocus} className="curl" style={{ whiteSpace: "normal" }} defaultValue={curl}></textarea>
<textarea onFocus={this.handleFocus} className="curl" style={{ whiteSpace: "normal" }} value={curl}></textarea>
</div>
</div>
)
+18 -2
View File
@@ -68,7 +68,7 @@ const ThrownErrorItem = ( { error, jumpToLine } ) => {
{ error.get("message") }
</span>
<div>
{ errorLine ? <a onClick={jumpToLine.bind(null, errorLine)}>Jump to line { errorLine }</a> : null }
{ errorLine && jumpToLine ? <a onClick={jumpToLine.bind(null, errorLine)}>Jump to line { errorLine }</a> : null }
</div>
</div>
}
@@ -77,11 +77,23 @@ const ThrownErrorItem = ( { error, jumpToLine } ) => {
}
const SpecErrorItem = ( { error, jumpToLine } ) => {
let locationMessage = null
if(error.get("path")) {
if(List.isList(error.get("path"))) {
locationMessage = <small>at { error.get("path").join(".") }</small>
} else {
locationMessage = <small>at { error.get("path") }</small>
}
} else if(error.get("line") && !jumpToLine) {
locationMessage = <small>on line { error.get("line") }</small>
}
return (
<div className="error-wrapper">
{ !error ? null :
<div>
<h4>{ toTitleCase(error.get("source")) + " " + error.get("level") }{ error.get("path") ? <small> at {List.isList(error.get("path")) ? error.get("path").join(".") : error.get("path")}</small>: null }</h4>
<h4>{ toTitleCase(error.get("source")) + " " + error.get("level") }&nbsp;{ locationMessage }</h4>
<span style={{ whiteSpace: "pre-line"}}>{ error.get("message") }</span>
<div>
{ jumpToLine ? (
@@ -106,6 +118,10 @@ ThrownErrorItem.propTypes = {
jumpToLine: PropTypes.func
}
ThrownErrorItem.defaultProps = {
jumpToLine: null
}
SpecErrorItem.propTypes = {
error: PropTypes.object.isRequired,
jumpToLine: PropTypes.func
+80
View File
@@ -0,0 +1,80 @@
import React, { PropTypes } from "react"
export default class BaseLayout extends React.Component {
static propTypes = {
errSelectors: PropTypes.object.isRequired,
errActions: PropTypes.object.isRequired,
specActions: PropTypes.object.isRequired,
specSelectors: PropTypes.object.isRequired,
layoutSelectors: PropTypes.object.isRequired,
layoutActions: PropTypes.object.isRequired,
getComponent: PropTypes.func.isRequired
}
render() {
let { specSelectors, specActions, getComponent } = this.props
let info = specSelectors.info()
let url = specSelectors.url()
let basePath = specSelectors.basePath()
let host = specSelectors.host()
let securityDefinitions = specSelectors.securityDefinitions()
let externalDocs = specSelectors.externalDocs()
let schemes = specSelectors.schemes()
let Info = getComponent("info")
let Operations = getComponent("operations", true)
let Models = getComponent("models", true)
let AuthorizeBtn = getComponent("authorizeBtn", true)
let Row = getComponent("Row")
let Col = getComponent("Col")
let Errors = getComponent("errors", true)
const Schemes = getComponent("schemes")
const isSpecEmpty = !specSelectors.specStr()
if(isSpecEmpty) {
return <h4>No spec provided.</h4>
}
return (
<div className='swagger-ui'>
<div>
<Errors/>
<Row className="information-container">
<Col mobile={12}>
{ info.count() ? (
<Info info={ info } url={ url } host={ host } basePath={ basePath } externalDocs={externalDocs} getComponent={getComponent}/>
) : null }
</Col>
</Row>
{ schemes && schemes.size || securityDefinitions ? (
<div className="scheme-container">
<Col className="schemes wrapper" mobile={12}>
{ schemes && schemes.size ? (
<Schemes schemes={ schemes } specActions={ specActions } />
) : null }
{ securityDefinitions ? (
<AuthorizeBtn />
) : null }
</Col>
</div>
) : null }
<Row>
<Col mobile={12} desktop={12} >
<Operations/>
</Col>
</Row>
<Row>
<Col mobile={12} desktop={12} >
<Models/>
</Col>
</Row>
</div>
</div>
)
}
}
+10 -1
View File
@@ -4,6 +4,8 @@ import { List } from "immutable"
const braceOpen = "{"
const braceClose = "}"
const propStyle = { color: "#999", fontStyle: "italic" }
const EnumModel = ({ value }) => {
let collapsedContent = <span>Array [ { value.count() } ]</span>
return <span className="prop-enum">
@@ -129,7 +131,6 @@ class Primitive extends Component {
let enumArray = schema.get("enum")
let properties = schema.filter( ( v, key) => ["enum", "type", "format", "$$ref"].indexOf(key) === -1 )
let style = required ? { fontWeight: "bold" } : {}
let propStyle = { color: "#999", fontStyle: "italic" }
return <span className="prop">
<span className="prop-type" style={ style }>{ type }</span> { required && <span style={{ color: "red" }}>*</span>}
@@ -167,6 +168,7 @@ class ArrayModel extends Component {
render(){
let { required, schema, depth, expandDepth } = this.props
let items = schema.get("items")
let properties = schema.filter( ( v, key) => ["type", "items", "$$ref"].indexOf(key) === -1 )
return <span className="model">
<span className="model-title">
@@ -176,6 +178,13 @@ class ArrayModel extends Component {
[
<span><Model { ...this.props } schema={ items } required={ false }/></span>
]
{
properties.size ? <span>
{ properties.entrySeq().map( ( [ key, v ] ) => <span key={`${key}-${v}`} style={propStyle}>
<br />{ `${key}:`}{ String(v) }</span>)
}<br /></span>
: null
}
</Collapse>
{ required && <span style={{ color: "red" }}>*</span>}
</span>
+6 -5
View File
@@ -202,11 +202,12 @@ export default class Operation extends React.Component {
pathMethod={ [path, method] }
/>
{!tryItOutEnabled || !allowTryItOut ? null : schemes && schemes.size ? <Schemes schemes={ schemes }
path={ path }
method={ method }
specActions={ specActions }/>
: null
{!tryItOutEnabled || !allowTryItOut ? null : schemes && schemes.size ? <div className="opblock-schemes">
<Schemes schemes={ schemes }
path={ path }
method={ method }
specActions={ specActions }/>
</div> : null
}
<div className={(!tryItOutEnabled || !response || !allowTryItOut) ? "execute-wrapper" : "btn-group"}>
+9 -1
View File
@@ -5,9 +5,17 @@ import { getSampleSchema } from "core/utils"
const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => {
if ( examples && examples.size ) {
return examples.entrySeq().map( ([ key, example ]) => {
let exampleValue
try {
exampleValue = example && example.toJS ? example.toJS() : example
exampleValue = JSON.stringify(exampleValue)
}
catch(e) {
exampleValue = String(example)
}
return (<div key={ key }>
<h5>{ key }</h5>
<HighlightCode className="example" value={ example } />
<HighlightCode className="example" value={ exampleValue } />
</div>)
}).toArray()
}
+1 -1
View File
@@ -31,7 +31,7 @@ export default class Schemes extends React.Component {
return (
<label htmlFor="schemes">
<span>Schemes</span>
<span className="schemes-title">Schemes</span>
<select onChange={ this.onChange }>
{ schemes.valueSeq().map(
( scheme ) => <option value={ scheme } key={ scheme }>{ scheme }</option>
+1 -1
View File
@@ -4,7 +4,7 @@ export default function curl( request ){
let headers = request.get("headers")
curlified.push( "curl" )
curlified.push( "-X", request.get("method") )
curlified.push( request.get("url") )
curlified.push( `"${request.get("url")}"`)
if ( headers && headers.size ) {
for( let p of request.get("headers").entries() ){
+15 -11
View File
@@ -13,7 +13,7 @@ module.exports = function SwaggerUI(opts) {
dom_id: null,
spec: {},
url: "",
layout: "Layout",
layout: "BaseLayout",
validatorUrl: "https://online.swagger.io/validator",
configs: {
},
@@ -68,22 +68,24 @@ module.exports = function SwaggerUI(opts) {
var system = store.getSystem()
let queryConfig = parseSeach()
const downloadSpec = () => {
const downloadSpec = (fetchedConfig) => {
if(typeof constructorConfig !== "object") {
return system
}
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
let mergedConfig = deepExtend({}, constructorConfig, localConfig, queryConfig)
let mergedConfig = deepExtend({}, constructorConfig, localConfig, fetchedConfig || {}, queryConfig)
store.setConfigs(filterConfigs(mergedConfig))
if(!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
system.specActions.updateUrl("")
system.specActions.updateLoadingStatus("success")
system.specActions.updateSpec(JSON.stringify(mergedConfig.spec))
} else if(system.specActions.download && mergedConfig.url) {
system.specActions.updateUrl(mergedConfig.url)
system.specActions.download(mergedConfig.url)
if (fetchedConfig !== null) {
if (!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
system.specActions.updateUrl("")
system.specActions.updateLoadingStatus("success")
system.specActions.updateSpec(JSON.stringify(mergedConfig.spec))
} else if (system.specActions.download && mergedConfig.url) {
system.specActions.updateUrl(mergedConfig.url)
system.specActions.download(mergedConfig.url)
}
}
if(mergedConfig.dom_id) {
@@ -95,7 +97,9 @@ module.exports = function SwaggerUI(opts) {
return system
}
if (!system.specActions.getConfigByUrl || (system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl(downloadSpec))) {
let configUrl = queryConfig.config || constructorConfig.configUrl
if (!configUrl || !system.specActions.getConfigByUrl || system.specActions.getConfigByUrl && !system.specActions.getConfigByUrl(configUrl, downloadSpec)) {
return downloadSpec()
}
+5
View File
@@ -14,6 +14,11 @@ export default function authorize ( auth, authActions, errActions, configs ) {
return
}
if (flow === "application") {
authActions.authorizeOauth2Application(auth)
return
}
// todo move to parser
if ( !redirectUrl ) {
errActions.newAuthErr( {
+33 -1
View File
@@ -1,5 +1,5 @@
import win from "core/window"
import btoa from "btoa"
import { btoa } from "core/utils"
export const SHOW_AUTH_POPUP = "show_popup"
export const AUTHORIZE = "authorize"
@@ -119,3 +119,35 @@ export const authorizePassword = ( auth ) => ( { fn, authActions, errActions } )
})
.catch(err => { errActions.newAuthErr( err ) })
}
export const authorizeOauth2Application = ( auth ) => ( { fn, authActions, errActions } ) => {
let { schema, scopes, name, clientId, clientSecret } = auth
fn.fetch(schema.get("tokenUrl"), {
method: "post", headers: {
"Accept":"application/json, text/plain, */*",
"Content-Type": "application/x-www-form-urlencoded"
},
body: "grant_type=client_credentials" +
"&client_id=" + encodeURIComponent(clientId) +
"&client_secret=" + encodeURIComponent(clientSecret) +
"&scope=" + encodeURIComponent(scopes.join(scopeSeparator))
})
.then(function (response) {
if ( !response.ok ) {
errActions.newAuthErr( {
authId: name,
level: "error",
source: "auth",
message: response.statusText
} )
return
} else {
response.json()
.then(function (json){
authActions.authorizeOauth2({ auth, token: json})
})
}
})
.catch(err => { errActions.newAuthErr( err ) })
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { fromJS, Map } from "immutable"
import btoa from "btoa"
import { btoa } from "core/utils"
import {
SHOW_AUTH_POPUP,
+4
View File
@@ -67,6 +67,10 @@ export const authorized = createSelector(
export const isAuthorized = ( state, securities ) =>( { authSelectors } ) => {
let authorized = authSelectors.authorized()
if(!List.isList(securities)) {
return null
}
return !!securities.toJS().filter( ( security ) => {
let isAuthorized = true
+2 -1
View File
@@ -14,8 +14,9 @@ export default function downloadUrlPlugin (toolbox) {
fetch({
url,
loadSpec: true,
credentials: "same-origin",
headers: {
"Accept": "application/json"
"Accept": "application/json,*/*"
}
}).then(next,next)
+3 -3
View File
@@ -47,7 +47,7 @@ export const sampleFromSchema = (schema, config={}) => {
let obj = {}
for (var name in props) {
if ( !props[name].readOnly || includeReadOnly ) {
obj[name] = sampleFromSchema(props[name])
obj[name] = sampleFromSchema(props[name], { includeReadOnly: includeReadOnly })
}
}
@@ -55,7 +55,7 @@ export const sampleFromSchema = (schema, config={}) => {
obj.additionalProp1 = {}
} else if ( additionalProperties ) {
let additionalProps = objectify(additionalProperties)
let additionalPropVal = sampleFromSchema(additionalProps)
let additionalPropVal = sampleFromSchema(additionalProps, { includeReadOnly: includeReadOnly })
for (let i = 1; i < 4; i++) {
obj["additionalProp" + i] = additionalPropVal
@@ -65,7 +65,7 @@ export const sampleFromSchema = (schema, config={}) => {
}
if(type === "array") {
return [ sampleFromSchema(items) ]
return [ sampleFromSchema(items, { includeReadOnly: includeReadOnly }) ]
}
if(schema["enum"]) {
+6 -1
View File
@@ -1,4 +1,5 @@
import YAML from "js-yaml"
import parseUrl from "url-parse"
import serializeError from "serialize-error"
// Actions conform to FSA (flux-standard-actions)
@@ -186,7 +187,11 @@ export const logRequest = (req) => {
// (For debugging) and ease of testing
export const executeRequest = (req) => ({fn, specActions, specSelectors}) => {
let { pathName, method } = req
let parsedRequest = Object.assign({ contextUrl: specSelectors.url() }, req)
// if url is relative, parseUrl makes it absolute by inferring from `window.location`
req.contextUrl = parseUrl(specSelectors.url()).toString()
let parsedRequest = Object.assign({}, req)
if ( pathName && method ) {
parsedRequest.operationId = method.toLowerCase() + "-" + pathName
}
+5 -1
View File
@@ -291,7 +291,11 @@ export function operationConsumes(state, pathMethod) {
}
export const operationScheme = ( state, path, method ) => {
return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || "http"
let url = state.get("url")
let matchResult = url.match(/^([a-z][a-z0-9+\-.]*):/)
let urlScheme = Array.isArray(matchResult) ? matchResult[1] : null
return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || urlScheme || "http"
}
export const canExecuteScheme = ( state, path, method ) => {
+1 -1
View File
@@ -74,7 +74,7 @@ const createClass = component => React.createClass({
const Fallback = ({ name }) => <div style={{ // eslint-disable-line react/prop-types
padding: "1em",
"color": "#aaa"
}}>😱 <i>Could not render { name || name === "t" ? name : "this component" }, see the console.</i></div>
}}>😱 <i>Could not render { name === "t" ? "this component" : name }, see the console.</i></div>
const wrapRender = (component) => {
const isStateless = component => !(component.prototype && component.prototype.isReactComponent)
+3
View File
@@ -46,6 +46,8 @@ import Model from "core/components/model"
import Models from "core/components/models"
import TryItOutButton from "core/components/try-it-out-button"
import BaseLayout from "core/components/layouts/base"
import * as LayoutUtils from "core/components/layout-utils"
import * as JsonSchemaComponents from "core/json-schema-components"
@@ -87,6 +89,7 @@ export default function() {
model: Model,
models: Models,
TryItOutButton,
BaseLayout
}
}
+14 -2
View File
@@ -453,13 +453,13 @@ export const propChecker = (props, nextProps, objectList=[], ignoreList=[]) => {
}
const validateNumber = ( val ) => {
if ( !/^\d+(.?\d+)?$/.test(val)) {
if ( !/^-?\d+(.?\d+)?$/.test(val)) {
return "Value must be a number"
}
}
const validateInteger = ( val ) => {
if ( !/^\d+$/.test(val)) {
if ( !/^-?\d+$/.test(val)) {
return "Value must be integer"
}
}
@@ -547,3 +547,15 @@ export const parseSeach = () => {
return map
}
export const btoa = (str) => {
let buffer
if (str instanceof Buffer) {
buffer = str
} else {
buffer = new Buffer(str.toString(), "utf-8")
}
return buffer.toString("base64")
}
+5 -5
View File
@@ -1,5 +1,4 @@
import YAML from "js-yaml"
import { parseSeach } from "core/utils"
import yamlConfig from "../../../swagger-config.yaml"
const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
@@ -27,9 +26,7 @@ export default function configPlugin (toolbox) {
return fetch(url)
},
getConfigByUrl: (callback)=> ({ specActions }) => {
let config = parseSeach()
let configUrl = config.config
getConfigByUrl: (configUrl, cb)=> ({ specActions }) => {
if (configUrl) {
return specActions.downloadConfig(configUrl).then(next, next)
}
@@ -37,9 +34,12 @@ export default function configPlugin (toolbox) {
function next(res) {
if (res instanceof Error || res.status >= 400) {
specActions.updateLoadingStatus("failedConfig")
specActions.updateLoadingStatus("failedConfig")
specActions.updateUrl("")
console.error(res.statusText + " " + configUrl)
cb(null)
} else {
callback(parseYamlConfig(res.text))
cb(parseYamlConfig(res.text))
}
}
}
+9 -65
View File
@@ -13,28 +13,16 @@ export default class StandaloneLayout extends React.Component {
}
render() {
let { specSelectors, specActions, getComponent } = this.props
let { getComponent, specSelectors } = this.props
let info = specSelectors.info()
let url = specSelectors.url()
let basePath = specSelectors.basePath()
let host = specSelectors.host()
let securityDefinitions = specSelectors.securityDefinitions()
let externalDocs = specSelectors.externalDocs()
let schemes = specSelectors.schemes()
let Info = getComponent("info")
let Operations = getComponent("operations", true)
let Models = getComponent("models", true)
let AuthorizeBtn = getComponent("authorizeBtn", true)
let Container = getComponent("Container")
let Row = getComponent("Row")
let Col = getComponent("Col")
let Errors = getComponent("errors", true)
const Schemes = getComponent("schemes")
const Topbar = getComponent("Topbar", true)
const BaseLayout = getComponent("BaseLayout", true)
const OnlineValidatorBadge = getComponent("onlineValidatorBadge", true)
const loadingStatus = specSelectors.loadingStatus()
return (
@@ -56,56 +44,12 @@ export default class StandaloneLayout extends React.Component {
<h4 className="title">Failed to load config.</h4>
</div>
}
{ loadingStatus === "success" &&
<div>
<Errors/>
<Row className="information-container">
<Col mobile={12}>
{ info.count() ? (
<Info info={ info } url={ url } host={ host } basePath={ basePath } externalDocs={externalDocs} getComponent={getComponent}/>
) : null }
</Col>
</Row>
{ schemes && schemes.size && securityDefinitions ? (
<div className="scheme-container">
<Col className="schemes wrapper" mobile={12}>
{ schemes && schemes.size ? (
<Schemes schemes={ schemes } specActions={ specActions } />
) : null }
{ securityDefinitions ? (
<AuthorizeBtn />
) : null }
</Col>
</div>
) : null }
{ (!schemes || !schemes.size) && securityDefinitions ? (
<div className="scheme-container">
<Col className="schemes wrapper" mobile={12}>
{ securityDefinitions ? (
<AuthorizeBtn />
) : null }
</Col>
</div>
) : null }
<Row>
<Col mobile={12} desktop={12} >
<Operations/>
</Col>
</Row>
<Row>
<Col mobile={12} desktop={12} >
<Models/>
</Col>
</Row>
</div> }
<Row>
<Col>
<OnlineValidatorBadge />
</Col>
</Row>
{ !loadingStatus || loadingStatus === "success" && <BaseLayout/> }
<Row>
<Col>
<OnlineValidatorBadge />
</Col>
</Row>
</Container>
)
}
+5
View File
@@ -24,6 +24,11 @@
@include text_code();
}
small
{
color: #666;
}
}
hgroup
+10
View File
@@ -307,6 +307,16 @@ body
@include method($_color-disabled);
}
.opblock-schemes
{
padding: 8px 20px;
.schemes-title
{
padding: 0 10px 0 0;
}
}
}
+11 -11
View File
@@ -21,7 +21,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X POST http://example.com -H \"Accept: application/json\" -H \"content-type: application/json\" -d {\"id\":0,\"name\":\"doggie\",\"status\":\"available\"}")
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"Accept: application/json\" -H \"content-type: application/json\" -d {\"id\":0,\"name\":\"doggie\",\"status\":\"available\"}")
})
it("does not change the case of header in curl", function() {
@@ -35,7 +35,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X POST http://example.com -H \"conTenT Type: application/Moar\"")
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"conTenT Type: application/Moar\"")
})
it("prints a curl statement with an array of query params", function() {
@@ -46,7 +46,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X GET http://swaggerhub.com/v1/one?name=john|smith")
expect(curlified).toEqual("curl -X GET \"http://swaggerhub.com/v1/one?name=john|smith\"")
})
it("prints a curl statement with an array of query params and auth", function() {
@@ -60,7 +60,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X GET http://swaggerhub.com/v1/one?name=john|smith -H \"authorization: Basic Zm9vOmJhcg==\"")
expect(curlified).toEqual("curl -X GET \"http://swaggerhub.com/v1/one?name=john|smith\" -H \"authorization: Basic Zm9vOmJhcg==\"")
})
it("prints a curl statement with html", function() {
@@ -77,7 +77,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X GET http://swaggerhub.com/v1/one?name=john|smith -H \"accept: application/json\" -d {\"description\":\"<b>Test</b>\"}")
expect(curlified).toEqual("curl -X GET \"http://swaggerhub.com/v1/one?name=john|smith\" -H \"accept: application/json\" -d {\"description\":\"<b>Test</b>\"}")
})
it("handles post body with html", function() {
@@ -94,7 +94,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X POST http://swaggerhub.com/v1/one?name=john|smith -H \"accept: application/json\" -d {\"description\":\"<b>Test</b>\"}")
expect(curlified).toEqual("curl -X POST \"http://swaggerhub.com/v1/one?name=john|smith\" -H \"accept: application/json\" -d {\"description\":\"<b>Test</b>\"}")
})
it("handles post body with special chars", function() {
@@ -109,7 +109,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X POST http://swaggerhub.com/v1/one?name=john|smith -d {\"description\":\"@prefix nif:<http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .\"}")
expect(curlified).toEqual("curl -X POST \"http://swaggerhub.com/v1/one?name=john|smith\" -d {\"description\":\"@prefix nif:<http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .\"}")
})
it("handles delete form with parameters", function() {
@@ -123,7 +123,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X DELETE http://example.com -H \"accept: application/x-www-form-urlencoded\"")
expect(curlified).toEqual("curl -X DELETE \"http://example.com\" -H \"accept: application/x-www-form-urlencoded\"")
})
it("should print a curl with formData", function() {
@@ -136,7 +136,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X POST http://example.com -H \"content-type: multipart/form-data\" -F id=123 -F name=Sahar")
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"content-type: multipart/form-data\" -F id=123 -F name=Sahar")
})
it("prints a curl post statement from an object", function() {
@@ -153,7 +153,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X POST http://example.com -H \"accept: application/json\" -d {\"id\":10101}")
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"accept: application/json\" -d {\"id\":10101}")
})
it("prints a curl post statement from a string containing a single quote", function() {
@@ -168,7 +168,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X POST http://example.com -H \"accept: application/json\" -d \"{\\\"id\\\":\\\"foo'bar\\\"}\"")
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"accept: application/json\" -d \"{\\\"id\\\":\\\"foo'bar\\\"}\"")
})
})
+40 -1
View File
@@ -1,7 +1,7 @@
/* eslint-env mocha */
import expect from "expect"
import { fromJS } from "immutable"
import { parameterValues, contentTypeValues } from "corePlugins/spec/selectors"
import { parameterValues, contentTypeValues, operationScheme } from "corePlugins/spec/selectors"
describe("spec plugin - selectors", function(){
@@ -92,4 +92,43 @@ describe("spec plugin - selectors", function(){
})
describe("operationScheme", function(){
it("should return the correct scheme for a remote spec that doesn't specify a scheme", function(){
// Given
let state = fromJS({
url: "https://generator.swagger.io/api/swagger.json",
resolved: {
paths: {
"/one": {
get: {
"consumes_value": "one",
"produces_value": "two"
}
}
}
}
})
// When
let scheme = operationScheme(state, ["/one"], "get")
// Then
expect(scheme).toEqual("https")
})
// it("should be ok, if no operation found", function(){
// // Given
// let state = fromJS({ })
//
// // When
// let contentTypes = contentTypeValues(state, [ "/one", "get" ])
// // Then
// expect(contentTypes.toJS()).toEqual({
// requestContentType: undefined,
// responseContentType: undefined
// })
// })
})
})