Compare commits

...
218 Commits
Author SHA1 Message Date
shockey 39501c8d82 Merge pull request #3140 from shockey/v/3.0.12
v3.0.12
2017-05-26 19:43:55 -07:00
Kyle Shockey d68dd5f7d6 Rebuild dist 2017-05-26 19:38:03 -07:00
Kyle Shockey 2567e5168d v3.0.12 2017-05-26 19:36:30 -07:00
shockey bf6681c914 Merge pull request #3133 from shockey/ft/dist-npm-packaging
packaging: fix swagger-ui-dist entry point
2017-05-26 00:59:16 -07:00
Roman Bolshakov b23c999d01 packaging: fix swagger-ui-dist entry point
Entry point was missing. This change allows importing SwaggerUIBundle
and SwaggerUIStandalonePreset directly from package. Correct entry point
is also needed for module bundlers like webpack to perform tree-shaking.
2017-05-25 17:45:01 -07:00
Anna 41d8089d0e Merge pull request #3130 from bodnia/fix-3067
Fix 3067
2017-05-25 18:30:12 +03:00
Anna Bodnia c5d2faa3a2 build 2017-05-25 18:10:40 +03:00
Anna Bodnia df4ea9b3d6 Merge remote-tracking branch 'upstream/master' into fix-3067 2017-05-25 18:06:07 +03:00
Anna Bodnia 62cb9ec581 Read me for modelPropertyMacro, changed for parameterMacro 2017-05-25 18:04:21 +03:00
shockey 1db8e498b7 Merge pull request #3116 from Minasokoni/clickfix
Updated click area
2017-05-24 09:01:34 -07:00
Anna Bodnia 918e0e46c0 read me for parameterMacro 2017-05-23 15:36:42 +03:00
Robert Barnwell 760d1eba80 Merge branch 'master' into clickfix 2017-05-22 09:57:19 -07:00
Minasokoni a2a2f76199 updated click area 2017-05-22 09:12:13 -07:00
Anna Bodnia d5b9552a5a removed debugger 2017-05-22 17:13:31 +03:00
shockey 753134ec49 Merge pull request #3114 from shockey/v/3.0.11
v3.0.11
2017-05-19 20:25:59 -07:00
Kyle Shockey 612078ac8c Rebuild dist 2017-05-19 20:17:37 -07:00
Kyle Shockey e45570b6c8 v3.0.11 2017-05-19 20:09:34 -07:00
shockey daef38d2e3 Merge pull request #3092 from Minasokoni/wordwrapfix
Long single line responses wrapped with css
2017-05-19 18:46:28 -07:00
shockey eb8a64a66f Merge branch 'master' into wordwrapfix 2017-05-19 18:43:27 -07:00
Anna Bodnia edfe88d299 modelPropertyMacro, parameterMacro 2017-05-19 18:50:51 +03:00
shockey c66436e7d5 Merge pull request #3108 from swagger-api/shockey-patch-3
Add custom namespace to config whitelist
2017-05-18 23:41:34 -07:00
shockey b530ac8593 Default value for custom key 2017-05-18 23:35:02 -07:00
shockey d30b3a9ba1 Add custom namespace to config whitelist 2017-05-18 23:33:12 -07:00
shockey e326a99001 Merge pull request #3106 from shockey/ft/error-jump-to-line
Jump to Line
2017-05-18 15:32:44 -07:00
Kyle Shockey a28dc13191 Merge branch 'master' of github.com:swagger-api/swagger-ui into ft/error-jump-to-line 2017-05-18 15:21:09 -07:00
Kyle Shockey c942f382fb Rebuild dist 2017-05-18 15:15:01 -07:00
Kyle Shockey b6bb1deab8 Rewire jump to line for Errors component 2017-05-18 15:13:04 -07:00
Anna 6224617984 Merge pull request #3099 from bodnia/fix-3089
fixes #3089
2017-05-17 18:16:31 +03:00
Anna Bodnia b85d9a8c24 fixes #3089 2017-05-17 18:13:04 +03:00
Robert Barnwell b28a649457 Merge branch 'master' into wordwrapfix 2017-05-16 11:38:48 -07:00
Minasokoni bb6bc00012 Long single line responses wrapped 2017-05-16 11:33:59 -07:00
Anna f235430f30 Merge pull request #3049 from furkanayhan/send_redirect_url_for_oauth2
Send redirect url for oauth2
2017-05-16 17:01:28 +03:00
Furkan Ayhan 0c7119e855 Send redirect url when authenticating with oauth2-authorization_code
also fix indentations of files
2017-05-16 16:50:13 +03:00
Anna d64e920665 Merge pull request #3084 from tcaesvk/feature/oauth2-authorize-query
fix OAuth2 authorize issue + remove redundant parameters
2017-05-16 15:18:20 +03:00
김 재석 c81fdaec57 fix lint errors 2017-05-16 15:31:02 +09:00
김 재석 960a99a5ea remove undefined parameters for OAuth2 authorize request 2017-05-16 15:20:58 +09:00
shockey e74989f22e Merge pull request #3077 from shockey/v/3.0.10
v3.0.10
2017-05-14 01:26:49 -07:00
Kyle Shockey 73ed923e28 v3.0.10 2017-05-14 01:10:00 -07:00
Kyle Shockey 599b448f91 Revert "fixes #2922"
This reverts commit 496062f980.
2017-05-13 10:15:38 -07:00
Kyle Shockey 6e40d04741 take advantage of Swagger-Client opId improvements 2017-05-13 09:50:34 -07:00
Anna e80b2f5b3f Merge pull request #3074 from bodnia/issue-2897
Issue 2897
2017-05-12 00:23:21 +03:00
Anna Bodnia 32cd6fe09c readme for configuration of auth 2017-05-11 20:14:49 +03:00
Anna Bodnia 8aebea34c4 add configuration of auth: scope separator, client id, client secret, app name, reaml, additionalQueryParams 2017-05-11 16:30:30 +03:00
Anna 5f6320e754 Merge pull request #3071 from bodnia/fix-3031
fixes #3031
2017-05-11 14:42:32 +03:00
Anna Bodnia 5574a6cb1f fixes #3031 2017-05-11 14:38:34 +03:00
shockey bb2e75da8f Merge pull request #3068 from shockey/bug/3027-gitless-building
try/catch git describe call
2017-05-10 22:11:09 -07:00
shockey ee3669312a Merge branch 'master' into bug/3027-gitless-building 2017-05-10 22:05:36 -07:00
Kyle Shockey c81f51f696 try/catch git describe call, fixes building without git present 2017-05-10 22:03:04 -07:00
shockey e2003ae922 Merge pull request #3058 from jmendiara/fix/gitignore
gitignore all npm-debug logs
2017-05-10 13:37:15 -07:00
shockey 0ac0b5ba32 Merge branch 'master' into fix/gitignore 2017-05-10 13:32:45 -07:00
shockey f8381bf907 Merge pull request #3057 from jmendiara/fix/configLocation
Move filterConfigs to core
2017-05-10 11:12:43 -07:00
Javier Mendiara d378d38c12 Merge branch 'master' into fix/gitignore 2017-05-10 18:20:32 +02:00
Javier Mendiara Cañardo 53986d60bc Move filterConfigs to core
Fixes #3056
2017-05-10 18:17:37 +02:00
Anna 5b6f27c7db Merge pull request #3065 from bodnia/fix-2922
#Fixes 2922
2017-05-10 17:11:15 +03:00
Anna Bodnia 47b495b24d build 2017-05-10 17:04:36 +03:00
Anna Bodnia 496062f980 fixes #2922 2017-05-10 17:03:18 +03:00
Anna a920e3ab69 Merge pull request #3064 from bodnia/fix-3045
Fix 3045
2017-05-10 15:30:16 +03:00
Anna Bodnia 14e9fd7b0f built 2017-05-10 15:21:46 +03:00
Anna Bodnia ac4ef3fdd4 fixes #3045 order of configs inheratance 2017-05-10 15:20:32 +03:00
Javier Mendiara Cañardo 2de7b957df gitignore all npm-debug logs
Lot of npm-debugs files can be generated in devs computers, each one with a number suffix
ex:
```sh
npm-debug.log.213131231
npm-debug.log.213131231
npm-debug.log.213131231
```

Adding a wildcard prevents for accidental commits

_Official and default .gitignore for node in github.com: https://github.com/github/gitignore/blob/master/Node.gitignore#L4_
2017-05-09 15:14:14 +02:00
shockey a068f78252 Merge pull request #3043 from shockey/v/3.0.9
v3.0.9
2017-05-05 20:04:54 -07:00
Kyle Shockey 933da1e93a Dist rebuild 2017-05-05 19:56:41 -07:00
Kyle Shockey 3c1a1780a6 v3.0.9 as declared version 2017-05-05 19:51:46 -07:00
Ron bf1bc120fe Merge pull request #3039 from bodnia/config-readme
Readme for Topbar plugin, Configs plugin
2017-05-05 14:54:39 -07:00
Ron fce31afa6c Merge branch 'master' into config-readme 2017-05-05 14:41:46 -07:00
Anna b73063578c Merge pull request #3040 from bodnia/config-plugin-enable
enable configs plugin by default
2017-05-05 17:57:22 +03:00
Anna Bodnia cbd74b0c67 enable configs plugin by default 2017-05-05 17:50:22 +03:00
Anna Bodnia 8e80ca9583 Readme for Topbar plugin, Configs plugin 2017-05-05 17:45:40 +03:00
shockey 3ef50589e9 Merge pull request #3029 from shockey/rebuild
Rebuild dist
2017-05-04 11:09:39 -07:00
Kyle Shockey 1d146394f3 Rebuild dist 2017-05-04 10:57:42 -07:00
shockey e91573af39 Merge pull request #3017 from Minasokoni/searchbar-fix
preventDefault the searchbar
2017-05-04 10:42:38 -07:00
shockey 2cc3e3c2d6 Merge branch 'master' into searchbar-fix 2017-05-04 10:29:14 -07:00
Anna af7a99e901 Merge pull request #3026 from bodnia/fix-2841
fixes #2841
2017-05-04 17:37:38 +03:00
Anna Bodnia 7e1eb4e9a7 fix #2841 2017-05-04 17:18:47 +03:00
Anna 4f0cf53401 Merge pull request #2949 from stefangr/fix_oauth2_scope_checkbox_uniqueness
Make the oauth2 scope checkbox id more unique.
2017-05-04 11:01:13 +03:00
Stefan Grootscholten 073eff4e10 Make the checkbox id more unique.
If the swagger.json defines more than one oauth2 Security scheme with
matching scopes, the id of the scope checkboxes were not unique.
As a result the scope for a second security scheme could not be
selected.

