├── src ├── test │ ├── resources │ │ ├── myassets │ │ │ └── test.html │ │ ├── test-simple.yaml │ │ ├── test-simple-with-root-path.yaml │ │ ├── test-default-with-path-set-programatically.yaml │ │ ├── test-simple-with-context-path.yaml │ │ ├── test-simple-with-context-and-root-path.yaml │ │ ├── test-default.yaml │ │ ├── test-default-assets.yaml │ │ ├── test-default-root-path.yaml │ │ ├── test-default-context-path.yaml │ │ └── test-default-context-and-root-path.yaml │ └── java │ │ └── io │ │ └── federecio │ │ └── dropwizard │ │ └── swagger │ │ ├── TestConfiguration.java │ │ ├── TestApplicationWithAssetsAndPathSetProgramatically.java │ │ ├── DefaultServerTest.java │ │ ├── SimpleServerTest.java │ │ ├── DefaultServerWithRootPathSetTest.java │ │ ├── TestResource.java │ │ ├── DefaultServerWithApplicationContextPathSetTest.java │ │ ├── SimpleServerWithRootPathSetTest.java │ │ ├── SimpleServerWithApplicationContextPathSetTest.java │ │ ├── selenium │ │ ├── SimpleServerSeleniumTest.java │ │ ├── DefaultServerWithRootPathSetSeleniumTest.java │ │ ├── DefaultServerWithApplicationContextPathSetSeleniumTest.java │ │ ├── SimpleServerWithRootPathSeleniumTest.java │ │ ├── DefaultServerSeleniumTest.java │ │ ├── DefaultServerWithApplicationContextPathAndRootPathSetSeleniumTest.java │ │ ├── SimpleServerWithApplicationContextPathAndRootPathSeleniumTest.java │ │ ├── DefaultServerWithPathSetProgramaticallySeleniumTest.java │ │ ├── SimpleServerWithApplicationContextPathSeleniumTest.java │ │ ├── DefaultServerWithAssetsSeleniumTest.java │ │ └── SeleniumTest.java │ │ ├── DefaultServerWithApplicationContextPathAndRootPathSetTest.java │ │ ├── SimpleServerWithApplicationContextPathAndRootPathSetTest.java │ │ ├── DefaultServerWithPathSetProgramaticallyTest.java │ │ ├── TestApplication.java │ │ ├── TestApplicationWithPathSetProgramatically.java │ │ └── DropwizardTest.java └── main │ ├── resources │ ├── swagger-static │ │ ├── images │ │ │ ├── throbber.gif │ │ │ ├── logo_small.png │ │ │ ├── pet_store_api.png │ │ │ ├── wordnik_api.png │ │ │ └── explorer_icons.png │ │ ├── fonts │ │ │ ├── droid-sans-v6-latin-700.eot │ │ │ ├── droid-sans-v6-latin-700.ttf │ │ │ ├── droid-sans-v6-latin-700.woff │ │ │ ├── droid-sans-v6-latin-700.woff2 │ │ │ ├── droid-sans-v6-latin-regular.eot │ │ │ ├── droid-sans-v6-latin-regular.ttf │ │ │ ├── droid-sans-v6-latin-regular.woff │ │ │ └── droid-sans-v6-latin-regular.woff2 │ │ ├── lib │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── jquery.ba-bbq.min.js │ │ │ ├── highlight.7.3.pack.js │ │ │ ├── shred │ │ │ │ └── content.js │ │ │ ├── swagger-oauth.js │ │ │ ├── underscore-min.js │ │ │ ├── backbone-min.js │ │ │ └── marked.js │ │ ├── o2c.html │ │ ├── css │ │ │ ├── typography.css │ │ │ └── reset.css │ │ └── index.html │ └── io │ │ └── federecio │ │ └── dropwizard │ │ └── swagger │ │ └── index.ftl │ └── java │ └── io │ └── federecio │ └── dropwizard │ └── swagger │ ├── SwaggerUIConfiguration.java │ ├── SwaggerResource.java │ ├── Constants.java │ ├── SwaggerView.java │ ├── ConfigurationHelper.java │ ├── SwaggerBundleConfiguration.java │ └── SwaggerBundle.java ├── .gitignore ├── license.txt ├── README.md └── pom.xml /src/test/resources/myassets/test.html: -------------------------------------------------------------------------------- 1 |

test asset