By adding the security scheme name to the id, it becomes more unique.
2017-05-04 09:39:22 +02:00
Robert Barnwell cd7007d557 Merge branch 'master' into searchbar-fix 2017-05-03 14:17:32 -07:00
shockey b76dcc2d4a Merge pull request #3018 from shockey/bug/3016-window-guard
Version stamping updates
2017-05-02 12:43:13 -07:00
Kyle Shockey b2af309cd5 Rebuild dist 2017-05-02 12:24:09 -07:00
Kyle Shockey 7296a054c4 Fix #3016 2017-05-02 12:15:17 -07:00
Minasokoni 6b5063ead1 Merge branch 'searchbar-fix' of github.com:Minasokoni/swagger-ui into searchbar-fix 2017-05-02 11:02:24 -07:00
Minasokoni 018491b4a7 removed semicolon 2017-05-02 11:02:14 -07:00
Robert Barnwell 74b4a3d598 Merge branch 'master' into searchbar-fix 2017-05-02 10:40:31 -07:00
Minasokoni 51b04b3a26 preventDefault the form 2017-05-02 10:38:35 -07:00
shockey f14d8067c4 Merge pull request #3005 from shockey/v/3.0.8
v/3.0.8
2017-04-28 19:55:24 -07:00
Kyle Shockey c08f3c230b v3.0.8 (fixes #2923 #2889) 2017-04-28 19:51:37 -07:00
Kyle Shockey 96f4b65dfa Rebuild dist 2017-04-28 19:40:39 -07:00
Kyle Shockey 69fd57f17f Increment swagger-client version 2017-04-28 18:43:24 -07:00
shockey f85fdb7835 Merge pull request #3004 from shockey/ft/3003-version-info
Add global variable that exposes UI version
2017-04-28 10:46:27 -07:00
Kyle Shockey 15d43886a3 Attach information to version object 2017-04-28 10:41:47 -07:00
Kyle Shockey 0e62d920e8 Merge branch 'master' of github.com:swagger-api/swagger-ui into ft/3003-version-info 2017-04-28 10:29:06 -07:00
Kyle Shockey b6c3f91127 Fix #3003 2017-04-28 10:06:43 -07:00
shockey 11e9bbfdbb Merge pull request #2958 from swagger-api/feature/older-react
Remove object-assign
2017-04-28 09:38:51 -07:00
shockey d2c3078a79 Merge branch 'master' into feature/older-react 2017-04-28 09:21:15 -07:00
shockey dd11740359 Merge pull request #3002 from Minasokoni/searchbar-update
Updated searchbar sizing and added onSubmit func
2017-04-28 09:06:48 -07:00
Robert Barnwell 8a1e447f0f Merge branch 'master' into searchbar-update 2017-04-28 08:39:16 -07:00
Minasokoni ca808e9d18 updated searchbar sizing 2017-04-28 08:36:32 -07:00
Josh Ponelat f5e89dc02e build 2017-04-28 11:19:39 +02:00
Josh Ponelat 2cff912261 remove object-assign dep ( which was missing from package.json ) 2017-04-28 11:17:59 +02:00
shockey 5a5a4d016b Merge pull request #2997 from shockey/Minasokoni-container-name-change
Changed main container className
2017-04-27 20:12:47 -07:00
Kyle Shockey f1f912a46f Merge branch 'master' of github.com:swagger-api/swagger-ui into Minasokoni-container-name-change 2017-04-27 20:04:52 -07:00
Kyle Shockey 518e2ec732 Merge branch 'master' into Minasokoni-container-name-change 2017-04-27 19:57:29 -07:00
Anna 862301e6df Merge pull request #2993 from bodnia/fix-2870
fix #2870
2017-04-27 19:14:16 +02:00
Anna Bodnia 374ac9cbbb fix #2870 2017-04-27 20:09:05 +03:00
Kyle Shockey 7d87c9d680 Fix typo in container classname 2017-04-27 09:09:09 -07:00
Kyle Shockey 78336e99aa Merge branch 'container-name-change' of https://github.com/Minasokoni/swagger-ui into Minasokoni-container-name-change 2017-04-27 09:08:55 -07:00
Anna a7c90e2d77 Merge pull request #2992 from bodnia/fix-2844
#2844 fix accessCode flow
2017-04-27 18:06:12 +02:00
Anna Bodnia 87a23c7c9e fix eslint errors 2017-04-27 19:01:27 +03:00
Anna Bodnia d013e7a05c #2844 fix accessCode flow 2017-04-27 18:55:25 +03:00
Minasokoni 198f9b6874 changed container classname 2017-04-27 08:35:33 -07:00
shockey 210b20eea8 Merge pull request #2985 from swagger-api/shockey-patch-2
Update webpack-dist.config.js
2017-04-26 23:03:20 -07:00
shockey f755f80072 Update webpack-dist.config.js 2017-04-26 22:43:54 -07:00
shockey 8137f25cc7 Merge pull request #2983 from shockey/bug/2937-core-missing-modules
Bug/2937 core missing modules
2017-04-26 19:42:00 -07:00
shockey a8ff714eee Merge branch 'master' into bug/2937-core-missing-modules 2017-04-26 18:34:58 -07:00
Kyle Shockey 494048e809 Fix #2937 2017-04-26 18:23:57 -07:00
Kyle Shockey bcd36ff667 Fix #2937 2017-04-26 18:11:27 -07:00
Ron 38ed6192c3 Merge pull request #2982 from swagger-api/issue_template
new issue_template
2017-04-26 15:58:29 -07:00
Ron b9df212ccc new issue_template 2017-04-26 15:50:35 -07:00
Anna 22dc506b13 Merge pull request #2977 from bodnia/issue-2898
#2898  operationsSorter config description
2017-04-26 17:39:39 +02:00
Anna da7210d328 Merge branch 'master' into issue-2898 2017-04-26 17:33:51 +02:00
Anna ca05b3e255 Merge pull request #2979 from bodnia/fix-oauth2-issue
fixes password, application oauth2 flows
2017-04-26 17:11:23 +02:00
Anna Bodnia 891c321c8a build 2017-04-26 18:06:26 +03:00
Anna Bodnia cecf0670b7 Merge branch 'master' into fix-oauth2-issue
# Conflicts:
#	dist/swagger-ui.css
2017-04-26 17:53:53 +03:00
Anna Bodnia bb73dd49d8 fixes password, application oauth2 flows 2017-04-26 17:50:09 +03:00
Anna Bodnia eab557f470 #2898 operationsSorter config description 2017-04-26 11:53:27 +03:00
shockey ac25a5dac6 Merge pull request #2974 from swagger-api/shockey-patch-1
Update README.md
2017-04-25 13:33:02 -07:00
shockey 073313df6f Merge branch 'master' into shockey-patch-1 2017-04-25 11:23:36 -07:00
shockey 26912b094f Merge pull request #2611 from elopio/snapcraft
Add the packaging metadata to build the swagger-ui snap
2017-04-25 11:23:21 -07:00
shockey 6f6f76caf4 Update README.md 2017-04-25 11:15:54 -07:00
shockey bbb3035bac Merge branch 'master' into snapcraft 2017-04-25 10:23:55 -07:00
shockey 6841732367 Merge pull request #2967 from Minasokoni/textformating
Headers now break onto their own lines
2017-04-25 10:23:06 -07:00
Robert Barnwell 1a417b3c6c Merge branch 'master' into textformating 2017-04-25 00:22:46 -07:00
Minasokoni aa327ed256 headers now break onto their own lines 2017-04-25 00:20:46 -07:00
Leo Arias 808f8d2827 Merge branch 'master' into snapcraft 2017-04-24 21:42:31 -06:00
Ron 4c40fa192b Merge pull request #2957 from deepu105/patch-1
Correct url in README file
2017-04-24 08:24:50 -07:00
Deepu K Sasidharan 2c6bd5d988 Correct url in README file
The npmjs.com/package/swagger-ui-dist url in the readme is wrong as it tries to load within github domain
2017-04-23 11:29:03 +02:00
Kyle Shockey b289d5992a MOAR deploy fixes 2017-04-21 21:43:24 -07:00
Kyle Shockey 5573f4d32d Skip cleanup on script deploy 2017-04-21 20:06:01 -07:00
Kyle Shockey d6c498b5f3 Fix shell script error 2017-04-21 20:04:57 -07:00
shockey a600280441 Merge pull request #2956 from shockey/v/3.0.7
v3.0.7
2017-04-21 19:56:20 -07:00
Kyle Shockey 0f95724829 v3.0.7 2017-04-21 19:52:06 -07:00
shockey 5ae195074f Merge pull request #2955 from shockey/ft/swagger-ui-dist
Publish swagger-ui-dist npm module
2017-04-21 19:10:19 -07:00
Kyle Shockey f5137da130 Update readme 2017-04-21 19:07:30 -07:00
Kyle Shockey 2bc6c5aa75 Revert git commit hash changes (mistake) 2017-04-21 19:04:25 -07:00
Kyle Shockey 51dac3eea1 Rebuild dist 2017-04-21 19:02:56 -07:00
Kyle Shockey 10b5c8ef8b Remove build files after dist build 2017-04-21 18:43:11 -07:00
Kyle Shockey e871871724 Add build setup for swagger-ui-dist 2017-04-21 18:37:40 -07:00
Tony Tam a6a02997e5 Merge pull request #2950 from redsux/issue-2936
Fix issue #2936 : docker and VALIDATOR_URL variable
2017-04-21 11:04:02 -07:00
Tony Tam 58e29934fd Merge branch 'master' into issue-2936 2017-04-21 08:58:03 -07:00
Anna e0ecffd7c1 Merge pull request #2952 from bodnia/issue-2929-fix
fixes #2929
2017-04-21 12:47:45 +02:00
Anna Bodnia 5a260971cc fixes #2929 2017-04-21 13:29:18 +03:00
redsux 037dc71197 Merge branch 'master' into issue-2936 2017-04-21 11:02:51 +02:00
redsux adf9f2d8aa Fix issue #2936
Fix "sed" regex in docker-run.sh to use the VALIDATOR_URL environment variable.
Don't use it in quotes if it's defined to "null" or "undefined".
2017-04-21 10:58:50 +02:00
Kyle Shockey 06c82bb325 Add message that reveals commit that SwaggerUI was derived from 2017-04-20 17:11:54 -07:00
Anna 6cd66bb4f9 Merge pull request #2942 from bodnia/issue-2890
fixes #2890
2017-04-20 22:48:06 +02:00
Anna Bodnia 4e238ce889 fixes #2890 2017-04-20 23:38:49 +03:00
Anna 1418653144 Merge pull request #2940 from bodnia/issue-2881
fixes #2881
2017-04-20 19:47:39 +02:00
Anna Bodnia ca048f42a4 fixes #2881 2017-04-20 20:40:56 +03:00
Anna 26a3ed26e8 Merge pull request #2938 from bodnia/issue-2929
fixes #2929
2017-04-20 18:57:39 +02:00
Anna Bodnia 84b408849d fixes #2929 2017-04-20 19:54:14 +03:00
Anna 7790383ba6 Merge pull request #2924 from bodnia/config-operationsSorter
operationsSorter config
2017-04-19 10:44:25 +02:00
Anna Bodnia 32d7cd7204 build 2017-04-19 11:39:28 +03:00
Anna Bodnia 4963c3016c merge 2017-04-19 11:28:35 +03:00
shockey 0e00a68f7f Merge pull request #2927 from shockey/bug/2919-relative-spec-infer-scheme
Infer scheme with relative-path specs
2017-04-18 19:58:41 -07:00
shockey 754d57396a Merge branch 'master' into bug/2919-relative-spec-infer-scheme 2017-04-18 19:55:29 -07:00
Kyle Shockey db66f56b83 Rebuild dist 2017-04-18 19:51:58 -07:00
Kyle Shockey 8e5be08992 Bump swagger-client 2017-04-18 19:48:19 -07:00
Kyle Shockey 40d7740779 Rebuild dist 2017-04-18 18:16:32 -07:00
Kyle Shockey 8b78d9bd13 Default to no scheme if we can't find an assigned scheme 2017-04-18 18:13:52 -07:00
Kyle Shockey 5fc064e2ac Reorganize tests 2017-04-18 15:08:36 -07:00
shockey f36a66a1b1 Merge pull request #2925 from shockey/bug/2918-null-operations
Add deep access guard to operation update reducer
2017-04-18 11:29:50 -07:00
shockey d5b79c70c9 Merge branch 'master' into bug/2918-null-operations 2017-04-18 11:25:26 -07:00
Kyle Shockey 35769f9b47 Fix #2918; add control/test tests 2017-04-18 11:20:15 -07:00
Anna Bodnia 8e64c866e8 operationsSorter config 2017-04-18 19:06:15 +03:00
Tony Tam 4b984e3c42 Merge pull request #2920 from swagger-api/issue-fix-travis
push tag version
2017-04-17 01:40:40 -04:00
Tony Tam 1794de1679 push tag version 2017-04-16 22:34:58 -07:00
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 e2b1757f8f Infer contextUrl through documentation scheme + host if spec url is relative 2017-04-07 20:51:07 -07:00
Jeff Weeks 2535758adf Merge branch 'master' into master 2017-04-04 14:26:48 -04:00
Jeff Weeks 2a6ecb2d38 Update utils.js 2017-03-29 16:30:25 -04:00
Leo Arias 6a36b58977 Add the daemon 2017-01-14 05:15:39 +00:00
Leo Arias 7169ea32c9 Add the packaging metadata to build the swagger-ui snap 2017-01-14 04:35:51 +00:00
62 changed files with 1040 additions and 408 deletions
+3
View File
@@ -0,0 +1,3 @@
When reporting an issue, please provide the following details:
- swagger-ui version
- a swagger file reproducing the issue
+1 -1
View File
@@ -2,5 +2,5 @@ node_modules
.idea
.deps_check
.DS_Store
npm-debug.log
npm-debug.log*
.eslintcache
+34 -16
View File
@@ -7,26 +7,44 @@ branches:
only:
- master
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
before_deploy: "npm run build-core"
before_deploy:
- npm run build
env:
- DOCKER_IMAGE_NAME=swaggerapi/swagger-ui
deploy:
provider: npm
email: apiteam@swagger.io
skip_cleanup: true
api_key:
secure: "IJkLaACa+rfERf1O5nwlqOyuo9sbul3FBhBt4Un9P+DvEet3AoDPV9NQVLd8SkmQYKGbGQWF4BIdjrO5nqFD6Te+JTeUX5Uo/DFS/fu9qw1xv0dQpvbJFuoYnnFlbzGTEs4CFa8lbu3ZromFHQGOQxRobjsG1Kf0dWFSSzmND3g="
on:
tags: true
repo: swagger-api/swagger-ui
node: '6.9'
- provider: npm
email: apiteam@swagger.io
skip_cleanup: true
api_key:
secure: "IJkLaACa+rfERf1O5nwlqOyuo9sbul3FBhBt4Un9P+DvEet3AoDPV9NQVLd8SkmQYKGbGQWF4BIdjrO5nqFD6Te+JTeUX5Uo/DFS/fu9qw1xv0dQpvbJFuoYnnFlbzGTEs4CFa8lbu3ZromFHQGOQxRobjsG1Kf0dWFSSzmND3g="
on:
tags: true
repo: swagger-api/swagger-ui
node: '6.9'
- provider: script
skip_cleanup: true
script: swagger-ui-dist-package/deploy.sh
on:
tags: true
repo: swagger-api/swagger-ui
node: '6.9'
after_success:
- if [ $DOCKER_HUB_USERNAME ]; then
- 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_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 -1
View File
@@ -2,6 +2,18 @@ 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
@@ -9,7 +21,8 @@ COPY nginx.conf /etc/nginx/
# copy swagger files to the `/js` folder
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"]
+60 -2
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.5 | 2017-03-19 | 2.0 | [tag v3.0.5](https://github.com/swagger-api/swagger-ui/tree/v3.0.5) |
3.0.12 | 2017-03-19 | 2.0 | [tag v3.0.12](https://github.com/swagger-api/swagger-ui/tree/v3.0.12) |
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) |
@@ -58,7 +58,7 @@ To help with the migration, here are the currently known issues with 3.X. This l
- 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:
To use swagger-ui's bundles, 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 as below:
```javascript
const ui = SwaggerUIBundle({
@@ -75,6 +75,35 @@ To use swagger-ui you should take a look at the [source of swagger-ui html page]
})
```
#### OAuth2 configuration
You can configure OAuth2 authorization by calling `initOAuth` method with passed configs under the instance of `SwaggerUIBundle`
default `client_id` and `client_secret`, `realm`, an application name `appName`, `scopeSeparator`, `additionalQueryStringParams`.
Config Name | Description
--- | ---
client_id | Default clientId. MUST be a string
client_secret | Default clientSecret. MUST be a string
realm | realm query parameter (for oauth1) added to `authorizationUrl` and `tokenUrl` . MUST be a string
appName | application name, displayed in authorization popup. MUST be a string
scopeSeparator | scope separator for passing scopes, encoded before calling, default value is a space (encoded value `%20`). MUST be a string
additionalQueryStringParams | Additional query parameters added to `authorizationUrl` and `tokenUrl`. MUST be an object
```
const ui = SwaggerUIBundle({...})
// Method can be called in any place after calling constructor SwaggerUIBundle
ui.initOAuth({
clientId: "your-client-id",
clientSecret: "your-client-secret-if-required",
realm: "your-realms",
appName: "your-app-name",
scopeSeparator: " ",
additionalQueryStringParams: {test: "hello"}
})
```
If you'd like to use the bundle files via npm, check out the [`swagger-ui-dist` package](https://www.npmjs.com/package/swagger-ui-dist).
#### Parameters
Parameter Name | Description
@@ -84,8 +113,37 @@ spec | A JSON object describing the OpenAPI Specification. When used, the `url`
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
operationsSorter | Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically), 'method' (sort by HTTP method) or a function (see Array.prototype.sort() to know how sort function works). Default is the order returned by the server unchanged.
configUrl | Configs URL
parameterMacro | MUST be a function. Function to set default value to parameters. Accepts two arguments parameterMacro(operation, parameter). Operation and parameter are objects passed for context, both remain immutable
modelPropertyMacro | MUST be a function. Function to set default values to each property in model. Accepts one argument modelPropertyMacro(property), property is immutable
### Plugins
#### Topbar plugin
Topbar plugin enables top bar with input for spec path and explore button. By default the plugin is enabled, and to disable it you need to remove Topbar plugin from presets in `src/standalone/index.js`:
```
let preset = [
// TopbarPlugin,
ConfigsPlugin,
() => {
return {
components: { StandaloneLayout }
}
}
]
```
#### Configs plugin
Configs plugin allows to fetch external configs instead of passing them to `SwaggerUIBundle`. Fetched configs support two formats: JSON or yaml. The plugin is enabled by default.
There are three options of passing config:
- add a query parameter `config` with URL to a server where the configs are hosted. For ex. http://petstore.swagger.io/?configs=http://localhost:3001/config.yaml
- add a config `configUrl` with URL to SwaggerUIBundle
- change default configs in `swagger-config.yaml` *Note: after changing, the project must be re-built*
These options can be used altogether, the order of inheritance is following (from the lowest priority to the highest):
`swagger-config.yaml` -> config passed to `SwaggerUIBundle` -> config fetched from `configUrl` passed to `SwaggerUIBundle` -> config fetched from URL passed as a query parameter `config`
## CORS Support
+9
View File
@@ -88,6 +88,15 @@ window.onload = function() {
})
window.ui = ui
ui.initOAuth({
clientId: "your-client-id",
clientSecret: "your-client-secret-if-required",
realm: "your-realms",
appName: "your-app-name",
scopeSeparator: " ",
additionalQueryStringParams: {}
})
}
</script>
</body>
+53
View File
@@ -0,0 +1,53 @@
<!doctype html>
<html lang="en-US">
<body onload="run()">
</body>
</html>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;
qp = (window.location.hash || location.search).substring(1);
arr = qp.split("&")
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value)
}
) : {}
isValid = qp.state === sentState
if (oauth2.auth.schema.get("flow") === "accessCode" && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
});
}
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: "Authorization failed: no accessCode received from the server"
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}
</script>
+1 -1
View File
@@ -90,4 +90,4 @@ window.onload = function() {
</script>
</body>
</html>
</html>
+7 -37
View File
@@ -8,11 +8,13 @@
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var isValid, qp;
var isValid, qp, arr;
qp = (window.location.hash || location.search).substring(1);
qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g, '":"') + '"}',
arr = qp.split("&")
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value)
}
@@ -33,51 +35,19 @@
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
createForm(oauth2.auth, qp).submit();
oauth2.callback(oauth2.auth);
} else {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: "Authorization failed: no accessCode came from the server"
message: "Authorization failed: no accessCode received from the server"
});
window.close();
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid});
window.close();
}
}
function createForm(auth, qp) {
var form = document.createElement("form");
var schema = auth.schema;
var action = schema.get("tokenUrl");
var name, input;
var fields = {
code: qp.code,
"redirect_uri": location.protocol + "//" + location.host + location.pathname,
"grant_type": "authorization_code",
"client_secret": auth.clientSecret,
"client_id": auth.clientId
}
for ( name in fields ) {
input = document.createElement("input");
input.name = name;
input.value = fields[name];
input.type = "hidden";
form.appendChild(input);
}
form.method = "POST";
form.action = action;
document.body.appendChild(form);
return form;
window.close();
}
</script>
+42 -41
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;;;;;;;;;;;;;;;;;;;;;;;;;;AA0dA;;;;;;AAoIA;AAk7FA;AAmtCA;;;;;AA0uIA;AA66IA;AA27FA;AAuwGA;AAilFA;AAikFA;AAs9CA;AA8jDA;AA2qCA;AA4tEA;AAgkIA;;;;;;;;;;;;;;AAw4GA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AAyxDA;AAw6BA;;;;;;AA8vEA;AA+zFA;;;;;AA23CA;AA2qFA;AAq2CA;AA0kCA;AAs/CA;AA0wEA;AA49FA;;;;;;;;;AA20BA;AA2zIA;AAi4DA;AA6tDA","sourceRoot":""}
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AAyTA;;;;;;AAoIA;AAi7FA;AAmtCA;AAi0IA;AA0oJA;AAgwFA;AAyrGA;AA0lFA;AA4nFA;AA+9CA;AAmhDA;AAmrCA;AAg1EA;;;;;AAwoCA;AAsyJA;;;;;;;;;;;;;;AA64EA;AA4mIA;AAquJA;AA2qHA;AA2mGA;AAiiEA;AAq4DA;AAg3DA;AAgRA;;;;;;AAs5FA;AAw3FA;;;;;AAkgDA;AAgsFA;AAw2CA;AA6kCA;AA68CA;AAsgFA;AAq2FA;;;;;;;;;AAkpDA;AA2zIA;AAk4DA;AA8mDA","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;;;;;AA2SA;AAyiGA","sourceRoot":""}
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA8QA;AAmvGA;AAuxFA;;;;;;AAocA;AAkvFA;AAu+CA;AAo+CA;AAgrCA;AAuyEA","sourceRoot":""}
+1 -1
View File
File diff suppressed because one or more lines are too long
+9 -9
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;;;;;;AAuwCA;AAoyHA;AA2wHA;AA07FA;AA+nCA;AAohCA;AAghCA;AAk4BA","sourceRoot":""}
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AA0yCA;AAoyHA;AAgyHA;AAwkGA;AA48BA;AAokCA;AA8iCA;AAs6BA","sourceRoot":""}
+48
View File
@@ -0,0 +1,48 @@
#! /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
TMP_VU="$VALIDATOR_URL"
[[ "$VALIDATOR_URL" != "null" && "$VALIDATOR_URL" != "undefined" ]] && TMP_VU="\"${VALIDATOR_URL}\""
sed -i "s|\(url: .*,\)|\1\n validatorUrl: ${TMP_VU},|g" $INDEX_FILE
unset TMP_VU
fi
exec nginx -g 'daemon off;'
+20
View File
@@ -4,9 +4,23 @@ var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var deepExtend = require('deep-extend')
var autoprefixer = require('autoprefixer')
const {gitDescribeSync} = require('git-describe');
var loadersByExtension = require('./build-tools/loadersByExtension')
var pkg = require('./package.json')
let gitInfo
try {
gitInfo = gitDescribeSync(__dirname)
} catch(e) {
gitInfo = {
hash: 'noGit',
dirty: false
}
}
module.exports = function(options) {
// Special options, that have logic in this file
@@ -60,7 +74,13 @@ module.exports = function(options) {
'process.env': {
NODE_ENV: specialOptions.minimize ? JSON.stringify('production') : null,
WEBPACK_INLINE_STYLES: !Boolean(specialOptions.separateStylesheets)
},
'buildInfo': JSON.stringify({
PACKAGE_VERSION: (pkg.version),
GIT_COMMIT: gitInfo.hash,
GIT_DIRTY: gitInfo.dirty
})
}))
var cssLoader = 'css-loader!postcss-loader'
+7 -2
View File
@@ -1,6 +1,6 @@
{
"name": "swagger-ui",
"version": "3.0.5",
"version": "3.0.12",
"main": "dist/swagger-ui.js",
"repository": "git@github.com:swagger-api/swagger-ui.git",
"contributors": [
@@ -36,10 +36,12 @@
},
"dependencies": {
"babel-polyfill": "^6.23.0",
"base64-js": "^1.2.0",
"brace": "0.7.0",
"deep-extend": "0.4.1",
"expect": "1.20.2",
"getbase": "^2.8.2",
"ieee754": "^1.1.8",
"immutable": "^3.x.x",
"js-yaml": "^3.5.5",
"less": "2.7.1",
@@ -67,7 +69,8 @@
"reselect": "2.5.3",
"serialize-error": "2.0.0",
"shallowequal": "0.2.2",
"swagger-client": "^3.0.5",
"swagger-client": "~3.0.12",
"url-parse": "^1.1.8",
"whatwg-fetch": "0.11.1",
"worker-loader": "^0.7.1",
"xml": "1.0.1",
@@ -92,6 +95,7 @@
"eslint-plugin-react": "^6.10.3",
"extract-text-webpack-plugin": "0.8.2",
"file-loader": "0.8.4",
"git-describe": "^4.0.1",
"html-webpack-plugin": "^2.28.0",
"imports-loader": "0.6.5",
"json-loader": "0.5.3",
@@ -111,6 +115,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",
+28
View File
@@ -0,0 +1,28 @@
name: swagger-ui
version: master
summary: The World's Most Popular API Framework
description: |
Swagger UI is part of the Swagger project. The Swagger project allows you to
produce, visualize and consume your OWN RESTful services. No proxy or 3rd
party services required. Do it your own way.
Swagger UI is a dependency-free collection of HTML, Javascript, and CSS
assets that dynamically generate beautiful documentation and sandbox from a
Swagger-compliant API. Because Swagger UI has no dependencies, you can host
it in any server environment, or on your local machine.
grade: devel
confinement: strict
apps:
swagger-ui:
command: sh -c \"cd $SNAP/lib/node_modules/swagger-ui/dist && http-server -a localhost -p 8080\"
daemon: simple
plugs: [network, network-bind]
parts:
swagger-ui:
source: .
plugin: nodejs
npm-run: [build]
node-packages: [handlebars, http-server]
+4 -5
View File
@@ -64,11 +64,10 @@ export default class ApiKeyAuth extends React.Component {
</Row>
<Row>
<label>Value:</label>
<Col>
{
value || <Input type="text" onChange={ this.onChange }/>
}
</Col>
{
value ? <code> ****** </code>
: <Col><Input type="text" onChange={ this.onChange }/></Col>
}
</Row>
{
errors.valueSeq().map( (error, key) => {
@@ -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">
+14 -10
View File
@@ -63,19 +63,23 @@ export default class BasicAuth extends React.Component {
source={ schema.get("description") } />
</Row>
<Row>
<Col tablet={2} desktop={2}>username:</Col>
<Col tablet={10} desktop={10}>
<label>Username:</label>
{
username ? <code> { username } </code>
: <Col><Input type="text" required="required" name="username" onChange={ this.onChange }/></Col>
}
</Row>
<Row>
<label>Password:</label>
{
username || <Input type="text" required="required" name="username" onChange={ this.onChange }/>
username ? <code> ****** </code>
: <Col><Input required="required"
autoComplete="new-password"
name="password"
type="password"
onChange={ this.onChange }/></Col>
}
</Col>
</Row>
{
!username && <Row>
<Col tablet={2} desktop={2}>password:</Col>
<Col tablet={10} desktop={10}><Input required="required" autoComplete="new-password" name="password" type="password" onChange={ this.onChange }/></Col>
</Row>
}
{
errors.valueSeq().map( (error, key) => {
return <AuthError error={ error }
+69 -55
View File
@@ -21,14 +21,16 @@ export default class Oauth2 extends React.Component {
constructor(props, context) {
super(props, context)
let { name, schema, authorized } = this.props
let { name, schema, authorized, authSelectors } = this.props
let auth = authorized && authorized.get(name)
let authConfigs = authSelectors.getConfigs() || {}
let username = auth && auth.get("username") || ""
let clientId = auth && auth.get("clientId") || ""
let clientSecret = auth && auth.get("clientSecret") || ""
let passwordType = auth && auth.get("passwordType") || "none"
let clientId = auth && auth.get("clientId") || authConfigs.clientId || ""
let clientSecret = auth && auth.get("clientSecret") || authConfigs.clientSecret || ""
let passwordType = auth && auth.get("passwordType") || "basic"
this.state = {
appName: authConfigs.appName,
name: name,
schema: schema,
scopes: [],
@@ -41,11 +43,12 @@ export default class Oauth2 extends React.Component {
}
authorize =() => {
let { authActions, errActions, getConfigs } = this.props
let { authActions, errActions, getConfigs, authSelectors } = this.props
let configs = getConfigs()
let authConfigs = authSelectors.getConfigs()
errActions.clear({authId: name,type: "auth", source: "auth"})
oauth2Authorize(this.state, authActions, errActions, configs)
oauth2Authorize({auth: this.state, authActions, errActions, configs, authConfigs })
}
onScopeChange =(e) => {
@@ -98,6 +101,7 @@ export default class Oauth2 extends React.Component {
return (
<div>
<h4>OAuth2.0 <JumpToPath path={[ "securityDefinitions", name ]} /></h4>
{ !this.state.appName ? null : <h5>Application: { this.state.appName } </h5> }
<Markdown options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
source={ schema.get("description") } />
@@ -108,66 +112,76 @@ export default class Oauth2 extends React.Component {
<p className="flow">Flow: <code>{ schema.get("flow") }</code></p>
{
flow === PASSWORD && ( !isAuthorized || isAuthorized && this.state.username) && <Row>
<Col tablet={2} desktop={2}>username:</Col>
<Col tablet={10} desktop={10}>
flow !== PASSWORD ? null
: <Row>
<Row>
<label htmlFor="oauth_username">username:</label>
{
isAuthorized ? <code> { this.state.username } </code>
: <Col tablet={10} desktop={10}>
<input id="oauth_username" type="text" data-name="username" onChange={ this.onInputChange }/>
</Col>
}
</Row>
{
isAuthorized ? <span>{ this.state.username }</span>
: <input type="text" data-name="username" onChange={ this.onInputChange }/>
}
</Col>
</Row>
<Row>
<label htmlFor="oauth_password">password:</label>
{
isAuthorized ? <code> ****** </code>
: <Col tablet={10} desktop={10}>
<input id="oauth_password" type="password" data-name="password" onChange={ this.onInputChange }/>
</Col>
}
</Row>
<Row>
<label htmlFor="password_type">type:</label>
{
isAuthorized ? <code> { this.state.passwordType } </code>
: <Col tablet={10} desktop={10}>
<select id="password_type" data-name="passwordType" onChange={ this.onInputChange }>
<option value="basic">Basic auth</option>
<option value="request-body">Request body</option>
<option value="query">Query parameters</option>
</select>
</Col>
}
</Row>
</Row>
}
{
flow === PASSWORD && !isAuthorized && <Row>
<Col tablet={2} desktop={2}>password:</Col>
<Col tablet={10} desktop={10}>
<input type="password" data-name="password" onChange={ this.onInputChange }/>
</Col>
</Row>
}
{
flow === PASSWORD && <Row>
<Col tablet={2} desktop={2}>type:</Col>
<Col tablet={10} desktop={10}>
{
isAuthorized ? <span>{ this.state.passwordType }</span>
: <select data-name="passwordType" onChange={ this.onInputChange }>
<option value="none">None or other</option>
<option value="basic">Basic auth</option>
<option value="request">Request body</option>
</select>
}
</Col>
</Row>
}
{
( flow === APPLICATION || flow === IMPLICIT || flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "none") ) &&
( flow === APPLICATION || flow === IMPLICIT || flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "basic") ) &&
( !isAuthorized || isAuthorized && this.state.clientId) && <Row>
<label htmlFor="client_id">client_id:</label>
<Col tablet={10} desktop={10}>
{
isAuthorized ? <span>{ this.state.clientId }</span>
: <input id="client_id" type="text" required={ flow === PASSWORD } data-name="clientId"
{
isAuthorized ? <code> ****** </code>
: <Col tablet={10} desktop={10}>
<input id="client_id"
type="text"
required={ flow === PASSWORD }
value={ this.state.clientId }
data-name="clientId"
onChange={ this.onInputChange }/>
}
</Col>
</Col>
}
</Row>
}
{
( flow === APPLICATION || flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "none") ) && <Row>
( flow === APPLICATION || flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "basic") ) && <Row>
<label htmlFor="client_secret">client_secret:</label>
<Col tablet={10} desktop={10}>
{
isAuthorized ? <span>{ this.state.clientSecret }</span>
: <input id="client_secret" type="text" data-name="clientSecret"
{
isAuthorized ? <code> ****** </code>
: <Col tablet={10} desktop={10}>
<input id="client_secret"
value={ this.state.clientSecret }
type="text"
data-name="clientSecret"
onChange={ this.onInputChange }/>
}
</Col>
</Col>
}
</Row>
}
@@ -179,11 +193,11 @@ export default class Oauth2 extends React.Component {
<Row key={ name }>
<div className="checkbox">
<Input data-value={ name }
id={`${name}-checkbox`}
id={`${name}-checkbox-${this.state.name}`}
disabled={ isAuthorized }
type="checkbox"
onChange={ this.onScopeChange }/>
<label htmlFor={`${name}-checkbox`}>
<label htmlFor={`${name}-checkbox-${this.state.name}`}>
<span className="item"></span>
<div className="text">
<p className="name">{name}</p>
+10 -5
View File
@@ -5,14 +5,18 @@ import Collapse from "react-collapse"
export default class Errors extends React.Component {
static propTypes = {
jumpToLine: PropTypes.func,
editorActions: PropTypes.object,
errSelectors: PropTypes.object.isRequired,
layoutSelectors: PropTypes.object.isRequired,
layoutActions: PropTypes.object.isRequired
}
render() {
let { jumpToLine, errSelectors, layoutSelectors, layoutActions } = this.props
let { editorActions, errSelectors, layoutSelectors, layoutActions } = this.props
if(editorActions && editorActions.jumpToLine) {
var jumpToLine = editorActions.jumpToLine
}
let errors = errSelectors.allErrors()
@@ -37,10 +41,11 @@ export default class Errors extends React.Component {
<Collapse isOpened={ isVisible } animated >
<div className="errors">
{ sortedJSErrors.map((err, i) => {
if(err.get("type") === "thrown") {
let type = err.get("type")
if(type === "thrown" || type === "auth") {
return <ThrownErrorItem key={ i } error={ err.get("error") || err } jumpToLine={jumpToLine} />
}
if(err.get("type") === "spec") {
if(type === "spec") {
return <SpecErrorItem key={ i } error={ err } jumpToLine={jumpToLine} />
}
}) }
@@ -95,7 +100,7 @@ const SpecErrorItem = ( { error, jumpToLine } ) => {
<div>
<h4>{ toTitleCase(error.get("source")) + " " + error.get("level") }&nbsp;{ locationMessage }</h4>
<span style={{ whiteSpace: "pre-line"}}>{ error.get("message") }</span>
<div>
<div style={{ "text-decoration": "underline", "cursor": "pointer" }}>
{ jumpToLine ? (
<a onClick={jumpToLine.bind(null, error.get("line"))}>Jump to line { error.get("line") }</a>
) : null }
+2 -2
View File
@@ -16,7 +16,7 @@ export class Container extends React.Component {
if(fullscreen)
return <section {...rest}/>
let containerClass = "container" + (full ? "-full" : "")
let containerClass = "swagger-container" + (full ? "-full" : "")
return (
<section {...rest} className={xclass(rest.className, containerClass)}/>
)
@@ -127,7 +127,7 @@ export const Input = (props) => <input {...props} />
export class Select extends React.Component {
static propTypes = {
allowedValues: PropTypes.object,
allowedValues: PropTypes.array,
value: PropTypes.any,
onChange: PropTypes.func,
multiple: PropTypes.bool,
+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>
)
}
}
+3 -4
View File
@@ -48,11 +48,10 @@ export default class Operations extends React.Component {
return (
<div className={showTag ? "opblock-tag-section is-open" : "opblock-tag-section"} key={"operation-" + tag}>
<h4 className={!tagDescription ? "opblock-tag no-desc" : "opblock-tag" }>
<span onClick={() => layoutActions.show(isShownKey, !showTag)}>{tag}</span>
<h4 onClick={() => layoutActions.show(isShownKey, !showTag)} className={!tagDescription ? "opblock-tag no-desc" : "opblock-tag" }>
<span>{tag}</span>
{ !tagDescription ? null :
<small onClick={() => layoutActions.show(isShownKey, !showTag)} >
<small>
{ tagDescription }
</small>
}
+4 -3
View File
@@ -55,9 +55,10 @@ export default class ParamBody extends Component {
let isXml = /xml/i.test(consumesValue)
let paramValue = isXml ? parameter.get("value_xml") : parameter.get("value")
if ( paramValue ) {
this.setState({ value: paramValue })
this.onChange(paramValue, {isXml: isXml, isEditBox: isExecute})
if ( paramValue !== undefined ) {
let val = !paramValue && !isXml ? "{}" : paramValue
this.setState({ value: val })
this.onChange(val, {isXml: isXml, isEditBox: isExecute})
} else {
if (isXml) {
this.onChange(this.sample("xml"), {isXml: isXml, isEditBox: isExecute})
+17 -3
View File
@@ -28,11 +28,25 @@ export default class ParameterRow extends Component {
componentWillReceiveProps(props) {
let { specSelectors, pathMethod, param } = props
let example = param.get("example")
let defaultValue = param.get("default")
let parameter = specSelectors.getParameter(pathMethod, param.get("name"))
let value = parameter ? parameter.get("value") : ""
if ( defaultValue !== undefined && value === undefined ) {
this.onChangeWrapper(defaultValue)
let paramValue = parameter ? parameter.get("value") : undefined
let enumValue = parameter ? parameter.get("enum") : undefined
let value
if ( paramValue !== undefined ) {
value = paramValue
} else if ( example !== undefined ) {
value = example
} else if ( defaultValue !== undefined) {
value = defaultValue
} else if ( param.get("required") && enumValue && enumValue.size ) {
value = enumValue.first()
}
if ( value !== undefined ) {
this.onChangeWrapper(value)
}
}
+19 -7
View File
@@ -1,22 +1,32 @@
import deepExtend from "deep-extend"
import System from "core/system"
import win from "core/window"
import ApisPreset from "core/presets/apis"
import * as AllPlugins from "core/plugins/all"
import { filterConfigs } from "plugins/configs"
import { parseSeach } from "core/utils"
import { parseSeach, filterConfigs } from "core/utils"
const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
"apisSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl",
"showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro" ]
// eslint-disable-next-line no-undef
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION } = buildInfo
module.exports = function SwaggerUI(opts) {
win.versions = win.versions || {}
win.versions.swaggerUi = `${PACKAGE_VERSION}/${GIT_COMMIT || "unknown"}${GIT_DIRTY ? "-dirty" : ""}`
const defaults = {
// Some general settings, that we floated to the top
dom_id: null,
spec: {},
url: "",
layout: "Layout",
layout: "BaseLayout",
validatorUrl: "https://online.swagger.io/validator",
configs: {
},
configs: {},
custom: {},
// Initial set of plugins ( TODO rename this, or refactor - we don't need presets _and_ plugins. Its just there for performance.
// Instead, we can compile the first plugin ( it can be a collection of plugins ), then batch the rest.
@@ -68,14 +78,16 @@ module.exports = function SwaggerUI(opts) {
var system = store.getSystem()
let queryConfig = parseSeach()
system.initOAuth = system.authActions.configureAuth
const downloadSpec = (fetchedConfig) => {
if(typeof constructorConfig !== "object") {
return system
}
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
let mergedConfig = deepExtend({}, constructorConfig, localConfig, fetchedConfig || {}, queryConfig)
store.setConfigs(filterConfigs(mergedConfig))
let mergedConfig = deepExtend({}, localConfig, constructorConfig, fetchedConfig || {}, queryConfig)
store.setConfigs(filterConfigs(mergedConfig, CONFIGS))
if (fetchedConfig !== null) {
if (!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
+4 -4
View File
@@ -69,7 +69,7 @@ export class JsonSchema_string extends Component {
return <Input type="file" className={ errors.length ? "invalid" : ""} onChange={ this.onChange } disabled={isDisabled}/>
}
else {
return <Input type="text" className={ errors.length ? "invalid" : ""} value={value} placeholder={description} onChange={ this.onChange } disabled={isDisabled}/>
return <Input type={ schema.format === "password" ? "password" : "text" } className={ errors.length ? "invalid" : ""} value={value} placeholder={description} onChange={ this.onChange } disabled={isDisabled}/>
}
}
}
@@ -150,9 +150,9 @@ export class JsonSchema_array extends Component {
(errors.length ? <span style={{ color: "red", fortWeight: "bold" }}>{ errors[0] }</span> : null) :
value.map( (item,i) => {
let schema = Object.assign({}, itemSchema)
let err = errors.filter((err) => err.index === i)
if ( err.length ) {
schema.errors = [ err[0].error + i ]
if ( errors.length ) {
let err = errors.filter((err) => err.index === i)
if (err.length) schema.errors = [ err[0].error + i ]
}
return (
<div key={i} className="json-schema-form-item">
+51 -23
View File
@@ -1,26 +1,37 @@
import win from "core/window"
import { btoa } from "core/utils"
export default function authorize ( auth, authActions, errActions, configs ) {
export default function authorize ( { auth, authActions, errActions, configs, authConfigs={} } ) {
let { schema, scopes, name, clientId } = auth
let flow = schema.get("flow")
let query = []
switch (flow) {
case "password":
authActions.authorizePassword(auth)
return
case "application":
authActions.authorizeApplication(auth)
return
case "accessCode":
query.push("response_type=code")
break
case "implicit":
query.push("response_type=token")
break
}
if (typeof clientId === "string") {
query.push("client_id=" + encodeURIComponent(clientId))
}
let redirectUrl = configs.oauth2RedirectUrl
let scopeSeparator = " "
let state = name
let flow = schema.get("flow")
let url
if (flow === "password") {
authActions.authorizePassword(auth)
return
}
if (flow === "application") {
authActions.authorizeOauth2Application(auth)
return
}
// todo move to parser
if ( !redirectUrl ) {
if (typeof redirectUrl === "undefined") {
errActions.newAuthErr( {
authId: name,
source: "validation",
@@ -29,22 +40,39 @@ export default function authorize ( auth, authActions, errActions, configs ) {
})
return
}
query.push("redirect_uri=" + encodeURIComponent(redirectUrl))
if (flow === "implicit" || flow === "accessCode") {
url = schema.get("authorizationUrl") + "?response_type=" + (flow === "implicit" ? "token" : "code")
if (Array.isArray(scopes) && 0 < scopes.length) {
let scopeSeparator = authConfigs.scopeSeparator || " "
query.push("scope=" + encodeURIComponent(scopes.join(scopeSeparator)))
}
url += "&redirect_uri=" + encodeURIComponent(redirectUrl)
+ "&scope=" + encodeURIComponent(scopes.join(scopeSeparator))
+ "&state=" + encodeURIComponent(state)
+ "&client_id=" + encodeURIComponent(clientId)
let state = btoa(new Date())
query.push("state=" + encodeURIComponent(state))
if (typeof authConfigs.realm !== "undefined") {
query.push("realm=" + encodeURIComponent(authConfigs.realm))
}
let { additionalQueryStringParams } = authConfigs
for (let key in additionalQueryStringParams) {
if (typeof additionalQueryStringParams[key] !== "undefined") {
query.push([key, additionalQueryStringParams[key]].map(encodeURIComponent).join("="))
}
}
let url = [schema.get("authorizationUrl"), query.join("&")].join("?")
// pass action authorizeOauth2 and authentication data through window
// to authorize with oauth2
win.swaggerUIRedirectOauth2 = {
auth: auth,
state: state,
callback: authActions.preAuthorizeOauth2,
redirectUrl: redirectUrl,
callback: flow === "implicit" ? authActions.preAuthorizeImplicit : authActions.authorizeAccessCode,
errCb: errActions.newAuthErr
}
+102 -64
View File
@@ -1,5 +1,5 @@
import win from "core/window"
import { btoa } from "core/utils"
import { btoa, buildFormData } from "core/utils"
export const SHOW_AUTH_POPUP = "show_popup"
export const AUTHORIZE = "authorize"
@@ -7,6 +7,7 @@ export const LOGOUT = "logout"
export const PRE_AUTHORIZE_OAUTH2 = "pre_authorize_oauth2"
export const AUTHORIZE_OAUTH2 = "authorize_oauth2"
export const VALIDATE = "validate"
export const CONFIGURE_AUTH = "configure_auth"
const scopeSeparator = " "
@@ -31,7 +32,7 @@ export function logout(payload) {
}
}
export const preAuthorizeOauth2 = (payload) => ( { authActions, errActions } ) => {
export const preAuthorizeImplicit = (payload) => ( { authActions, errActions } ) => {
let { auth , token, isValid } = payload
let { schema, name } = auth
let flow = schema.get("flow")
@@ -68,72 +69,87 @@ export function authorizeOauth2(payload) {
}
}
export const authorizePassword = ( auth ) => ( { fn, authActions, errActions } ) => {
export const authorizePassword = ( auth ) => ( { authActions } ) => {
let { schema, name, username, password, passwordType, clientId, clientSecret } = auth
let req = {
url: schema.get("tokenUrl"),
method: "post",
headers: {
"content-type": "application/x-www-form-urlencoded"
},
query: {
grant_type: "password",
username,
password,
scopes: encodeURIComponent(auth.scopes.join(scopeSeparator))
let form = {
grant_type: "password",
scopes: encodeURIComponent(auth.scopes.join(scopeSeparator))
}
let query = {}
let headers = {}
if ( passwordType === "basic") {
headers.Authorization = "Basic " + btoa(username + ":" + password)
} else {
Object.assign(form, {username}, {password})
if ( passwordType === "query") {
if ( clientId ) {
query.client_id = clientId
}
if ( clientSecret ) {
query.client_secret = clientSecret
}
} else {
Object.assign(form, {client_id: clientId}, {client_secret: clientSecret})
}
}
if ( passwordType === "basic") {
req.headers.authorization = "Basic " + btoa(clientId + ":" + clientSecret)
} else if ( passwordType === "request") {
req.query = Object.assign(req.query, { client_id: clientId, client_secret: clientSecret })
}
return fn.fetch(req)
.then(( response ) => {
let token = JSON.parse(response.data)
let error = token && ( token.error || "" )
let parseError = token && ( token.parseError || "" )
if ( !response.ok ) {
errActions.newAuthErr( {
authId: name,
level: "error",
source: "auth",
message: response.statusText
} )
return
}
if ( error || parseError ) {
errActions.newAuthErr({
authId: name,
level: "error",
source: "auth",
message: JSON.stringify(token)
})
return
}
authActions.authorizeOauth2({ auth, token })
})
.catch(err => { errActions.newAuthErr( err ) })
return authActions.authorizeRequest({ body: buildFormData(form), url: schema.get("tokenUrl"), name, headers, query, auth})
}
export const authorizeOauth2Application = ( auth ) => ( { fn, authActions, errActions } ) => {
export const authorizeApplication = ( auth ) => ( { authActions } ) => {
let { schema, scopes, name, clientId, clientSecret } = auth
let form = {
grant_type: "client_credentials",
client_id: clientId,
client_secret: clientSecret,
scope: scopes.join(scopeSeparator)
}
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))
return authActions.authorizeRequest({body: buildFormData(form), name, url: schema.get("tokenUrl"), auth })
}
export const authorizeAccessCode = ( { auth, redirectUrl } ) => ( { authActions } ) => {
let { schema, name, clientId, clientSecret } = auth
let form = {
grant_type: "authorization_code",
code: auth.code,
client_id: clientId,
client_secret: clientSecret,
redirect_uri: redirectUrl
}
return authActions.authorizeRequest({body: buildFormData(form), name, url: schema.get("tokenUrl"), auth})
}
export const authorizeRequest = ( data ) => ( { fn, authActions, errActions, authSelectors } ) => {
let { body, query={}, headers={}, name, url, auth } = data
let { additionalQueryStringParams } = authSelectors.getConfigs() || {}
let fetchUrl = url
for (let key in additionalQueryStringParams) {
url += "&" + key + "=" + encodeURIComponent(additionalQueryStringParams[key])
}
let _headers = Object.assign({
"Accept":"application/json, text/plain, */*",
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/x-www-form-urlencoded"
}, headers)
fn.fetch({
url: fetchUrl,
method: "post",
headers: _headers,
query: query,
body: body
})
.then(function (response) {
let token = JSON.parse(response.data)
let error = token && ( token.error || "" )
let parseError = token && ( token.parseError || "" )
if ( !response.ok ) {
errActions.newAuthErr( {
authId: name,
@@ -142,12 +158,34 @@ export const authorizeOauth2Application = ( auth ) => ( { fn, authActions, errAc
message: response.statusText
} )
return
} else {
response.json()
.then(function (json){
authActions.authorizeOauth2({ auth, token: json})
})
}
if ( error || parseError ) {
errActions.newAuthErr({
authId: name,
level: "error",
source: "auth",
message: JSON.stringify(token)
})
return
}
authActions.authorizeOauth2({ auth, token})
})
.catch(e => {
let err = new Error(e)
errActions.newAuthErr( {
authId: name,
level: "error",
source: "auth",
message: err.message
} )
})
.catch(err => { errActions.newAuthErr( err ) })
}
export function configureAuth(payload) {
return {
type: CONFIGURE_AUTH,
payload: payload
}
}
+6 -1
View File
@@ -5,7 +5,8 @@ import {
SHOW_AUTH_POPUP,
AUTHORIZE,
AUTHORIZE_OAUTH2,
LOGOUT
LOGOUT,
CONFIGURE_AUTH
} from "./actions"
export default {
@@ -57,5 +58,9 @@ export default {
})
return state.set("authorized", result)
},
[CONFIGURE_AUTH]: (state, { payload } ) =>{
return state.set("configs", payload)
}
}
+9
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
@@ -75,3 +79,8 @@ export const isAuthorized = ( state, securities ) =>( { authSelectors } ) => {
}).indexOf(false) === -1
}).length
}
export const getConfigs = createSelector(
state,
auth => auth.get( "configs" )
)
+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"]) {
+20 -6
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)
@@ -76,7 +77,9 @@ export const parseToJson = (str) => ({specActions, specSelectors, errActions}) =
return specActions.updateJsonSpec(json)
}
export const resolveSpec = (json, url) => ({specActions, specSelectors, errActions, fn: { fetch, resolve, AST }}) => {
export const resolveSpec = (json, url) => ({specActions, specSelectors, errActions, fn: { fetch, resolve, AST }, getConfigs}) => {
const { modelPropertyMacro, parameterMacro } = getConfigs()
if(typeof(json) === "undefined") {
json = specSelectors.specJson()
}
@@ -88,7 +91,7 @@ export const resolveSpec = (json, url) => ({specActions, specSelectors, errActio
let specStr = specSelectors.specStr()
return resolve({fetch, spec: json, baseDoc: url})
return resolve({fetch, spec: json, baseDoc: url, modelPropertyMacro, parameterMacro })
.then( ({spec, errors}) => {
errActions.clear({
type: "thrown"
@@ -185,12 +188,23 @@ export const logRequest = (req) => {
// Actually fire the request via fn.execute
// (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 ( pathName && method ) {
parsedRequest.operationId = method.toLowerCase() + "-" + pathName
let { pathName, method, operation } = req
let op = operation.toJS()
// if url is relative, parseUrl makes it absolute by inferring from `window.location`
req.contextUrl = parseUrl(specSelectors.url()).toString()
if(op && op.operationId) {
req.operationId = op.operationId
} else if(op && pathName && method) {
req.operationId = fn.opId(op, pathName, method)
}
let parsedRequest = Object.assign({}, req)
parsedRequest = fn.buildRequest(parsedRequest)
specActions.setRequest(req.pathName, req.method, parsedRequest)
return fn.execute(req)
+5 -1
View File
@@ -97,7 +97,11 @@ export default {
},
[UPDATE_OPERATION_VALUE]: (state, { payload: { path, value, key } }) => {
return state.setIn(["resolved", "paths", ...path, key], fromJS(value))
let operationPath = ["resolved", "paths", ...path]
if(!state.getIn(operationPath)) {
return state
}
return state.setIn([...operationPath, key], fromJS(value))
},
[CLEAR_RESPONSE]: (state, { payload: { path, method } } ) =>{
+16 -8
View File
@@ -1,4 +1,5 @@
import { createSelector } from "reselect"
import { sorters } from "core/utils"
import { fromJS, Set, Map, List } from "immutable"
const DEFAULT_TAG = "default"
@@ -198,13 +199,16 @@ export const operationsWithTags = createSelector(
}
)
export const taggedOperations = createSelector(
state,
operationsWithTags,
(state, tagMap) => {
return tagMap.map((ops, tag) => Map({tagDetails: tagDetails(state, tag), operations: ops}))
}
)
export const taggedOperations = ( state ) =>( { getConfigs } ) => {
let { operationsSorter }= getConfigs()
return operationsWithTags(state).map((ops, tag) => {
let sortFn = typeof operationsSorter === "function" ? operationsSorter
: sorters.operationsSorter[operationsSorter]
let operations = !sortFn ? ops : ops.sort(sortFn)
return Map({tagDetails: tagDetails(state, tag), operations: operations})})
}
export const responses = createSelector(
state,
@@ -291,7 +295,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 || ""
}
export const canExecuteScheme = ( state, path, method ) => {
+2 -1
View File
@@ -7,7 +7,8 @@ module.exports = function({ configs }) {
buildRequest: Swagger.buildRequest,
execute: Swagger.execute,
resolve: Swagger.resolve,
serializeRes: Swagger.serializeRes
serializeRes: Swagger.serializeRes,
opId: Swagger.helpers.opId
}
}
}
+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
}
}
+3 -4
View File
@@ -2,7 +2,6 @@ import { createStore, applyMiddleware, bindActionCreators, compose } from "redux
import Im, { fromJS, Map } from "immutable"
import deepExtend from "deep-extend"
import { combineReducers } from "redux-immutable"
import assign from "object-assign"
import serializeError from "serialize-error"
import { NEW_THROWN_ERR } from "corePlugins/err/actions"
import win from "core/window"
@@ -74,7 +73,7 @@ export default class Store {
let dispatch = this.getStore().dispatch
let getState = this.getStore().getState
this.boundSystem = assign({},
this.boundSystem = Object.assign({},
this.getRootInjects(),
this.getWrappedAndBoundActions(dispatch),
this.getBoundSelectors(getState, this.getSystem),
@@ -92,7 +91,7 @@ export default class Store {
}
getRootInjects() {
return assign({
return Object.assign({
getSystem: this.getSystem,
getStore: this.getStore.bind(this),
getComponents: this.getComponents.bind(this),
@@ -251,7 +250,7 @@ export default class Store {
getMapStateToProps() {
return () => {
let obj = assign({}, this.getSystem())
let obj = Object.assign({}, this.getSystem())
return obj
}
}
+34 -4
View File
@@ -1,5 +1,4 @@
import Im from "immutable"
import assign from "object-assign"
import shallowEqual from "shallowequal"
import camelCase from "lodash/camelCase"
@@ -85,7 +84,7 @@ export function objReduce(obj, fn) {
return Object.keys(obj).reduce((newObj, key) => {
let res = fn(obj[key], key)
if(res && typeof res === "object")
assign(newObj, res)
Object.assign(newObj, res)
return newObj
}, {})
}
@@ -453,13 +452,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"
}
}
@@ -559,3 +558,34 @@ export const btoa = (str) => {
return buffer.toString("base64")
}
export const sorters = {
operationsSorter: {
alpha: (a, b) => a.get("path").localeCompare(b.get("path")),
method: (a, b) => a.get("method").localeCompare(b.get("method"))
}
}
export const buildFormData = (data) => {
let formArr = []
for (let name in data) {
let val = data[name]
if (val !== undefined && val !== "") {
formArr.push([name, "=", encodeURIComponent(val).replace(/%20/g,"+")].join(""))
}
}
return formArr.join("&")
}
export const filterConfigs = (configs, allowed) => {
let i, filteredConfigs = {}
for (i in configs) {
if (allowed.indexOf(i) !== -1) {
filteredConfigs[i] = configs[i]
}
}
return filteredConfigs
}
-17
View File
@@ -1,10 +1,6 @@
import YAML from "js-yaml"
import yamlConfig from "../../../swagger-config.yaml"
const CONFIGS = [ "url", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
"apisSorter", "operationsSorter", "supportedSubmitMethods", "highlightSizeThreshold", "dom_id",
"defaultModelRendering", "oauth2RedirectUrl", "showRequestHeaders" ]
const parseYamlConfig = (yaml, system) => {
try {
return YAML.safeLoad(yaml)
@@ -58,16 +54,3 @@ export default function configPlugin (toolbox) {
}
}
}
export function filterConfigs (configs) {
let i, filteredConfigs = {}
for (i in configs) {
if (CONFIGS.indexOf(i) !== -1) {
filteredConfigs[i] = configs[i]
}
}
return filteredConfigs
}
+4 -3
View File
@@ -19,9 +19,10 @@ export default class Topbar extends React.Component {
this.setState({url: value})
}
downloadUrl = () => {
downloadUrl = (e) => {
this.props.specActions.updateUrl(this.state.url)
this.props.specActions.download(this.state.url)
e.preventDefault()
}
render() {
@@ -43,10 +44,10 @@ export default class Topbar extends React.Component {
<img height="30" width="30" src={ Logo } alt="Swagger UX"/>
<span>swagger</span>
</Link>
<div className="download-url-wrapper">
<form className="download-url-wrapper" onSubmit={this.downloadUrl}>
<input className="download-url-input" type="text" onChange={ this.onUrlChange } value={this.state.url} disabled={isLoading} style={inputStyle} />
<Button className="download-url-button" onClick={ this.downloadUrl }>Explore</Button>
</div>
</form>
</div>
</div>
</div>
+2
View File
@@ -2,11 +2,13 @@ import StandaloneLayout from "./layout"
import "../style/main.scss"
import TopbarPlugin from "plugins/topbar"
import ConfigsPlugin from "plugins/configs"
// the Standalone preset
let preset = [
TopbarPlugin,
ConfigsPlugin,
() => {
return {
components: { StandaloneLayout }
+9 -55
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,46 +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 }
<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>
)
}
+12
View File
@@ -492,16 +492,28 @@ body
margin: 0;
padding: 10px;
word-wrap: break-word;
word-break: break-all;
word-break: break-word;
hyphens: auto;
white-space: pre-wrap;
border-radius: 4px;
background: #41444e;
overflow-wrap: break-word;
@include text_code(#fff);
span
{
color: #fff !important;
}
.headerline
{
display: block;
}
}
.scheme-container
+5
View File
@@ -16,6 +16,8 @@
display: flex;
max-width: 300px;
text-decoration: none;
flex: 1;
@@ -33,8 +35,11 @@
{
display: flex;
flex: 3;
input[type=text]
{
width: 100%;
min-width: 350px;
margin: 0;
+2
View File
@@ -0,0 +1,2 @@
README.md
deploy.sh
+1
View File
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
+8
View File
@@ -0,0 +1,8 @@
This module, `swagger-ui-dist`, exposes Swagger-UI's entire dist folder as a dependency-free npm module. Use `swagger-ui` instead, if you'd like to have npm install dependencies for you.
`SwaggerUIBundle` and `SwaggerUIStandalonePreset` can be imported:
```javascript
import { SwaggerUIBundle, SwaggerUIStandalonePreset } from 'swagger-ui-dist'
```
For anything else, check the [Swagger-UI](https://github.com/swagger-api/swagger-ui) repository.
+21
View File
@@ -0,0 +1,21 @@
# Deploy `swagger-ui-dist` to npm.
# Parameter Expansion: http://stackoverflow.com/questions/6393551/what-is-the-meaning-of-0-in-a-bash-script
cd "${0%/*}"
# Get UI version
UI_VERSION=$(node -p "require('../package.json').version")
# Replace our version placeholder with UI's version
sed -i "s|\$\$VERSION|$UI_VERSION|g" package.json
# Copy UI's dist files to our directory
cp ../dist/* .
if [ "$PUBLISH_DIST" = "true" ] || [ "$TRAVIS" = "true" ] ; then
npm publish .
else
npm pack .
fi
find . -not -name .npmignore -not -name .npmrc -not -name deploy.sh -not -name index.js -not -name package.json -not -name README.md -not -name *.tgz -delete
+2
View File
@@ -0,0 +1,2 @@
module.exports.SwaggerUIBundle = require('./swagger-ui-bundle.js')
module.exports.SwaggerUIStandalonePreset = require('./swagger-ui-standalone-preset.js')
+18
View File
@@ -0,0 +1,18 @@
{
"name": "swagger-ui-dist",
"version": "$$VERSION",
"main": "index.js",
"repository": "git@github.com:swagger-api/swagger-ui.git",
"contributors": [
"(in alphabetical order)",
"Anna Bodnia <anna.bodnia@gmail.com>",
"Buu Nguyen <buunguyen@gmail.com>",
"Josh Ponelat <jponelat@gmail.com>",
"Kyle Shockey <kyleshockey1@gmail.com>",
"Robert Barnwell <robert@robertismy.name>",
"Sahar Jafari <shr.jafari@gmail.com>"
],
"license": "Apache-2.0",
"dependencies": {},
"devDependencies": {}
}
+72
View File
@@ -0,0 +1,72 @@
/* eslint-env mocha */
import expect from "expect"
import { fromJS } from "immutable"
import reducer from "corePlugins/spec/reducers"
describe("spec plugin - reducer", function(){
describe("update operation value", function() {
it("should update the operation at the specified key", () => {
const updateOperationValue = reducer["spec_update_operation_value"]
const state = fromJS({
resolved: {
"paths": {
"/pet": {
"post": {
"description": "my operation"
}
}
}
}
})
let result = updateOperationValue(state, {
payload: {
path: ["/pet", "post"],
value: "application/json",
key: "consumes_value"
}
})
let expectedResult = {
resolved: {
"paths": {
"/pet": {
"post": {
"description": "my operation",
"consumes_value": "application/json"
}
}
}
}
}
expect(result.toJS()).toEqual(expectedResult)
})
it("shouldn't throw an error if we try to update the consumes_value of a null operation", () => {
const updateOperationValue = reducer["spec_update_operation_value"]
const state = fromJS({
resolved: {
"paths": {
"/pet": {
"post": null
}
}
}
})
let result = updateOperationValue(state, {
payload: {
path: ["/pet", "post"],
value: "application/json",
key: "consumes_value"
}
})
expect(result.toJS()).toEqual(state.toJS())
})
})
})
@@ -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
// })
// })
})
})
+4 -1
View File
@@ -22,7 +22,10 @@ module.exports = require('./make-webpack-config.js')({
},
externals: function(context, request, cb) {
if(node_modules.indexOf(request) !== -1) {
// webpack injects some stuff into the resulting file,
// these libs need to be pulled in to keep that working.
var exceptionsForWebpack = ["ieee754", "base64-js"]
if(node_modules.indexOf(request) !== -1 || exceptionsForWebpack.indexOf(request) !== -1) {
cb(null, 'commonjs ' + request)
return;
}