-------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.ipr 3 | *.iws 4 | target/ 5 | .idea/ 6 | .DS_Store -------------------------------------------------------------------------------- /src/main/resources/swagger-static/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/images/throbber.gif -------------------------------------------------------------------------------- /src/main/resources/swagger-static/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/images/logo_small.png -------------------------------------------------------------------------------- /src/main/resources/swagger-static/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/images/pet_store_api.png -------------------------------------------------------------------------------- /src/main/resources/swagger-static/images/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/images/wordnik_api.png -------------------------------------------------------------------------------- /src/main/resources/swagger-static/images/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/images/explorer_icons.png -------------------------------------------------------------------------------- /src/test/resources/test-simple.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: simple 3 | connector: 4 | type: http 5 | port: 55668 6 | swagger: 7 | resourcePackage: io.federecio.dropwizard.swagger -------------------------------------------------------------------------------- /src/main/resources/swagger-static/fonts/droid-sans-v6-latin-700.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/fonts/droid-sans-v6-latin-700.eot -------------------------------------------------------------------------------- /src/main/resources/swagger-static/fonts/droid-sans-v6-latin-700.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/fonts/droid-sans-v6-latin-700.ttf -------------------------------------------------------------------------------- /src/main/resources/swagger-static/fonts/droid-sans-v6-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/fonts/droid-sans-v6-latin-700.woff -------------------------------------------------------------------------------- /src/main/resources/swagger-static/fonts/droid-sans-v6-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/fonts/droid-sans-v6-latin-700.woff2 -------------------------------------------------------------------------------- /src/main/resources/swagger-static/fonts/droid-sans-v6-latin-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/fonts/droid-sans-v6-latin-regular.eot -------------------------------------------------------------------------------- /src/main/resources/swagger-static/fonts/droid-sans-v6-latin-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/fonts/droid-sans-v6-latin-regular.ttf -------------------------------------------------------------------------------- /src/main/resources/swagger-static/fonts/droid-sans-v6-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/fonts/droid-sans-v6-latin-regular.woff -------------------------------------------------------------------------------- /src/main/resources/swagger-static/fonts/droid-sans-v6-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/dropwizard-swagger/master/src/main/resources/swagger-static/fonts/droid-sans-v6-latin-regular.woff2 -------------------------------------------------------------------------------- /src/test/resources/test-simple-with-root-path.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: simple 3 | rootPath: /api/* 4 | connector: 5 | type: http 6 | port: 51478 7 | swagger: 8 | resourcePackage: io.federecio.dropwizard.swagger -------------------------------------------------------------------------------- /src/test/resources/test-default-with-path-set-programatically.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: default 3 | applicationConnectors: 4 | - type: http 5 | port: 33333 6 | adminConnectors: 7 | - type: http 8 | port: 44449 -------------------------------------------------------------------------------- /src/test/resources/test-simple-with-context-path.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: simple 3 | applicationContextPath: / 4 | connector: 5 | type: http 6 | port: 51378 7 | swagger: 8 | resourcePackage: io.federecio.dropwizard.swagger -------------------------------------------------------------------------------- /src/test/resources/test-simple-with-context-and-root-path.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: simple 3 | applicationContextPath: / 4 | rootPath: /api/* 5 | connector: 6 | type: http 7 | port: 51578 8 | swagger: 9 | resourcePackage: io.federecio.dropwizard.swagger -------------------------------------------------------------------------------- /src/test/resources/test-default.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: default 3 | applicationConnectors: 4 | - type: http 5 | port: 44444 6 | adminConnectors: 7 | - type: http 8 | port: 44445 9 | swagger: 10 | resourcePackage: io.federecio.dropwizard.swagger -------------------------------------------------------------------------------- /src/test/resources/test-default-assets.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: default 3 | applicationConnectors: 4 | - type: http 5 | port: 33355 6 | adminConnectors: 7 | - type: http 8 | port: 44450 9 | swagger: 10 | resourcePackage: io.federecio.dropwizard.swagger -------------------------------------------------------------------------------- /src/test/resources/test-default-root-path.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: default 3 | rootPath: /api/* 4 | applicationConnectors: 5 | - type: http 6 | port: 41414 7 | adminConnectors: 8 | - type: http 9 | port: 41415 10 | swagger: 11 | resourcePackage: io.federecio.dropwizard.swagger -------------------------------------------------------------------------------- /src/test/resources/test-default-context-path.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: default 3 | applicationContextPath: /app 4 | applicationConnectors: 5 | - type: http 6 | port: 43434 7 | adminConnectors: 8 | - type: http 9 | port: 43435 10 | swagger: 11 | resourcePackage: io.federecio.dropwizard.swagger -------------------------------------------------------------------------------- /src/test/resources/test-default-context-and-root-path.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | type: default 3 | applicationContextPath: /app 4 | rootPath: /api/* 5 | applicationConnectors: 6 | - type: http 7 | port: 42424 8 | adminConnectors: 9 | - type: http 10 | port: 42425 11 | swagger: 12 | resourcePackage: io.federecio.dropwizard.swagger -------------------------------------------------------------------------------- /src/main/resources/swagger-static/lib/jquery.slideto.min.js: -------------------------------------------------------------------------------- 1 | (function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery); 2 | -------------------------------------------------------------------------------- /src/main/resources/swagger-static/o2c.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Federico Recio 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /src/main/resources/swagger-static/lib/jquery.wiggle.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | jQuery Wiggle 3 | Author: WonderGroup, Jordan Thomas 4 | URL: http://labs.wondergroup.com/demos/mini-ui/index.html 5 | License: MIT (http://en.wikipedia.org/wiki/MIT_License) 6 | */ 7 | jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('
').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);} 8 | if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});}; -------------------------------------------------------------------------------- /src/main/java/io/federecio/dropwizard/swagger/SwaggerUIConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.federecio.dropwizard.swagger; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | public class SwaggerUIConfiguration { 6 | @JsonProperty 7 | String authName = "api_key"; 8 | 9 | @JsonProperty 10 | String authKey = "api_key"; 11 | 12 | @JsonProperty 13 | String authKeyLocation = "query"; 14 | 15 | public String getAuthName() { 16 | return authName; 17 | } 18 | 19 | public void setAuthName(String authName) { 20 | this.authName = authName; 21 | } 22 | 23 | public String getAuthKey() { 24 | return authKey; 25 | } 26 | 27 | public void setAuthKey(String authKey) { 28 | this.authKey = authKey; 29 | } 30 | 31 | public String getAuthKeyLocation() { 32 | return authKeyLocation; 33 | } 34 | 35 | public void setAuthKeyLocation(String authKeyLocation) { 36 | this.authKeyLocation = authKeyLocation; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/TestConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import com.fasterxml.jackson.annotation.JsonProperty; 19 | import io.dropwizard.Configuration; 20 | 21 | /** 22 | * @author Federico Recio 23 | */ 24 | public class TestConfiguration extends Configuration { 25 | 26 | @JsonProperty("swagger") 27 | public SwaggerBundleConfiguration swaggerBundleConfiguration; 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/TestApplicationWithAssetsAndPathSetProgramatically.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.dropwizard.assets.AssetsBundle; 19 | import io.dropwizard.setup.Bootstrap; 20 | 21 | /** 22 | * @author Federico Recio 23 | */ 24 | public class TestApplicationWithAssetsAndPathSetProgramatically extends TestApplicationWithPathSetProgramatically { 25 | @Override 26 | public void initialize(Bootstrap bootstrap) { 27 | super.initialize(bootstrap); 28 | bootstrap.addBundle(new AssetsBundle("/myassets", "/")); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/DefaultServerTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import org.junit.runner.RunWith; 21 | 22 | /** 23 | * @author Federico Recio 24 | */ 25 | @RunWith(DropwizardJunitRunner.class) 26 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-default.yaml") 27 | public class DefaultServerTest extends DropwizardTest { 28 | 29 | public DefaultServerTest() { 30 | super(44444, "/"); 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/SimpleServerTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import org.junit.runner.RunWith; 21 | 22 | /** 23 | * @author Federico Recio 24 | */ 25 | @RunWith(DropwizardJunitRunner.class) 26 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-simple.yaml") 27 | public class SimpleServerTest extends DropwizardTest { 28 | 29 | public SimpleServerTest() { 30 | super(55668, "/application"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/DefaultServerWithRootPathSetTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import org.junit.runner.RunWith; 21 | 22 | @RunWith(DropwizardJunitRunner.class) 23 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-default-root-path.yaml") 24 | public class DefaultServerWithRootPathSetTest extends DropwizardTest { 25 | 26 | public DefaultServerWithRootPathSetTest() { 27 | super(41414, "/api"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/TestResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.swagger.annotations.Api; 19 | import io.swagger.annotations.ApiOperation; 20 | 21 | import javax.ws.rs.GET; 22 | import javax.ws.rs.Path; 23 | import javax.ws.rs.core.Response; 24 | 25 | /** 26 | * @author Federico Recio 27 | */ 28 | @Path("/test.json") 29 | @Api("/test") 30 | public class TestResource { 31 | public static final String OPERATION_DESCRIPTION = "This is a dummy endpoint for test"; 32 | 33 | @GET 34 | @ApiOperation(OPERATION_DESCRIPTION) 35 | public Response dummyEndpoint() { 36 | return Response.ok().build(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/DefaultServerWithApplicationContextPathSetTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import org.junit.runner.RunWith; 21 | 22 | @RunWith(DropwizardJunitRunner.class) 23 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-default-context-path.yaml") 24 | public class DefaultServerWithApplicationContextPathSetTest extends DropwizardTest { 25 | 26 | public DefaultServerWithApplicationContextPathSetTest(){ 27 | super(43434, "/app"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/SimpleServerWithRootPathSetTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import org.junit.runner.RunWith; 21 | 22 | /** 23 | * @author Federico Recio 24 | */ 25 | @RunWith(DropwizardJunitRunner.class) 26 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-simple-with-root-path.yaml") 27 | public class SimpleServerWithRootPathSetTest extends DropwizardTest { 28 | 29 | public SimpleServerWithRootPathSetTest() { 30 | super(51478, "/application/api"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/SimpleServerWithApplicationContextPathSetTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import org.junit.runner.RunWith; 21 | 22 | /** 23 | * @author Federico Recio 24 | */ 25 | @RunWith(DropwizardJunitRunner.class) 26 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-simple-with-context-path.yaml") 27 | public class SimpleServerWithApplicationContextPathSetTest extends DropwizardTest { 28 | 29 | public SimpleServerWithApplicationContextPathSetTest() { 30 | super(51378, "/"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/SimpleServerSeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.TestApplication; 21 | import org.junit.runner.RunWith; 22 | 23 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-simple.yaml") 24 | @RunWith(DropwizardJunitRunner.class) 25 | public class SimpleServerSeleniumTest extends SeleniumTest { 26 | 27 | @Override 28 | protected String getSwaggerUrl() { 29 | return getSwaggerUrl(55668, "/application/swagger"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/DefaultServerWithApplicationContextPathAndRootPathSetTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import org.junit.runner.RunWith; 21 | 22 | @RunWith(DropwizardJunitRunner.class) 23 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-default-context-and-root-path.yaml") 24 | public class DefaultServerWithApplicationContextPathAndRootPathSetTest extends DropwizardTest { 25 | 26 | public DefaultServerWithApplicationContextPathAndRootPathSetTest() { 27 | super(42424, "/app/api"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/DefaultServerWithRootPathSetSeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.TestApplication; 21 | import org.junit.runner.RunWith; 22 | 23 | @RunWith(DropwizardJunitRunner.class) 24 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-default-root-path.yaml") 25 | public class DefaultServerWithRootPathSetSeleniumTest extends SeleniumTest { 26 | 27 | @Override 28 | protected String getSwaggerUrl() { 29 | return getSwaggerUrl(41414, "/api/swagger"); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/SimpleServerWithApplicationContextPathAndRootPathSetTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import org.junit.runner.RunWith; 21 | 22 | /** 23 | * @author Federico Recio 24 | */ 25 | @RunWith(DropwizardJunitRunner.class) 26 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-simple-with-context-and-root-path.yaml") 27 | public class SimpleServerWithApplicationContextPathAndRootPathSetTest extends DropwizardTest { 28 | 29 | public SimpleServerWithApplicationContextPathAndRootPathSetTest() { 30 | super(51578, "/api"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/federecio/dropwizard/swagger/SwaggerResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import javax.ws.rs.GET; 19 | import javax.ws.rs.Path; 20 | import javax.ws.rs.Produces; 21 | import javax.ws.rs.core.MediaType; 22 | 23 | /** 24 | * @author Federico Recio 25 | */ 26 | @Path(Constants.SWAGGER_PATH) 27 | @Produces(MediaType.TEXT_HTML) 28 | public class SwaggerResource { 29 | private final String urlPattern; 30 | private final SwaggerUIConfiguration config; 31 | 32 | public SwaggerResource(String urlPattern, SwaggerUIConfiguration config) { 33 | this.urlPattern = urlPattern; 34 | this.config = config; 35 | } 36 | 37 | @GET 38 | public SwaggerView get() { 39 | return new SwaggerView(urlPattern, config); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/DefaultServerWithApplicationContextPathSetSeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.TestApplication; 21 | import org.junit.runner.RunWith; 22 | 23 | @RunWith(DropwizardJunitRunner.class) 24 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-default-context-path.yaml") 25 | public class DefaultServerWithApplicationContextPathSetSeleniumTest extends SeleniumTest { 26 | 27 | @Override 28 | protected String getSwaggerUrl() { 29 | return getSwaggerUrl(43434, "/app/swagger"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/DefaultServerWithPathSetProgramaticallyTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import org.junit.runner.RunWith; 21 | 22 | /** 23 | * @author Federico Recio 24 | */ 25 | @RunWith(DropwizardJunitRunner.class) 26 | @DropwizardTestConfig(applicationClass = TestApplicationWithPathSetProgramatically.class, yamlFile = "/test-default-with-path-set-programatically.yaml") 27 | public class DefaultServerWithPathSetProgramaticallyTest extends DropwizardTest { 28 | 29 | public DefaultServerWithPathSetProgramaticallyTest() { 30 | super(33333, TestApplicationWithPathSetProgramatically.BASE_PATH); 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/SimpleServerWithRootPathSeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.TestApplication; 21 | import org.junit.runner.RunWith; 22 | 23 | /** 24 | * @author Federico Recio 25 | */ 26 | @RunWith(DropwizardJunitRunner.class) 27 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-simple-with-root-path.yaml") 28 | public class SimpleServerWithRootPathSeleniumTest extends SeleniumTest { 29 | 30 | @Override 31 | protected String getSwaggerUrl() { 32 | return getSwaggerUrl(51478, "/application/api/swagger"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/DefaultServerSeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.Constants; 21 | import io.federecio.dropwizard.swagger.TestApplication; 22 | import org.junit.runner.RunWith; 23 | 24 | /** 25 | * @author Federico Recio 26 | */ 27 | @RunWith(DropwizardJunitRunner.class) 28 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-default.yaml") 29 | public class DefaultServerSeleniumTest extends SeleniumTest { 30 | 31 | @Override 32 | protected String getSwaggerUrl() { 33 | return getSwaggerUrl(44444, Constants.SWAGGER_PATH); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/DefaultServerWithApplicationContextPathAndRootPathSetSeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.TestApplication; 21 | import org.junit.runner.RunWith; 22 | 23 | @RunWith(DropwizardJunitRunner.class) 24 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-default-context-and-root-path.yaml") 25 | public class DefaultServerWithApplicationContextPathAndRootPathSetSeleniumTest extends SeleniumTest { 26 | 27 | @Override 28 | protected String getSwaggerUrl() { 29 | return getSwaggerUrl(42424, "/app/api/swagger"); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/SimpleServerWithApplicationContextPathAndRootPathSeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.TestApplication; 21 | import org.junit.runner.RunWith; 22 | 23 | /** 24 | * @author Federico Recio 25 | */ 26 | @RunWith(DropwizardJunitRunner.class) 27 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-simple-with-context-and-root-path.yaml") 28 | public class SimpleServerWithApplicationContextPathAndRootPathSeleniumTest extends SeleniumTest { 29 | 30 | @Override 31 | protected String getSwaggerUrl() { 32 | return getSwaggerUrl(51578, "/api/swagger"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/DefaultServerWithPathSetProgramaticallySeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.TestApplicationWithPathSetProgramatically; 21 | import org.junit.runner.RunWith; 22 | 23 | /** 24 | * @author Federico Recio 25 | */ 26 | @RunWith(DropwizardJunitRunner.class) 27 | @DropwizardTestConfig(applicationClass = TestApplicationWithPathSetProgramatically.class, yamlFile = "/test-default-with-path-set-programatically.yaml") 28 | public class DefaultServerWithPathSetProgramaticallySeleniumTest extends SeleniumTest { 29 | 30 | @Override 31 | protected String getSwaggerUrl() { 32 | return "http://localhost:33333/api/swagger"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/SimpleServerWithApplicationContextPathSeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.Constants; 21 | import io.federecio.dropwizard.swagger.TestApplication; 22 | import org.junit.runner.RunWith; 23 | 24 | /** 25 | * @author Federico Recio 26 | */ 27 | @RunWith(DropwizardJunitRunner.class) 28 | @DropwizardTestConfig(applicationClass = TestApplication.class, yamlFile = "/test-simple-with-context-path.yaml") 29 | public class SimpleServerWithApplicationContextPathSeleniumTest extends SeleniumTest { 30 | 31 | @Override 32 | protected String getSwaggerUrl() { 33 | return getSwaggerUrl(51378, Constants.SWAGGER_PATH); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/resources/swagger-static/css/typography.css: -------------------------------------------------------------------------------- 1 | /* droid-sans-regular - latin */ 2 | @font-face { 3 | font-family: 'Droid Sans'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: url('../fonts/droid-sans-v6-latin-regular.eot'); /* IE9 Compat Modes */ 7 | src: local('Droid Sans'), local('DroidSans'), 8 | url('../fonts/droid-sans-v6-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ 9 | url('../fonts/droid-sans-v6-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */ 10 | url('../fonts/droid-sans-v6-latin-regular.woff') format('woff'), /* Modern Browsers */ 11 | url('../fonts/droid-sans-v6-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */ 12 | url('../fonts/droid-sans-v6-latin-regular.svg#DroidSans') format('svg'); /* Legacy iOS */ 13 | } 14 | /* droid-sans-700 - latin */ 15 | @font-face { 16 | font-family: 'Droid Sans'; 17 | font-style: normal; 18 | font-weight: 700; 19 | src: url('../fonts/droid-sans-v6-latin-700.eot'); /* IE9 Compat Modes */ 20 | src: local('Droid Sans Bold'), local('DroidSans-Bold'), 21 | url('../fonts/droid-sans-v6-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ 22 | url('../fonts/droid-sans-v6-latin-700.woff2') format('woff2'), /* Super Modern Browsers */ 23 | url('../fonts/droid-sans-v6-latin-700.woff') format('woff'), /* Modern Browsers */ 24 | url('../fonts/droid-sans-v6-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */ 25 | url('../fonts/droid-sans-v6-latin-700.svg#DroidSans') format('svg'); /* Legacy iOS */ 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/TestApplication.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.dropwizard.Application; 19 | import io.dropwizard.setup.Bootstrap; 20 | import io.dropwizard.setup.Environment; 21 | 22 | /** 23 | * @author Federico Recio 24 | */ 25 | public class TestApplication extends Application { 26 | 27 | @Override 28 | public void initialize(Bootstrap bootstrap) { 29 | bootstrap.addBundle(new SwaggerBundle() { 30 | @Override 31 | protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(TestConfiguration configuration) { 32 | return configuration.swaggerBundleConfiguration; 33 | } 34 | }); 35 | } 36 | 37 | @Override 38 | public void run(TestConfiguration configuration, Environment environment) throws Exception { 39 | environment.jersey().register(new TestResource()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/resources/swagger-static/css/reset.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ 2 | html, 3 | body, 4 | div, 5 | span, 6 | applet, 7 | object, 8 | iframe, 9 | h1, 10 | h2, 11 | h3, 12 | h4, 13 | h5, 14 | h6, 15 | p, 16 | blockquote, 17 | pre, 18 | a, 19 | abbr, 20 | acronym, 21 | address, 22 | big, 23 | cite, 24 | code, 25 | del, 26 | dfn, 27 | em, 28 | img, 29 | ins, 30 | kbd, 31 | q, 32 | s, 33 | samp, 34 | small, 35 | strike, 36 | strong, 37 | sub, 38 | sup, 39 | tt, 40 | var, 41 | b, 42 | u, 43 | i, 44 | center, 45 | dl, 46 | dt, 47 | dd, 48 | ol, 49 | ul, 50 | li, 51 | fieldset, 52 | form, 53 | label, 54 | legend, 55 | table, 56 | caption, 57 | tbody, 58 | tfoot, 59 | thead, 60 | tr, 61 | th, 62 | td, 63 | article, 64 | aside, 65 | canvas, 66 | details, 67 | embed, 68 | figure, 69 | figcaption, 70 | footer, 71 | header, 72 | hgroup, 73 | menu, 74 | nav, 75 | output, 76 | ruby, 77 | section, 78 | summary, 79 | time, 80 | mark, 81 | audio, 82 | video { 83 | margin: 0; 84 | padding: 0; 85 | border: 0; 86 | font-size: 100%; 87 | font: inherit; 88 | vertical-align: baseline; 89 | } 90 | /* HTML5 display-role reset for older browsers */ 91 | article, 92 | aside, 93 | details, 94 | figcaption, 95 | figure, 96 | footer, 97 | header, 98 | hgroup, 99 | menu, 100 | nav, 101 | section { 102 | display: block; 103 | } 104 | body { 105 | line-height: 1; 106 | } 107 | ol, 108 | ul { 109 | list-style: none; 110 | } 111 | blockquote, 112 | q { 113 | quotes: none; 114 | } 115 | blockquote:before, 116 | blockquote:after, 117 | q:before, 118 | q:after { 119 | content: ''; 120 | content: none; 121 | } 122 | table { 123 | border-collapse: collapse; 124 | border-spacing: 0; 125 | } 126 | -------------------------------------------------------------------------------- /src/main/java/io/federecio/dropwizard/swagger/Constants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | /** 19 | * @author Federico Recio 20 | */ 21 | public class Constants { 22 | /** 23 | * The project's directory in which Swagger static assets live 24 | */ 25 | public static final String SWAGGER_RESOURCES_PATH = "/swagger-static"; 26 | /** 27 | * The path with which all HTTP requests for Swagger assets should be prefixed. 28 | */ 29 | public static final String SWAGGER_URI_PATH = SWAGGER_RESOURCES_PATH; 30 | /** 31 | * The name of the {@link io.dropwizard.assets.AssetsBundle} to register. 32 | */ 33 | public static final String SWAGGER_ASSETS_NAME = "swagger-assets"; 34 | /** 35 | * Default host name will be used if the host cannot be determined by other means. 36 | */ 37 | public static final String DEFAULT_SWAGGER_HOST = "localhost"; 38 | /** 39 | * The URL to use to determine this host's name when running in AWS. 40 | */ 41 | public static final String AWS_HOST_NAME_URL = "http://169.254.169.254/latest/meta-data/public-hostname/"; 42 | /** 43 | * The file to check for its existence to determine if the server is running on AWS. 44 | */ 45 | public static final String AWS_FILE_TO_CHECK = "/var/lib/cloud/"; 46 | /** 47 | * The path to which Swagger resources are bound to 48 | */ 49 | public static final String SWAGGER_PATH = "/swagger"; 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/DefaultServerWithAssetsSeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.junitrunner.DropwizardJunitRunner; 19 | import io.federecio.dropwizard.junitrunner.DropwizardTestConfig; 20 | import io.federecio.dropwizard.swagger.Constants; 21 | import io.federecio.dropwizard.swagger.TestApplicationWithAssetsAndPathSetProgramatically; 22 | import io.federecio.dropwizard.swagger.TestApplicationWithPathSetProgramatically; 23 | import org.junit.Test; 24 | import org.junit.runner.RunWith; 25 | import org.openqa.selenium.By; 26 | import org.openqa.selenium.support.ui.ExpectedConditions; 27 | import org.openqa.selenium.support.ui.WebDriverWait; 28 | 29 | import java.util.concurrent.TimeUnit; 30 | 31 | /** 32 | * @author Federico Recio 33 | */ 34 | @RunWith(DropwizardJunitRunner.class) 35 | @DropwizardTestConfig(applicationClass = TestApplicationWithAssetsAndPathSetProgramatically.class, yamlFile = "/test-default-assets.yaml") 36 | public class DefaultServerWithAssetsSeleniumTest extends SeleniumTest { 37 | 38 | public static final String BASE_URL = "http://localhost:33355"; 39 | private static final String BASE_URL_WITH_BASE_PATH = BASE_URL + TestApplicationWithPathSetProgramatically.BASE_PATH; 40 | 41 | @Override 42 | protected String getSwaggerUrl() { 43 | return BASE_URL_WITH_BASE_PATH + Constants.SWAGGER_PATH; 44 | } 45 | 46 | @Test 47 | public void testApplicationAssetsAreAccessible() throws Exception { 48 | driver.get(BASE_URL + "/test.html"); 49 | driver.manage().timeouts().implicitlyWait(WAIT_IN_SECONDS, TimeUnit.SECONDS); 50 | 51 | By xpath = By.xpath("//h1"); 52 | new WebDriverWait(driver, WAIT_IN_SECONDS).until(ExpectedConditions.textToBePresentInElementLocated(xpath, "test asset")); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/TestApplicationWithPathSetProgramatically.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.dropwizard.Application; 19 | import io.dropwizard.server.DefaultServerFactory; 20 | import io.dropwizard.setup.Bootstrap; 21 | import io.dropwizard.setup.Environment; 22 | 23 | /** 24 | * @author Federico Recio 25 | */ 26 | public class TestApplicationWithPathSetProgramatically extends Application { 27 | 28 | public static final String BASE_PATH = "/api"; 29 | 30 | @Override 31 | public void initialize(Bootstrap bootstrap) { 32 | bootstrap.addBundle(new SwaggerBundle() { 33 | @Override 34 | protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(TestConfiguration configuration) { 35 | SwaggerBundleConfiguration swaggerBundleConfiguration = new SwaggerBundleConfiguration(); 36 | swaggerBundleConfiguration.setResourcePackage("io.federecio.dropwizard.swagger"); 37 | 38 | // since this Application sets the root path in the run() method, we need to 39 | // tell the bundle what that path is because by the time the bundle initializes 40 | // it will not have the necessary info to derive the path that is later going to 41 | // be set below in the run() method. 42 | swaggerBundleConfiguration.setUriPrefix(BASE_PATH); 43 | return swaggerBundleConfiguration; 44 | } 45 | }); 46 | } 47 | 48 | @Override 49 | public void run(TestConfiguration configuration, final Environment environment) throws Exception { 50 | ((DefaultServerFactory) configuration.getServerFactory()).setJerseyRootPath(BASE_PATH + "/*"); 51 | environment.jersey().register(new TestResource()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/io/federecio/dropwizard/swagger/SwaggerView.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import com.google.common.base.Charsets; 19 | import io.dropwizard.views.View; 20 | 21 | /** 22 | * Serves the content of Swagger's index page which has been "templatized" to support replacing 23 | * the directory in which Swagger's static content is located (i.e. JS files) and the path with 24 | * which requests to resources need to be prefixed 25 | * 26 | * @author Federico Recio 27 | */ 28 | public class SwaggerView extends View { 29 | 30 | private final String swaggerAssetsPath; 31 | private final String contextPath; 32 | private final SwaggerUIConfiguration config; 33 | 34 | protected SwaggerView(String urlPattern, SwaggerUIConfiguration config) { 35 | super("index.ftl", Charsets.UTF_8); 36 | this.config = config; 37 | 38 | if (urlPattern.equals("/")) { 39 | swaggerAssetsPath = Constants.SWAGGER_URI_PATH; 40 | } else { 41 | swaggerAssetsPath = urlPattern + Constants.SWAGGER_URI_PATH; 42 | } 43 | 44 | if (urlPattern.equals("/")) { 45 | contextPath = ""; 46 | } else { 47 | contextPath = urlPattern; 48 | } 49 | } 50 | 51 | /** 52 | * Returns the path with which all requests for Swagger's static content need to be prefixed 53 | */ 54 | @SuppressWarnings("unused") 55 | public String getSwaggerAssetsPath() { 56 | return swaggerAssetsPath; 57 | } 58 | 59 | /** 60 | * Returns the path with with which all requests made by Swagger's UI to Resources need to be prefixed 61 | */ 62 | @SuppressWarnings("unused") 63 | public String getContextPath() { 64 | return contextPath; 65 | } 66 | 67 | @SuppressWarnings("unused") 68 | public String getAuthName() { 69 | return config.getAuthName(); 70 | } 71 | 72 | @SuppressWarnings("unused") 73 | public String getAuthKey() { 74 | return config.getAuthKey(); 75 | } 76 | 77 | @SuppressWarnings("unused") 78 | public String getAuthKeyLocation() { 79 | return config.getAuthKeyLocation(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/selenium/SeleniumTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger.selenium; 17 | 18 | import io.federecio.dropwizard.swagger.Constants; 19 | import org.junit.After; 20 | import org.junit.Before; 21 | import org.junit.Test; 22 | import org.openqa.selenium.By; 23 | import org.openqa.selenium.firefox.FirefoxDriver; 24 | import org.openqa.selenium.support.ui.ExpectedConditions; 25 | import org.openqa.selenium.support.ui.WebDriverWait; 26 | 27 | import java.net.InetAddress; 28 | import java.net.UnknownHostException; 29 | import java.util.concurrent.TimeUnit; 30 | 31 | public abstract class SeleniumTest { 32 | 33 | static final String host; 34 | 35 | static { 36 | String tmpHost; 37 | 38 | try { 39 | tmpHost = InetAddress.getLocalHost().getHostName(); 40 | } catch (UnknownHostException ignored) { 41 | tmpHost = Constants.DEFAULT_SWAGGER_HOST; 42 | } 43 | 44 | host = tmpHost; 45 | } 46 | 47 | static final int WAIT_IN_SECONDS = 5; 48 | FirefoxDriver driver; 49 | 50 | protected String getSwaggerUrl(int port, String path) { 51 | return String.format("http://%s:%d%s", SeleniumTest.host, port, path); 52 | } 53 | 54 | protected abstract String getSwaggerUrl(); 55 | 56 | @Before 57 | public void setUpTests() { 58 | driver = new FirefoxDriver(); 59 | } 60 | 61 | @After 62 | public void terminate() { 63 | if (driver != null) { 64 | driver.kill(); 65 | } 66 | } 67 | 68 | @Test 69 | public void testResourceIsAccessibleThroughUI() throws Exception { 70 | driver.get(getSwaggerUrl() + "#!/test/dummyEndpoint"); 71 | driver.manage().timeouts().implicitlyWait(WAIT_IN_SECONDS, TimeUnit.SECONDS); 72 | 73 | clickOnTryOut(); 74 | assertResponseCodeIs200(); 75 | } 76 | 77 | private void assertResponseCodeIs200() { 78 | By xpath = By.xpath("//div[@class='block response_code']/pre"); 79 | new WebDriverWait(driver, WAIT_IN_SECONDS).until(ExpectedConditions.textToBePresentInElementLocated(xpath, "200")); 80 | } 81 | 82 | private void clickOnTryOut() { 83 | By xpath = By.xpath("//input[@value='Try it out!']"); 84 | new WebDriverWait(driver, WAIT_IN_SECONDS).until(ExpectedConditions.presenceOfElementLocated(xpath)); 85 | driver.findElement(xpath).click(); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/test/java/io/federecio/dropwizard/swagger/DropwizardTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import com.google.common.base.Joiner; 19 | import com.google.common.base.Splitter; 20 | import com.jayway.restassured.RestAssured; 21 | import org.eclipse.jetty.http.HttpStatus; 22 | import org.hamcrest.core.StringContains; 23 | import org.junit.Before; 24 | import org.junit.Test; 25 | 26 | import java.util.ArrayList; 27 | import java.util.List; 28 | 29 | /** 30 | * @author Federico Recio 31 | */ 32 | public abstract class DropwizardTest { 33 | 34 | private final int port; 35 | private final Path basePath; 36 | 37 | protected DropwizardTest(int port, String basePath) { 38 | this.port = port; 39 | this.basePath = Path.from(basePath); 40 | } 41 | 42 | @Before 43 | public void setPort() { 44 | RestAssured.port = port; 45 | } 46 | 47 | @Test 48 | public void resourceIsAvailable() throws Exception { 49 | RestAssured.expect().statusCode(HttpStatus.OK_200).when().get(Path.from(basePath, "test.json")); 50 | } 51 | 52 | @Test 53 | public void swaggerIsAvailable() throws Exception { 54 | RestAssured.expect().statusCode(HttpStatus.OK_200).body(StringContains.containsString(TestResource.OPERATION_DESCRIPTION)).when().get(Path.from(basePath, "swagger.json")); 55 | RestAssured.expect().statusCode(HttpStatus.OK_200).when().get(Path.from(basePath, "swagger")); 56 | RestAssured.expect().statusCode(HttpStatus.OK_200).when().get(Path.from(basePath, "swagger") + "/"); 57 | } 58 | 59 | static class Path { 60 | private final List pathComponents = new ArrayList<>(); 61 | 62 | public static Path from(String basePath) { 63 | Path path = new Path(); 64 | path.pathComponents.addAll(Splitter.on("/").omitEmptyStrings().splitToList(basePath)); 65 | return path; 66 | } 67 | 68 | public static String from(Path basePath, String additionalPath) { 69 | List pathComponents = new ArrayList<>(); 70 | pathComponents.addAll(basePath.pathComponents); 71 | pathComponents.add(additionalPath); 72 | return asString(pathComponents); 73 | } 74 | 75 | public static String asString(List pathComponents) { 76 | return pathComponents.isEmpty() ? "/" : Joiner.on("/").join(pathComponents); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dropwizard-swagger 2 | ================== 3 | 4 | a Dropwizard bundle that serves Swagger UI static content and loads Swagger endpoints. Swagger UI static content is taken from https://github.com/swagger-api/swagger-ui 5 | 6 | Current version has been tested with Dropwizard 0.8.0 and Swagger 1.5.4 which supports Swagger 2 spec! 7 | 8 | Note: if you come from previous versions there have been some changes in the way the bundle is configured, see details below. 9 | 10 | License 11 | ------- 12 | 13 | http://www.apache.org/licenses/LICENSE-2.0 14 | 15 | Version matrix 16 | -------------- 17 | 18 | dropwizard-swagger|Dropwizard|Swagger API|Swagger UI 19 | ------------------|----------|-----------|---------- 20 | < 0.5 | 0.7.x | 1.3.2 | ? 21 | 0.5.x | 0.7.x | 1.3.12 | v2.1.4-M1 22 | 0.6.x | 0.8.0 | 1.3.12 | v2.1.4-M1 23 | 0.7.x | 0.8.0 | 1.5.1-M2| v2.1.4-M1 24 | 0.8.x | 0.8.4 | 1.5.4 | v2.1.4-M1 25 | 26 | How to use it 27 | ------------- 28 | 29 | * Add the Maven dependency (available in Maven Central) 30 | 31 | 32 | io.federecio 33 | dropwizard-swagger 34 | 0.7.0 35 | 36 | 37 | 38 | * Add the following to your Configuration class: 39 | 40 | public class YourConfiguration extends Configuration { 41 | ... 42 | @JsonProperty("swagger") 43 | public SwaggerBundleConfiguration swaggerBundleConfiguration; 44 | 45 | * Add the following your configuration yaml (this is the minimal configuration you need): 46 | 47 | prop1: value1 48 | prop2: value2 49 | ... 50 | # the only required property is resourcePackage, for more config options see below 51 | swagger: 52 | resourcePackage: 53 | 54 | 55 | 56 | * In your Application class: 57 | 58 | @Override 59 | public void initialize(Bootstrap bootstrap) { 60 | ... 61 | bootstrap.addBundle(new SwaggerBundle() { 62 | @Override 63 | protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(YourConfiguration configuration) { 64 | return configuration.swaggerBundleConfiguration; 65 | } 66 | }); 67 | ... 68 | } 69 | 70 | 71 | * As usual, add Swagger annotations to your resource classes and methods 72 | 73 | 74 | * Open a browser and hit `http://localhost:/swagger` 75 | 76 | Sample Application 77 | ------------------ 78 | 79 | Take a look at this sample application that shows how to integrate DropWizard and Swagger: [dropwizard-swagger-sample-app](https://github.com/federecio/dropwizard-swagger-sample-app) 80 | 81 | Additional Swagger configuration 82 | -------------------------------- 83 | 84 | To see all the properties that can be used to customize Swagger see [SwaggerBundleConfiguration.java](src/main/java/io/federecio/dropwizard/swagger/SwaggerBundleConfiguration.java) 85 | 86 | A note on Swagger 2 87 | ------------------- 88 | 89 | Host and port do not seem to be needed for Swagger 2 to work properly as it uses relative URLs. At the moment I haven't run through all the scenarios so some adjustments might be needed, please open a bug if you encounter any problems. 90 | 91 | 92 | Contributors 93 | ------------ 94 | 95 | * Federico Recio [@federecio](http://twitter.com/federecio) 96 | * Jochen Szostek [prefabsoft] (http://prefabsoft.com) 97 | * Damien Raude-Morvan [drazzib] (https://github.com/drazzib) 98 | * Marcel Stör [marcelstoer] (https://github.com/marcelstoer) 99 | * Flemming Frandsen https://github.com/dren-dk 100 | * Tristan Burch [tburch] (https://github.com/tburch) 101 | * Matt Carrier [mattcarrier] (https://github.com/mattcarrier) 102 | -------------------------------------------------------------------------------- /src/main/resources/swagger-static/lib/jquery.ba-bbq.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010 3 | * http://benalman.com/projects/jquery-bbq-plugin/ 4 | * 5 | * Copyright (c) 2010 "Cowboy" Ben Alman 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://benalman.com/about/license/ 8 | */ 9 | (function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this); -------------------------------------------------------------------------------- /src/main/resources/swagger-static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Swagger UI 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 81 | 82 | 83 | 84 | 94 | 95 |
 
96 |
97 | 98 | 99 | -------------------------------------------------------------------------------- /src/main/resources/io/federecio/dropwizard/swagger/index.ftl: -------------------------------------------------------------------------------- 1 | <#-- @ftlvariable name="" type="com.federecio.dropwizard.swagger.SwaggerView" --> 2 | 3 | 4 | 5 | Swagger UI 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 76 | 77 | 78 | 79 | 89 | 90 |
 
91 |
92 | 93 | 94 | -------------------------------------------------------------------------------- /src/main/java/io/federecio/dropwizard/swagger/ConfigurationHelper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import io.dropwizard.Configuration; 19 | import io.dropwizard.server.DefaultServerFactory; 20 | import io.dropwizard.server.ServerFactory; 21 | import io.dropwizard.server.SimpleServerFactory; 22 | 23 | /** 24 | * Wrapper around Dropwizard's configuration and the bundle's config that simplifies getting some 25 | * information from them. 26 | * 27 | * @author Federico Recio 28 | * @author Flemming Frandsen 29 | */ 30 | public class ConfigurationHelper { 31 | 32 | private final Configuration configuration; 33 | private final SwaggerBundleConfiguration swaggerBundleConfiguration; 34 | 35 | public ConfigurationHelper(Configuration configuration, SwaggerBundleConfiguration swaggerBundleConfiguration) { 36 | this.configuration = configuration; 37 | this.swaggerBundleConfiguration = swaggerBundleConfiguration; 38 | } 39 | 40 | public String getJerseyRootPath() { 41 | // if the user explictly defined a path to prefix requests use it instead of derive it 42 | if (swaggerBundleConfiguration.getUriPrefix() != null) { 43 | return swaggerBundleConfiguration.getUriPrefix(); 44 | } 45 | 46 | String rootPath; 47 | 48 | ServerFactory serverFactory = configuration.getServerFactory(); 49 | 50 | if (serverFactory instanceof SimpleServerFactory) { 51 | rootPath = ((SimpleServerFactory) serverFactory).getJerseyRootPath(); 52 | } else { 53 | rootPath = ((DefaultServerFactory) serverFactory).getJerseyRootPath(); 54 | } 55 | 56 | return stripUrlSlashes(rootPath); 57 | } 58 | 59 | public String getUrlPattern() { 60 | // if the user explictly defined a path to prefix requests use it instead of derive it 61 | if (swaggerBundleConfiguration.getUriPrefix() != null) { 62 | return swaggerBundleConfiguration.getUriPrefix(); 63 | } 64 | 65 | final String applicationContextPath = getApplicationContextPath(); 66 | final String rootPath = getJerseyRootPath(); 67 | 68 | String urlPattern; 69 | 70 | if (rootPath.equals("/") && applicationContextPath.equals("/")) { 71 | urlPattern = "/"; 72 | } else if (rootPath.equals("/") && !applicationContextPath.equals("/")) { 73 | urlPattern = applicationContextPath; 74 | } else if (!rootPath.equals("/") && applicationContextPath.equals("/")) { 75 | urlPattern = rootPath; 76 | } else { 77 | urlPattern = applicationContextPath + rootPath; 78 | } 79 | 80 | return urlPattern; 81 | } 82 | 83 | public String getSwaggerUriPath() { 84 | final String jerseyRootPath = getJerseyRootPath(); 85 | String uriPathPrefix = jerseyRootPath.equals("/") ? "" : jerseyRootPath; 86 | return uriPathPrefix + Constants.SWAGGER_URI_PATH; 87 | } 88 | 89 | private String getApplicationContextPath() { 90 | String applicationContextPath; 91 | 92 | ServerFactory serverFactory = configuration.getServerFactory(); 93 | 94 | if (serverFactory instanceof SimpleServerFactory) { 95 | applicationContextPath = ((SimpleServerFactory) serverFactory).getApplicationContextPath(); 96 | } else { 97 | applicationContextPath = ((DefaultServerFactory) serverFactory).getApplicationContextPath(); 98 | } 99 | 100 | return stripUrlSlashes(applicationContextPath); 101 | } 102 | 103 | private String stripUrlSlashes(String urlToStrip) { 104 | if (urlToStrip.endsWith("/*")) { 105 | urlToStrip = urlToStrip.substring(0, urlToStrip.length() - 1); 106 | } 107 | 108 | if (urlToStrip.length() > 1 && urlToStrip.endsWith("/")) { 109 | urlToStrip = urlToStrip.substring(0, urlToStrip.length() - 1); 110 | } 111 | 112 | return urlToStrip; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/io/federecio/dropwizard/swagger/SwaggerBundleConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | 21 | /** 22 | * For the meaning of all these properties please refer to Swagger documentation or {@link io.swagger.jaxrs.config.BeanConfig} 23 | * 24 | * @author Tristan Burch 25 | * @author Federico Recio 26 | */ 27 | @JsonIgnoreProperties(ignoreUnknown = true) 28 | public class SwaggerBundleConfiguration { 29 | 30 | /** 31 | * This is the only property that is required for Swagger to work correctly. 32 | *

33 | * It is a comma separated list of the all the packages that contain the {@link io.swagger.annotations.Api} 34 | * annoted resources 35 | */ 36 | @JsonProperty 37 | private String resourcePackage; 38 | 39 | @JsonProperty 40 | private String title; 41 | 42 | @JsonProperty 43 | private String version; 44 | 45 | @JsonProperty 46 | private String description; 47 | 48 | @JsonProperty 49 | private String termsOfServiceUrl; 50 | 51 | @JsonProperty 52 | private String contact; 53 | 54 | @JsonProperty 55 | private String license; 56 | 57 | @JsonProperty 58 | private String licenseUrl; 59 | 60 | /** 61 | * For most of the scenarios this property is not needed. 62 | *

63 | * This is not a property for Swagger but for bundle to set up Swagger UI correctly. 64 | * It only needs to be used of the root path or the context path is set programatically 65 | * and therefore cannot be derived correctly. The problem arises in that if you set the 66 | * root path or context path in the run() method in your Application subclass the bundle 67 | * has already been initialized by that time and so does not know you set the path programatically. 68 | */ 69 | @JsonProperty 70 | private String uriPrefix; 71 | 72 | @JsonProperty("ui") 73 | private SwaggerUIConfiguration uiConfiguration = new SwaggerUIConfiguration(); 74 | 75 | public String getResourcePackage() { 76 | return resourcePackage; 77 | } 78 | 79 | public void setResourcePackage(String resourcePackage) { 80 | this.resourcePackage = resourcePackage; 81 | } 82 | 83 | public String getTitle() { 84 | return title; 85 | } 86 | 87 | public void setTitle(String title) { 88 | this.title = title; 89 | } 90 | 91 | public String getVersion() { 92 | return version; 93 | } 94 | 95 | public void setVersion(String version) { 96 | this.version = version; 97 | } 98 | 99 | public String getDescription() { 100 | return description; 101 | } 102 | 103 | public void setDescription(String description) { 104 | this.description = description; 105 | } 106 | 107 | public String getTermsOfServiceUrl() { 108 | return termsOfServiceUrl; 109 | } 110 | 111 | public void setTermsOfServiceUrl(String termsOfServiceUrl) { 112 | this.termsOfServiceUrl = termsOfServiceUrl; 113 | } 114 | 115 | public String getContact() { 116 | return contact; 117 | } 118 | 119 | public void setContact(String contact) { 120 | this.contact = contact; 121 | } 122 | 123 | public String getLicense() { 124 | return license; 125 | } 126 | 127 | public void setLicense(String license) { 128 | this.license = license; 129 | } 130 | 131 | public String getLicenseUrl() { 132 | return licenseUrl; 133 | } 134 | 135 | public void setLicenseUrl(String licenseUrl) { 136 | this.licenseUrl = licenseUrl; 137 | } 138 | 139 | public String getUriPrefix() { 140 | return uriPrefix; 141 | } 142 | 143 | public void setUriPrefix(String uriPrefix) { 144 | this.uriPrefix = uriPrefix; 145 | } 146 | 147 | @JsonProperty("ui") 148 | public SwaggerUIConfiguration getUiConfiguration() { 149 | return uiConfiguration; 150 | } 151 | 152 | @JsonProperty("ui") 153 | public void setUiConfiguration(SwaggerUIConfiguration ui) { 154 | this.uiConfiguration = ui; 155 | } 156 | 157 | @Override 158 | public String toString() { 159 | return "SwaggerBundleConfiguration{" + 160 | "resourcePackage='" + resourcePackage + '\'' + 161 | ", title='" + title + '\'' + 162 | ", version='" + version + '\'' + 163 | ", description='" + description + '\'' + 164 | ", termsOfServiceUrl='" + termsOfServiceUrl + '\'' + 165 | ", contact='" + contact + '\'' + 166 | ", license='" + license + '\'' + 167 | ", licenseUrl='" + licenseUrl + '\'' + 168 | '}'; 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /src/main/java/io/federecio/dropwizard/swagger/SwaggerBundle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2014 Federico Recio 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.federecio.dropwizard.swagger; 17 | 18 | import com.fasterxml.jackson.annotation.JsonInclude; 19 | import io.dropwizard.Configuration; 20 | import io.dropwizard.ConfiguredBundle; 21 | import io.dropwizard.assets.AssetsBundle; 22 | import io.dropwizard.setup.Bootstrap; 23 | import io.dropwizard.setup.Environment; 24 | import io.dropwizard.views.ViewBundle; 25 | import io.swagger.jaxrs.config.BeanConfig; 26 | import io.swagger.jaxrs.listing.ApiListingResource; 27 | import io.swagger.models.Swagger; 28 | import org.eclipse.jetty.servlets.CrossOriginFilter; 29 | 30 | import java.util.EnumSet; 31 | 32 | import javax.servlet.DispatcherType; 33 | import javax.servlet.FilterRegistration; 34 | 35 | /** 36 | * A {@link io.dropwizard.ConfiguredBundle} that provides hassle-free configuration of Swagger and Swagger UI 37 | * on top of Dropwizard. 38 | * 39 | * @author Federico Recio 40 | * @author Flemming Frandsen 41 | * @author Tristan Burch 42 | */ 43 | public abstract class SwaggerBundle implements ConfiguredBundle { 44 | 45 | @Override 46 | public void initialize(Bootstrap bootstrap) { 47 | bootstrap.addBundle(new ViewBundle<>()); 48 | } 49 | 50 | @Override 51 | public void run(T configuration, Environment environment) throws Exception { 52 | SwaggerBundleConfiguration swaggerBundleConfiguration = getSwaggerBundleConfiguration(configuration); 53 | if (swaggerBundleConfiguration == null) { 54 | throw new IllegalStateException("You need to provide an instance of SwaggerBundleConfiguration"); 55 | } 56 | 57 | ConfigurationHelper configurationHelper = new ConfigurationHelper(configuration, swaggerBundleConfiguration); 58 | new AssetsBundle(Constants.SWAGGER_RESOURCES_PATH, configurationHelper.getSwaggerUriPath(), null, Constants.SWAGGER_ASSETS_NAME).run(environment); 59 | 60 | environment.jersey().register( 61 | new SwaggerResource( 62 | configurationHelper.getUrlPattern(), 63 | swaggerBundleConfiguration.getUiConfiguration())); 64 | environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); 65 | 66 | BeanConfig beanConfig = setUpSwagger(swaggerBundleConfiguration, 67 | configurationHelper.getUrlPattern()); 68 | 69 | configureCors(environment, "/swagger.json", "/swagger.yaml"); 70 | 71 | environment.getApplicationContext().setAttribute("swagger", beanConfig.getSwagger()); 72 | environment.jersey().register(new ApiListingResource()); 73 | } 74 | 75 | @SuppressWarnings("unused") 76 | protected abstract SwaggerBundleConfiguration getSwaggerBundleConfiguration(T configuration); 77 | 78 | @SuppressWarnings("unused") 79 | protected void setUpSwagger(Swagger swagger) {} 80 | 81 | protected void configureCors(Environment environment, String... urlPatterns) { 82 | FilterRegistration.Dynamic 83 | filter = environment.servlets().addFilter("CORS", CrossOriginFilter.class); 84 | filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, urlPatterns); 85 | filter.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM, "GET,PUT,POST,DELETE,OPTIONS"); 86 | filter.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "*"); 87 | filter.setInitParameter(CrossOriginFilter.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "*"); 88 | filter.setInitParameter("allowedHeaders", "Content-Type,Authorization,X-Requested-With,Content-Length,Accept,Origin"); 89 | filter.setInitParameter("allowCredentials", "true"); 90 | } 91 | 92 | private BeanConfig setUpSwagger(SwaggerBundleConfiguration swaggerBundleConfiguration, 93 | String urlPattern) { 94 | BeanConfig config = new BeanConfig(); 95 | 96 | if (swaggerBundleConfiguration.getTitle() != null) { 97 | config.setTitle(swaggerBundleConfiguration.getTitle()); 98 | } 99 | 100 | if (swaggerBundleConfiguration.getVersion() != null) { 101 | config.setVersion(swaggerBundleConfiguration.getVersion()); 102 | } 103 | 104 | if (swaggerBundleConfiguration.getDescription() != null) { 105 | config.setDescription(swaggerBundleConfiguration.getDescription()); 106 | } 107 | 108 | if (swaggerBundleConfiguration.getContact() != null) { 109 | config.setContact(swaggerBundleConfiguration.getContact()); 110 | } 111 | 112 | if (swaggerBundleConfiguration.getLicense() != null) { 113 | config.setLicense(swaggerBundleConfiguration.getLicense()); 114 | } 115 | 116 | if (swaggerBundleConfiguration.getLicenseUrl() != null) { 117 | config.setLicenseUrl(swaggerBundleConfiguration.getLicenseUrl()); 118 | } 119 | 120 | if (swaggerBundleConfiguration.getTermsOfServiceUrl() != null) { 121 | config.setTermsOfServiceUrl(swaggerBundleConfiguration.getTermsOfServiceUrl()); 122 | } 123 | 124 | config.setBasePath(urlPattern); 125 | 126 | if (swaggerBundleConfiguration.getResourcePackage() != null) { 127 | config.setResourcePackage(swaggerBundleConfiguration.getResourcePackage()); 128 | } else { 129 | throw new IllegalStateException("Resource package needs to be specified for Swagger to correctly detect annotated resources"); 130 | } 131 | 132 | 133 | config.setScan(true); 134 | setUpSwagger(config.getSwagger()); 135 | 136 | return config; 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/main/resources/swagger-static/lib/highlight.7.3.pack.js: -------------------------------------------------------------------------------- 1 | var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(//gm,">")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("")}while(o!=u.node);r.splice(q,1);while(q'+L[0]+""}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return''+r.value+""}function J(){return A.sL!==undefined?z():G()}function I(L,r){var K=L.cN?'':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function C(K,r){w+=K;if(r===undefined){x+=J();return 0}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB?0:r.length}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+=""}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw"Illegal"}w+=r;return r.length||1}var F=e[D];f(F);var A=F;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(E);if(!u){break}q=C(E.substr(p,u.index-p),u[0]);p=u.index+q}C(E.substr(p));return{r:B,keyword_count:v,value:x,language:D}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(E)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"
")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[b],starts:{e:"",rE:true,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",c:[{cN:"title",b:"[^ />]+"},b]}]}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs); -------------------------------------------------------------------------------- /src/main/resources/swagger-static/lib/shred/content.js: -------------------------------------------------------------------------------- 1 | 2 | // The purpose of the `Content` object is to abstract away the data conversions 3 | // to and from raw content entities as strings. For example, you want to be able 4 | // to pass in a Javascript object and have it be automatically converted into a 5 | // JSON string if the `content-type` is set to a JSON-based media type. 6 | // Conversely, you want to be able to transparently get back a Javascript object 7 | // in the response if the `content-type` is a JSON-based media-type. 8 | 9 | // One limitation of the current implementation is that it [assumes the `charset` is UTF-8](https://github.com/spire-io/shred/issues/5). 10 | 11 | // The `Content` constructor takes an options object, which *must* have either a 12 | // `body` or `data` property and *may* have a `type` property indicating the 13 | // media type. If there is no `type` attribute, a default will be inferred. 14 | var Content = function(options) { 15 | this.body = options.body; 16 | this.data = options.data; 17 | this.type = options.type; 18 | }; 19 | 20 | Content.prototype = { 21 | // Treat `toString()` as asking for the `content.body`. That is, the raw content entity. 22 | // 23 | // toString: function() { return this.body; } 24 | // 25 | // Commented out, but I've forgotten why. :/ 26 | }; 27 | 28 | 29 | // `Content` objects have the following attributes: 30 | Object.defineProperties(Content.prototype,{ 31 | 32 | // - **type**. Typically accessed as `content.type`, reflects the `content-type` 33 | // header associated with the request or response. If not passed as an options 34 | // to the constructor or set explicitly, it will infer the type the `data` 35 | // attribute, if possible, and, failing that, will default to `text/plain`. 36 | type: { 37 | get: function() { 38 | if (this._type) { 39 | return this._type; 40 | } else { 41 | if (this._data) { 42 | switch(typeof this._data) { 43 | case "string": return "text/plain"; 44 | case "object": return "application/json"; 45 | } 46 | } 47 | } 48 | return "text/plain"; 49 | }, 50 | set: function(value) { 51 | this._type = value; 52 | return this; 53 | }, 54 | enumerable: true 55 | }, 56 | 57 | // - **data**. Typically accessed as `content.data`, reflects the content entity 58 | // converted into Javascript data. This can be a string, if the `type` is, say, 59 | // `text/plain`, but can also be a Javascript object. The conversion applied is 60 | // based on the `processor` attribute. The `data` attribute can also be set 61 | // directly, in which case the conversion will be done the other way, to infer 62 | // the `body` attribute. 63 | data: { 64 | get: function() { 65 | if (this._body) { 66 | return this.processor.parser(this._body); 67 | } else { 68 | return this._data; 69 | } 70 | }, 71 | set: function(data) { 72 | if (this._body&&data) Errors.setDataWithBody(this); 73 | this._data = data; 74 | return this; 75 | }, 76 | enumerable: true 77 | }, 78 | 79 | // - **body**. Typically accessed as `content.body`, reflects the content entity 80 | // as a UTF-8 string. It is the mirror of the `data` attribute. If you set the 81 | // `data` attribute, the `body` attribute will be inferred and vice-versa. If 82 | // you attempt to set both, an exception is raised. 83 | body: { 84 | get: function() { 85 | if (this._data) { 86 | return this.processor.stringify(this._data); 87 | } else { 88 | return this._body.toString(); 89 | } 90 | }, 91 | set: function(body) { 92 | if (this._data&&body) Errors.setBodyWithData(this); 93 | this._body = body; 94 | return this; 95 | }, 96 | enumerable: true 97 | }, 98 | 99 | // - **processor**. The functions that will be used to convert to/from `data` and 100 | // `body` attributes. You can add processors. The two that are built-in are for 101 | // `text/plain`, which is basically an identity transformation and 102 | // `application/json` and other JSON-based media types (including custom media 103 | // types with `+json`). You can add your own processors. See below. 104 | processor: { 105 | get: function() { 106 | var processor = Content.processors[this.type]; 107 | if (processor) { 108 | return processor; 109 | } else { 110 | // Return the first processor that matches any part of the 111 | // content type. ex: application/vnd.foobar.baz+json will match json. 112 | var main = this.type.split(";")[0]; 113 | var parts = main.split(/\+|\//); 114 | for (var i=0, l=parts.length; i < l; i++) { 115 | processor = Content.processors[parts[i]] 116 | } 117 | return processor || {parser:identity,stringify:toString}; 118 | } 119 | }, 120 | enumerable: true 121 | }, 122 | 123 | // - **length**. Typically accessed as `content.length`, returns the length in 124 | // bytes of the raw content entity. 125 | length: { 126 | get: function() { 127 | if (typeof Buffer !== 'undefined') { 128 | return Buffer.byteLength(this.body); 129 | } 130 | return this.body.length; 131 | } 132 | } 133 | }); 134 | 135 | Content.processors = {}; 136 | 137 | // The `registerProcessor` function allows you to add your own processors to 138 | // convert content entities. Each processor consists of a Javascript object with 139 | // two properties: 140 | // - **parser**. The function used to parse a raw content entity and convert it 141 | // into a Javascript data type. 142 | // - **stringify**. The function used to convert a Javascript data type into a 143 | // raw content entity. 144 | Content.registerProcessor = function(types,processor) { 145 | 146 | // You can pass an array of types that will trigger this processor, or just one. 147 | // We determine the array via duck-typing here. 148 | if (types.forEach) { 149 | types.forEach(function(type) { 150 | Content.processors[type] = processor; 151 | }); 152 | } else { 153 | // If you didn't pass an array, we just use what you pass in. 154 | Content.processors[types] = processor; 155 | } 156 | }; 157 | 158 | // Register the identity processor, which is used for text-based media types. 159 | var identity = function(x) { return x; } 160 | , toString = function(x) { return x.toString(); } 161 | Content.registerProcessor( 162 | ["text/html","text/plain","text"], 163 | { parser: identity, stringify: toString }); 164 | 165 | // Register the JSON processor, which is used for JSON-based media types. 166 | Content.registerProcessor( 167 | ["application/json; charset=utf-8","application/json","json"], 168 | { 169 | parser: function(string) { 170 | return JSON.parse(string); 171 | }, 172 | stringify: function(data) { 173 | return JSON.stringify(data); }}); 174 | 175 | var qs = require('querystring'); 176 | // Register the post processor, which is used for JSON-based media types. 177 | Content.registerProcessor( 178 | ["application/x-www-form-urlencoded"], 179 | { parser : qs.parse, stringify : qs.stringify }); 180 | 181 | // Error functions are defined separately here in an attempt to make the code 182 | // easier to read. 183 | var Errors = { 184 | setDataWithBody: function(object) { 185 | throw new Error("Attempt to set data attribute of a content object " + 186 | "when the body attributes was already set."); 187 | }, 188 | setBodyWithData: function(object) { 189 | throw new Error("Attempt to set body attribute of a content object " + 190 | "when the data attributes was already set."); 191 | } 192 | } 193 | module.exports = Content; -------------------------------------------------------------------------------- /src/main/resources/swagger-static/lib/swagger-oauth.js: -------------------------------------------------------------------------------- 1 | var appName; 2 | var popupMask; 3 | var popupDialog; 4 | var clientId; 5 | var realm; 6 | var oauth2KeyName; 7 | var redirect_uri; 8 | 9 | function handleLogin() { 10 | var scopes = []; 11 | 12 | var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions; 13 | if(auths) { 14 | var key; 15 | var defs = auths; 16 | for(key in defs) { 17 | var auth = defs[key]; 18 | if(auth.type === 'oauth2' && auth.scopes) { 19 | oauth2KeyName = key; 20 | var scope; 21 | if(Array.isArray(auth.scopes)) { 22 | // 1.2 support 23 | var i; 24 | for(i = 0; i < auth.scopes.length; i++) { 25 | scopes.push(auth.scopes[i]); 26 | } 27 | } 28 | else { 29 | // 2.0 support 30 | for(scope in auth.scopes) { 31 | scopes.push({scope: scope, description: auth.scopes[scope]}); 32 | } 33 | } 34 | } 35 | } 36 | } 37 | 38 | if(window.swaggerUi.api 39 | && window.swaggerUi.api.info) { 40 | appName = window.swaggerUi.api.info.title; 41 | } 42 | 43 | popupDialog = $( 44 | [ 45 | '

', 46 | '
Select OAuth2.0 Scopes
', 47 | '
', 48 | '

Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.', 49 | 'Learn how to use', 50 | '

', 51 | '

' + appName + ' API requires the following scopes. Select which ones you want to grant to Swagger UI.

', 52 | '
    ', 53 | '
', 54 | '

', 55 | '
', 56 | '
', 57 | '
'].join('')); 58 | $(document.body).append(popupDialog); 59 | 60 | popup = popupDialog.find('ul.api-popup-scopes').empty(); 61 | for (i = 0; i < scopes.length; i ++) { 62 | scope = scopes[i]; 63 | str = '
  • ' + '
  • '; 68 | popup.append(str); 69 | } 70 | 71 | var $win = $(window), 72 | dw = $win.width(), 73 | dh = $win.height(), 74 | st = $win.scrollTop(), 75 | dlgWd = popupDialog.outerWidth(), 76 | dlgHt = popupDialog.outerHeight(), 77 | top = (dh -dlgHt)/2 + st, 78 | left = (dw - dlgWd)/2; 79 | 80 | popupDialog.css({ 81 | top: (top < 0? 0 : top) + 'px', 82 | left: (left < 0? 0 : left) + 'px' 83 | }); 84 | 85 | popupDialog.find('button.api-popup-cancel').click(function() { 86 | popupMask.hide(); 87 | popupDialog.hide(); 88 | popupDialog.empty(); 89 | popupDialog = []; 90 | }); 91 | 92 | $('button.api-popup-authbtn').unbind(); 93 | popupDialog.find('button.api-popup-authbtn').click(function() { 94 | popupMask.hide(); 95 | popupDialog.hide(); 96 | 97 | var authSchemes = window.swaggerUi.api.authSchemes; 98 | var host = window.location; 99 | var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/")); 100 | var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html'; 101 | var url = null; 102 | 103 | for (var key in authSchemes) { 104 | if (authSchemes.hasOwnProperty(key)) { 105 | var flow = authSchemes[key].flow; 106 | 107 | if(authSchemes[key].type === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) { 108 | var dets = authSchemes[key]; 109 | url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code'); 110 | window.swaggerUi.tokenName = dets.tokenName || 'access_token'; 111 | window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null); 112 | } 113 | else if(authSchemes[key].grantTypes) { 114 | // 1.2 support 115 | var o = authSchemes[key].grantTypes; 116 | for(var t in o) { 117 | if(o.hasOwnProperty(t) && t === 'implicit') { 118 | var dets = o[t]; 119 | var ep = dets.loginEndpoint.url; 120 | url = dets.loginEndpoint.url + '?response_type=token'; 121 | window.swaggerUi.tokenName = dets.tokenName; 122 | } 123 | else if (o.hasOwnProperty(t) && t === 'accessCode') { 124 | var dets = o[t]; 125 | var ep = dets.tokenRequestEndpoint.url; 126 | url = dets.tokenRequestEndpoint.url + '?response_type=code'; 127 | window.swaggerUi.tokenName = dets.tokenName; 128 | } 129 | } 130 | } 131 | } 132 | } 133 | var scopes = [] 134 | var o = $('.api-popup-scopes').find('input:checked'); 135 | 136 | for(k =0; k < o.length; k++) { 137 | var scope = $(o[k]).attr('scope'); 138 | 139 | if (scopes.indexOf(scope) === -1) 140 | scopes.push(scope); 141 | } 142 | 143 | window.enabledScopes=scopes; 144 | 145 | redirect_uri = redirectUrl; 146 | 147 | url += '&redirect_uri=' + encodeURIComponent(redirectUrl); 148 | url += '&realm=' + encodeURIComponent(realm); 149 | url += '&client_id=' + encodeURIComponent(clientId); 150 | url += '&scope=' + encodeURIComponent(scopes); 151 | 152 | window.open(url); 153 | }); 154 | 155 | popupMask.show(); 156 | popupDialog.show(); 157 | return; 158 | } 159 | 160 | 161 | function handleLogout() { 162 | for(key in window.authorizations.authz){ 163 | window.authorizations.remove(key) 164 | } 165 | window.enabledScopes = null; 166 | $('.api-ic.ic-on').addClass('ic-off'); 167 | $('.api-ic.ic-on').removeClass('ic-on'); 168 | 169 | // set the info box 170 | $('.api-ic.ic-warning').addClass('ic-error'); 171 | $('.api-ic.ic-warning').removeClass('ic-warning'); 172 | } 173 | 174 | function initOAuth(opts) { 175 | var o = (opts||{}); 176 | var errors = []; 177 | 178 | appName = (o.appName||errors.push('missing appName')); 179 | popupMask = (o.popupMask||$('#api-common-mask')); 180 | popupDialog = (o.popupDialog||$('.api-popup-dialog')); 181 | clientId = (o.clientId||errors.push('missing client id')); 182 | realm = (o.realm||errors.push('missing realm')); 183 | 184 | if(errors.length > 0){ 185 | log('auth unable initialize oauth: ' + errors); 186 | return; 187 | } 188 | 189 | $('pre code').each(function(i, e) {hljs.highlightBlock(e)}); 190 | $('.api-ic').unbind(); 191 | $('.api-ic').click(function(s) { 192 | if($(s.target).hasClass('ic-off')) 193 | handleLogin(); 194 | else { 195 | handleLogout(); 196 | } 197 | false; 198 | }); 199 | } 200 | 201 | function processOAuthCode(data) { 202 | var params = { 203 | 'client_id': clientId, 204 | 'code': data.code, 205 | 'grant_type': 'authorization_code', 206 | 'redirect_uri': redirect_uri 207 | } 208 | $.ajax( 209 | { 210 | url : window.swaggerUi.tokenUrl, 211 | type: "POST", 212 | data: params, 213 | success:function(data, textStatus, jqXHR) 214 | { 215 | onOAuthComplete(data); 216 | }, 217 | error: function(jqXHR, textStatus, errorThrown) 218 | { 219 | onOAuthComplete(""); 220 | } 221 | }); 222 | } 223 | 224 | function onOAuthComplete(token) { 225 | if(token) { 226 | if(token.error) { 227 | var checkbox = $('input[type=checkbox],.secured') 228 | checkbox.each(function(pos){ 229 | checkbox[pos].checked = false; 230 | }); 231 | alert(token.error); 232 | } 233 | else { 234 | var b = token[window.swaggerUi.tokenName]; 235 | if(b){ 236 | // if all roles are satisfied 237 | var o = null; 238 | $.each($('.auth #api_information_panel'), function(k, v) { 239 | var children = v; 240 | if(children && children.childNodes) { 241 | var requiredScopes = []; 242 | $.each((children.childNodes), function (k1, v1){ 243 | var inner = v1.innerHTML; 244 | if(inner) 245 | requiredScopes.push(inner); 246 | }); 247 | var diff = []; 248 | for(var i=0; i < requiredScopes.length; i++) { 249 | var s = requiredScopes[i]; 250 | if(window.enabledScopes && window.enabledScopes.indexOf(s) == -1) { 251 | diff.push(s); 252 | } 253 | } 254 | if(diff.length > 0){ 255 | o = v.parentNode; 256 | $(o.parentNode).find('.api-ic.ic-on').addClass('ic-off'); 257 | $(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on'); 258 | 259 | // sorry, not all scopes are satisfied 260 | $(o).find('.api-ic').addClass('ic-warning'); 261 | $(o).find('.api-ic').removeClass('ic-error'); 262 | } 263 | else { 264 | o = v.parentNode; 265 | $(o.parentNode).find('.api-ic.ic-off').addClass('ic-on'); 266 | $(o.parentNode).find('.api-ic.ic-off').removeClass('ic-off'); 267 | 268 | // all scopes are satisfied 269 | $(o).find('.api-ic').addClass('ic-info'); 270 | $(o).find('.api-ic').removeClass('ic-warning'); 271 | $(o).find('.api-ic').removeClass('ic-error'); 272 | } 273 | } 274 | }); 275 | window.authorizations.add(oauth2KeyName, new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header')); 276 | } 277 | } 278 | } 279 | } -------------------------------------------------------------------------------- /src/main/resources/swagger-static/lib/underscore-min.js: -------------------------------------------------------------------------------- 1 | // Underscore.js 1.7.0 2 | // http://underscorejs.org 3 | // (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 4 | // Underscore may be freely distributed under the MIT license. 5 | (function(){var n=this,t=n._,r=Array.prototype,e=Object.prototype,u=Function.prototype,i=r.push,a=r.slice,o=r.concat,l=e.toString,c=e.hasOwnProperty,f=Array.isArray,s=Object.keys,p=u.bind,h=function(n){return n instanceof h?n:this instanceof h?void(this._wrapped=n):new h(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=h),exports._=h):n._=h,h.VERSION="1.7.0";var g=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}};h.iteratee=function(n,t,r){return null==n?h.identity:h.isFunction(n)?g(n,t,r):h.isObject(n)?h.matches(n):h.property(n)},h.each=h.forEach=function(n,t,r){if(null==n)return n;t=g(t,r);var e,u=n.length;if(u===+u)for(e=0;u>e;e++)t(n[e],e,n);else{var i=h.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},h.map=h.collect=function(n,t,r){if(null==n)return[];t=h.iteratee(t,r);for(var e,u=n.length!==+n.length&&h.keys(n),i=(u||n).length,a=Array(i),o=0;i>o;o++)e=u?u[o]:o,a[o]=t(n[e],e,n);return a};var v="Reduce of empty array with no initial value";h.reduce=h.foldl=h.inject=function(n,t,r,e){null==n&&(n=[]),t=g(t,e,4);var u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length,o=0;if(arguments.length<3){if(!a)throw new TypeError(v);r=n[i?i[o++]:o++]}for(;a>o;o++)u=i?i[o]:o,r=t(r,n[u],u,n);return r},h.reduceRight=h.foldr=function(n,t,r,e){null==n&&(n=[]),t=g(t,e,4);var u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;if(arguments.length<3){if(!a)throw new TypeError(v);r=n[i?i[--a]:--a]}for(;a--;)u=i?i[a]:a,r=t(r,n[u],u,n);return r},h.find=h.detect=function(n,t,r){var e;return t=h.iteratee(t,r),h.some(n,function(n,r,u){return t(n,r,u)?(e=n,!0):void 0}),e},h.filter=h.select=function(n,t,r){var e=[];return null==n?e:(t=h.iteratee(t,r),h.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e)},h.reject=function(n,t,r){return h.filter(n,h.negate(h.iteratee(t)),r)},h.every=h.all=function(n,t,r){if(null==n)return!0;t=h.iteratee(t,r);var e,u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;for(e=0;a>e;e++)if(u=i?i[e]:e,!t(n[u],u,n))return!1;return!0},h.some=h.any=function(n,t,r){if(null==n)return!1;t=h.iteratee(t,r);var e,u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;for(e=0;a>e;e++)if(u=i?i[e]:e,t(n[u],u,n))return!0;return!1},h.contains=h.include=function(n,t){return null==n?!1:(n.length!==+n.length&&(n=h.values(n)),h.indexOf(n,t)>=0)},h.invoke=function(n,t){var r=a.call(arguments,2),e=h.isFunction(t);return h.map(n,function(n){return(e?t:n[t]).apply(n,r)})},h.pluck=function(n,t){return h.map(n,h.property(t))},h.where=function(n,t){return h.filter(n,h.matches(t))},h.findWhere=function(n,t){return h.find(n,h.matches(t))},h.max=function(n,t,r){var e,u,i=-1/0,a=-1/0;if(null==t&&null!=n){n=n.length===+n.length?n:h.values(n);for(var o=0,l=n.length;l>o;o++)e=n[o],e>i&&(i=e)}else t=h.iteratee(t,r),h.each(n,function(n,r,e){u=t(n,r,e),(u>a||u===-1/0&&i===-1/0)&&(i=n,a=u)});return i},h.min=function(n,t,r){var e,u,i=1/0,a=1/0;if(null==t&&null!=n){n=n.length===+n.length?n:h.values(n);for(var o=0,l=n.length;l>o;o++)e=n[o],i>e&&(i=e)}else t=h.iteratee(t,r),h.each(n,function(n,r,e){u=t(n,r,e),(a>u||1/0===u&&1/0===i)&&(i=n,a=u)});return i},h.shuffle=function(n){for(var t,r=n&&n.length===+n.length?n:h.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=h.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},h.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=h.values(n)),n[h.random(n.length-1)]):h.shuffle(n).slice(0,Math.max(0,t))},h.sortBy=function(n,t,r){return t=h.iteratee(t,r),h.pluck(h.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var m=function(n){return function(t,r,e){var u={};return r=h.iteratee(r,e),h.each(t,function(e,i){var a=r(e,i,t);n(u,e,a)}),u}};h.groupBy=m(function(n,t,r){h.has(n,r)?n[r].push(t):n[r]=[t]}),h.indexBy=m(function(n,t,r){n[r]=t}),h.countBy=m(function(n,t,r){h.has(n,r)?n[r]++:n[r]=1}),h.sortedIndex=function(n,t,r,e){r=h.iteratee(r,e,1);for(var u=r(t),i=0,a=n.length;a>i;){var o=i+a>>>1;r(n[o])t?[]:a.call(n,0,t)},h.initial=function(n,t,r){return a.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},h.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:a.call(n,Math.max(n.length-t,0))},h.rest=h.tail=h.drop=function(n,t,r){return a.call(n,null==t||r?1:t)},h.compact=function(n){return h.filter(n,h.identity)};var y=function(n,t,r,e){if(t&&h.every(n,h.isArray))return o.apply(e,n);for(var u=0,a=n.length;a>u;u++){var l=n[u];h.isArray(l)||h.isArguments(l)?t?i.apply(e,l):y(l,t,r,e):r||e.push(l)}return e};h.flatten=function(n,t){return y(n,t,!1,[])},h.without=function(n){return h.difference(n,a.call(arguments,1))},h.uniq=h.unique=function(n,t,r,e){if(null==n)return[];h.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=h.iteratee(r,e));for(var u=[],i=[],a=0,o=n.length;o>a;a++){var l=n[a];if(t)a&&i===l||u.push(l),i=l;else if(r){var c=r(l,a,n);h.indexOf(i,c)<0&&(i.push(c),u.push(l))}else h.indexOf(u,l)<0&&u.push(l)}return u},h.union=function(){return h.uniq(y(arguments,!0,!0,[]))},h.intersection=function(n){if(null==n)return[];for(var t=[],r=arguments.length,e=0,u=n.length;u>e;e++){var i=n[e];if(!h.contains(t,i)){for(var a=1;r>a&&h.contains(arguments[a],i);a++);a===r&&t.push(i)}}return t},h.difference=function(n){var t=y(a.call(arguments,1),!0,!0,[]);return h.filter(n,function(n){return!h.contains(t,n)})},h.zip=function(n){if(null==n)return[];for(var t=h.max(arguments,"length").length,r=Array(t),e=0;t>e;e++)r[e]=h.pluck(arguments,e);return r},h.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},h.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=h.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}for(;u>e;e++)if(n[e]===t)return e;return-1},h.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=n.length;for("number"==typeof r&&(e=0>r?e+r+1:Math.min(e,r+1));--e>=0;)if(n[e]===t)return e;return-1},h.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=r||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),i=0;e>i;i++,n+=r)u[i]=n;return u};var d=function(){};h.bind=function(n,t){var r,e;if(p&&n.bind===p)return p.apply(n,a.call(arguments,1));if(!h.isFunction(n))throw new TypeError("Bind must be called on a function");return r=a.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(a.call(arguments)));d.prototype=n.prototype;var u=new d;d.prototype=null;var i=n.apply(u,r.concat(a.call(arguments)));return h.isObject(i)?i:u}},h.partial=function(n){var t=a.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===h&&(e[u]=arguments[r++]);for(;r=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=h.bind(n[r],n);return n},h.memoize=function(n,t){var r=function(e){var u=r.cache,i=t?t.apply(this,arguments):e;return h.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},h.delay=function(n,t){var r=a.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},h.defer=function(n){return h.delay.apply(h,[n,1].concat(a.call(arguments,1)))},h.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var l=function(){o=r.leading===!1?0:h.now(),a=null,i=n.apply(e,u),a||(e=u=null)};return function(){var c=h.now();o||r.leading!==!1||(o=c);var f=t-(c-o);return e=this,u=arguments,0>=f||f>t?(clearTimeout(a),a=null,o=c,i=n.apply(e,u),a||(e=u=null)):a||r.trailing===!1||(a=setTimeout(l,f)),i}},h.debounce=function(n,t,r){var e,u,i,a,o,l=function(){var c=h.now()-a;t>c&&c>0?e=setTimeout(l,t-c):(e=null,r||(o=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,a=h.now();var c=r&&!e;return e||(e=setTimeout(l,t)),c&&(o=n.apply(i,u),i=u=null),o}},h.wrap=function(n,t){return h.partial(t,n)},h.negate=function(n){return function(){return!n.apply(this,arguments)}},h.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},h.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},h.before=function(n,t){var r;return function(){return--n>0?r=t.apply(this,arguments):t=null,r}},h.once=h.partial(h.before,2),h.keys=function(n){if(!h.isObject(n))return[];if(s)return s(n);var t=[];for(var r in n)h.has(n,r)&&t.push(r);return t},h.values=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},h.pairs=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},h.invert=function(n){for(var t={},r=h.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},h.functions=h.methods=function(n){var t=[];for(var r in n)h.isFunction(n[r])&&t.push(r);return t.sort()},h.extend=function(n){if(!h.isObject(n))return n;for(var t,r,e=1,u=arguments.length;u>e;e++){t=arguments[e];for(r in t)c.call(t,r)&&(n[r]=t[r])}return n},h.pick=function(n,t,r){var e,u={};if(null==n)return u;if(h.isFunction(t)){t=g(t,r);for(e in n){var i=n[e];t(i,e,n)&&(u[e]=i)}}else{var l=o.apply([],a.call(arguments,1));n=new Object(n);for(var c=0,f=l.length;f>c;c++)e=l[c],e in n&&(u[e]=n[e])}return u},h.omit=function(n,t,r){if(h.isFunction(t))t=h.negate(t);else{var e=h.map(o.apply([],a.call(arguments,1)),String);t=function(n,t){return!h.contains(e,t)}}return h.pick(n,t,r)},h.defaults=function(n){if(!h.isObject(n))return n;for(var t=1,r=arguments.length;r>t;t++){var e=arguments[t];for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n},h.clone=function(n){return h.isObject(n)?h.isArray(n)?n.slice():h.extend({},n):n},h.tap=function(n,t){return t(n),n};var b=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof h&&(n=n._wrapped),t instanceof h&&(t=t._wrapped);var u=l.call(n);if(u!==l.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]===n)return e[i]===t;var a=n.constructor,o=t.constructor;if(a!==o&&"constructor"in n&&"constructor"in t&&!(h.isFunction(a)&&a instanceof a&&h.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c,f;if("[object Array]"===u){if(c=n.length,f=c===t.length)for(;c--&&(f=b(n[c],t[c],r,e)););}else{var s,p=h.keys(n);if(c=p.length,f=h.keys(t).length===c)for(;c--&&(s=p[c],f=h.has(t,s)&&b(n[s],t[s],r,e)););}return r.pop(),e.pop(),f};h.isEqual=function(n,t){return b(n,t,[],[])},h.isEmpty=function(n){if(null==n)return!0;if(h.isArray(n)||h.isString(n)||h.isArguments(n))return 0===n.length;for(var t in n)if(h.has(n,t))return!1;return!0},h.isElement=function(n){return!(!n||1!==n.nodeType)},h.isArray=f||function(n){return"[object Array]"===l.call(n)},h.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},h.each(["Arguments","Function","String","Number","Date","RegExp"],function(n){h["is"+n]=function(t){return l.call(t)==="[object "+n+"]"}}),h.isArguments(arguments)||(h.isArguments=function(n){return h.has(n,"callee")}),"function"!=typeof/./&&(h.isFunction=function(n){return"function"==typeof n||!1}),h.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},h.isNaN=function(n){return h.isNumber(n)&&n!==+n},h.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===l.call(n)},h.isNull=function(n){return null===n},h.isUndefined=function(n){return n===void 0},h.has=function(n,t){return null!=n&&c.call(n,t)},h.noConflict=function(){return n._=t,this},h.identity=function(n){return n},h.constant=function(n){return function(){return n}},h.noop=function(){},h.property=function(n){return function(t){return t[n]}},h.matches=function(n){var t=h.pairs(n),r=t.length;return function(n){if(null==n)return!r;n=new Object(n);for(var e=0;r>e;e++){var u=t[e],i=u[0];if(u[1]!==n[i]||!(i in n))return!1}return!0}},h.times=function(n,t,r){var e=Array(Math.max(0,n));t=g(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},h.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},h.now=Date.now||function(){return(new Date).getTime()};var _={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},w=h.invert(_),j=function(n){var t=function(t){return n[t]},r="(?:"+h.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};h.escape=j(_),h.unescape=j(w),h.result=function(n,t){if(null==n)return void 0;var r=n[t];return h.isFunction(r)?n[t]():r};var x=0;h.uniqueId=function(n){var t=++x+"";return n?n+t:t},h.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var A=/(.)^/,k={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},O=/\\|'|\r|\n|\u2028|\u2029/g,F=function(n){return"\\"+k[n]};h.template=function(n,t,r){!t&&r&&(t=r),t=h.defaults({},t,h.templateSettings);var e=RegExp([(t.escape||A).source,(t.interpolate||A).source,(t.evaluate||A).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,a,o){return i+=n.slice(u,o).replace(O,F),u=o+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":a&&(i+="';\n"+a+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var a=new Function(t.variable||"obj","_",i)}catch(o){throw o.source=i,o}var l=function(n){return a.call(this,n,h)},c=t.variable||"obj";return l.source="function("+c+"){\n"+i+"}",l},h.chain=function(n){var t=h(n);return t._chain=!0,t};var E=function(n){return this._chain?h(n).chain():n};h.mixin=function(n){h.each(h.functions(n),function(t){var r=h[t]=n[t];h.prototype[t]=function(){var n=[this._wrapped];return i.apply(n,arguments),E.call(this,r.apply(h,n))}})},h.mixin(h),h.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=r[n];h.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],E.call(this,r)}}),h.each(["concat","join","slice"],function(n){var t=r[n];h.prototype[n]=function(){return E.call(this,t.apply(this._wrapped,arguments))}}),h.prototype.value=function(){return this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return h})}).call(this); -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.federecio 7 | dropwizard-swagger 8 | 0.8.2-wikia 9 | 10 | Dropwizard Swagger support 11 | A simple way to document your REST APIs in DropWizard using Swagger 12 | https://github.com/federecio/dropwizard-swagger/ 13 | 2014 14 | 15 | 16 | 17 | Apache License, Version 2.0 18 | http://www.apache.org/licenses/LICENSE-2.0 19 | 20 | 21 | 22 | 23 | 24 | Federico Recio 25 | http://about.me/federecio 26 | 27 | 28 | 29 | 30 | 31 | ossrh 32 | Maven Central Snapshot Repository 33 | https://oss.sonatype.org/content/repositories/snapshots 34 | 35 | 36 | ossrh 37 | Maven Central Staging Repository 38 | https://oss.sonatype.org/service/local/staging/deploy/maven2/ 39 | 40 | 41 | 42 | 43 | scm:git:git://github.com:federecio/dropwizard-swagger.git 44 | scm:git:git@github.com:federecio/dropwizard-swagger.git 45 | http://github.com/federecio/dropwizard-swagger 46 | HEAD 47 | 48 | 49 | 50 | 0.8.1 51 | UTF-8 52 | UTF-8 53 | UTF-8 54 | 1.7 55 | 1.5.3 56 | 57 | 58 | 59 | 60 | io.dropwizard 61 | dropwizard-core 62 | ${dropwizard.version} 63 | 64 | 65 | io.dropwizard 66 | dropwizard-assets 67 | ${dropwizard.version} 68 | 69 | 70 | io.dropwizard 71 | dropwizard-views 72 | ${dropwizard.version} 73 | 74 | 75 | io.dropwizard 76 | dropwizard-views-freemarker 77 | ${dropwizard.version} 78 | 79 | 80 | io.swagger 81 | swagger-jersey2-jaxrs 82 | ${swagger.version} 83 | 84 | 85 | com.fasterxml.jackson.dataformat 86 | jackson-dataformat-yaml 87 | 88 | 89 | com.fasterxml.jackson.jaxrs 90 | jackson-jaxrs-json-provider 91 | 92 | 93 | org.apache.commons 94 | commons-lang3 95 | 96 | 97 | org.javassist 98 | javassist 99 | 100 | 101 | com.fasterxml.jackson.core 102 | jackson-annotations 103 | 104 | 105 | com.google.guava 106 | guava 107 | 108 | 109 | org.slf4j 110 | slf4j-api 111 | 112 | 113 | com.fasterxml.jackson.module 114 | jackson-module-jaxb-annotations 115 | 116 | 117 | com.fasterxml.jackson.datatype 118 | jackson-datatype-joda 119 | 120 | 121 | com.fasterxml.jackson.core 122 | jackson-core 123 | 124 | 125 | com.fasterxml.jackson.core 126 | jackson-databind 127 | 128 | 129 | 130 | org.glassfish.jersey.core 131 | jersey-server 132 | 133 | 134 | org.glassfish.jersey.containers 135 | jersey-container-servlet-core 136 | 137 | 138 | org.glassfish.hk2.external 139 | javax.inject 140 | 141 | 142 | 143 | 144 | 145 | 146 | xml-apis 147 | xml-apis 148 | 1.4.01 149 | 150 | 151 | junit 152 | junit 153 | 4.11 154 | test 155 | 156 | 157 | com.jayway.restassured 158 | rest-assured 159 | 1.7.2 160 | test 161 | 162 | 163 | org.hamcrest 164 | hamcrest-core 165 | 166 | 167 | org.apache.httpcomponents 168 | httpclient 169 | 170 | 171 | org.apache.httpcomponents 172 | httpcore 173 | 174 | 175 | org.apache.commons 176 | commons-lang3 177 | 178 | 179 | 180 | 181 | io.federecio 182 | dropwizard-junit 183 | 0.6 184 | test 185 | 186 | 187 | io.dropwizard 188 | dropwizard-core 189 | 190 | 191 | 192 | 193 | org.seleniumhq.selenium.client-drivers 194 | selenium-java-client-driver 195 | 1.0.2 196 | test 197 | 198 | 199 | org.seleniumhq.selenium 200 | selenium-java 201 | 2.45.0 202 | test 203 | 204 | 205 | org.eclipse.jetty 206 | jetty-http 207 | 208 | 209 | org.eclipse.jetty 210 | jetty-io 211 | 212 | 213 | org.eclipse.jetty 214 | jetty-util 215 | 216 | 217 | org.apache.httpcomponents 218 | httpmime 219 | 220 | 221 | com.google.guava 222 | guava 223 | 224 | 225 | xml-apis 226 | xml-apis 227 | 228 | 229 | org.apache.httpcomponents 230 | httpclient 231 | 232 | 233 | 234 | 235 | org.apache.httpcomponents 236 | httpclient 237 | 4.3.2 238 | test 239 | 240 | 241 | commons-codec 242 | commons-codec 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | org.apache.maven.plugins 252 | maven-compiler-plugin 253 | 3.1 254 | 255 | ${jdk.version} 256 | ${jdk.version} 257 | 258 | 259 | 260 | org.apache.maven.plugins 261 | maven-surefire-plugin 262 | 2.17 263 | 264 | 265 | **/*SeleniumTest.java 266 | 267 | 268 | 269 | 270 | org.apache.maven.plugins 271 | maven-failsafe-plugin 272 | 2.17 273 | 274 | 275 | **/*SeleniumTest.java 276 | 277 | 278 | 1 279 | false 280 | 281 | 282 | 283 | 284 | integration-test 285 | verify 286 | 287 | 288 | 289 | 290 | 291 | org.apache.maven.plugins 292 | maven-enforcer-plugin 293 | 1.3.1 294 | 295 | 296 | enforce 297 | 298 | 299 | 300 | 301 | 302 | 303 | enforce 304 | 305 | 306 | 307 | 308 | 309 | org.apache.maven.plugins 310 | maven-release-plugin 311 | 2.5 312 | 313 | true 314 | false 315 | release 316 | deploy 317 | 318 | 319 | 320 | com.mycila 321 | license-maven-plugin 322 | 2.6 323 | 324 |
    license.txt
    325 | 326 | **/README 327 | src/test/resources/** 328 | src/main/resources/** 329 | *.xml 330 | 331 |
    332 | 333 | 334 | 335 | check 336 | 337 | 338 | 339 |
    340 |
    341 |
    342 | 343 | 344 | 345 | release 346 | 347 | 348 | 349 | org.apache.maven.plugins 350 | maven-source-plugin 351 | 2.3 352 | 353 | 354 | attach-sources 355 | 356 | jar-no-fork 357 | 358 | 359 | 360 | 361 | 362 | org.apache.maven.plugins 363 | maven-javadoc-plugin 364 | 2.9.1 365 | 366 | 367 | attach-javadocs 368 | 369 | jar 370 | 371 | 372 | 373 | 374 | 375 | org.apache.maven.plugins 376 | maven-gpg-plugin 377 | 1.5 378 | 379 | 380 | sign-artifacts 381 | verify 382 | 383 | sign 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 |
    394 | -------------------------------------------------------------------------------- /src/main/resources/swagger-static/lib/backbone-min.js: -------------------------------------------------------------------------------- 1 | // Backbone.js 1.1.2 2 | 3 | (function(t,e){if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){t.Backbone=e(t,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore");e(t,exports,i)}else{t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}})(this,function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.push;var o=n.slice;var h=n.splice;e.VERSION="1.1.2";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var u=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,r){if(!c(this,"once",t,[e,r])||!e)return this;var s=this;var n=i.once(function(){s.off(t,n);e.apply(this,arguments)});n._callback=e;return this.on(t,n,r)},off:function(t,e,r){var s,n,a,o,h,u,l,f;if(!this._events||!c(this,"off",t,[e,r]))return this;if(!t&&!e&&!r){this._events=void 0;return this}o=t?[t]:i.keys(this._events);for(h=0,u=o.length;h").attr(t);this.setElement(r,false)}else{this.setElement(i.result(this,"el"),false)}}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||M()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}if(a.type==="PATCH"&&k){a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var h=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,h,s);return h};var k=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var H=/(\(\?)?:\w+/g;var A=/\*\w+/g;var I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);n.execute(s,a);n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)});return this},execute:function(t,e){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(I,"\\$&").replace(S,"(?:$1)?").replace(H,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var C=/\/$/;var j=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment();var s=document.documentMode;var n=P.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);this.root=("/"+this.root+"/").replace(O,"/");if(n&&this._wantsHashChange){var a=e.$('