├── .gitignore ├── LICENSE ├── README.md ├── java ├── inflector-dropwizard-guice │ ├── README.md │ ├── inflector.yaml │ ├── pom.xml │ ├── server.yml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── samples │ │ │ └── inflector │ │ │ └── dropwizard │ │ │ ├── InflectorServer.java │ │ │ ├── InflectorServerConfiguration.java │ │ │ ├── InflectorServerModule.java │ │ │ ├── controllers │ │ │ └── SampleController.java │ │ │ └── models │ │ │ ├── Category.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ └── swagger │ │ └── swagger.yaml ├── inflector-dropwizard │ ├── README.md │ ├── inflector.yaml │ ├── pom.xml │ ├── server.yml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── samples │ │ │ └── inflector │ │ │ └── dropwizard │ │ │ ├── InflectorServer.java │ │ │ ├── InflectorServerConfiguration.java │ │ │ ├── controllers │ │ │ └── SampleController.java │ │ │ └── models │ │ │ ├── Category.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ └── swagger │ │ └── swagger.yaml ├── inflector-jetty-webxml │ ├── inflector.yaml │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── controllers │ │ │ ├── SampleController.java │ │ │ └── UserController.java │ │ │ └── models │ │ │ ├── Category.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ ├── swagger │ │ └── swagger.yaml │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml ├── inflector-springboot-jersey │ ├── .gitignore │ ├── README.md │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── inflector.yaml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── samples │ │ │ │ └── inflector │ │ │ │ └── springboot │ │ │ │ ├── InflectorApplication.java │ │ │ │ ├── config │ │ │ │ └── InflectorConfig.java │ │ │ │ ├── controllers │ │ │ │ └── SampleController.java │ │ │ │ └── models │ │ │ │ ├── Category.java │ │ │ │ ├── Pet.java │ │ │ │ ├── Tag.java │ │ │ │ └── User.java │ │ ├── resources │ │ │ └── application.yaml │ │ └── swagger │ │ │ └── swagger.yaml │ │ └── test │ │ └── java │ │ └── io │ │ └── swagger │ │ └── samples │ │ └── inflector │ │ └── springboot │ │ └── InflectorApplicationTests.java ├── java-dropwizard │ ├── README.md │ ├── conf │ │ └── swagger-sample.yml │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── io │ │ └── swagger │ │ └── sample │ │ ├── ApiOriginFilter.java │ │ ├── SwaggerSampleApplication.java │ │ ├── SwaggerSampleConfiguration.java │ │ ├── data │ │ ├── PetData.java │ │ ├── StoreData.java │ │ └── UserData.java │ │ ├── exception │ │ ├── ApiException.java │ │ ├── BadRequestException.java │ │ └── NotFoundException.java │ │ ├── model │ │ ├── Category.java │ │ ├── Order.java │ │ ├── Pet.java │ │ ├── Tag.java │ │ └── User.java │ │ └── resource │ │ ├── JavaRestResourceUtil.java │ │ └── PetResource.java ├── java-grails2 │ ├── README.md │ ├── grails-app │ │ ├── conf │ │ │ ├── ApplicationResources.groovy │ │ │ ├── BootStrap.groovy │ │ │ ├── BuildConfig.groovy │ │ │ ├── Config.groovy │ │ │ ├── DataSource.groovy │ │ │ ├── UrlMappings.groovy │ │ │ ├── logback.xml │ │ │ └── spring │ │ │ │ └── resources.groovy │ │ ├── i18n │ │ │ ├── messages.properties │ │ │ ├── messages_cs_CZ.properties │ │ │ ├── messages_da.properties │ │ │ ├── messages_de.properties │ │ │ ├── messages_es.properties │ │ │ ├── messages_fr.properties │ │ │ ├── messages_it.properties │ │ │ ├── messages_ja.properties │ │ │ ├── messages_nl.properties │ │ │ ├── messages_pl.properties │ │ │ ├── messages_pt_BR.properties │ │ │ ├── messages_pt_PT.properties │ │ │ ├── messages_ru.properties │ │ │ ├── messages_sv.properties │ │ │ ├── messages_th.properties │ │ │ └── messages_zh_CN.properties │ │ └── views │ │ │ └── error.gsp │ ├── grailsw │ ├── grailsw.bat │ ├── pom.xml │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── sample │ │ │ │ ├── Bootstrap.java │ │ │ │ ├── data │ │ │ │ ├── PetData.java │ │ │ │ ├── StoreData.java │ │ │ │ └── UserData.java │ │ │ │ ├── exception │ │ │ │ ├── ApiException.java │ │ │ │ ├── BadRequestException.java │ │ │ │ └── NotFoundException.java │ │ │ │ ├── model │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Category.java │ │ │ │ ├── Order.java │ │ │ │ ├── Pet.java │ │ │ │ ├── Tag.java │ │ │ │ └── User.java │ │ │ │ ├── resource │ │ │ │ ├── JavaRestResourceUtil.java │ │ │ │ ├── PetResource.java │ │ │ │ ├── PetStoreResource.java │ │ │ │ └── UserResource.java │ │ │ │ └── util │ │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ │ └── ApiOriginFilter.java │ │ │ ├── resources │ │ │ └── application.properties │ │ │ └── web-app │ │ │ ├── WEB-INF │ │ │ ├── applicationContext.xml │ │ │ ├── sitemesh.xml │ │ │ ├── tld │ │ │ │ ├── c.tld │ │ │ │ ├── fmt.tld │ │ │ │ ├── grails.tld │ │ │ │ └── spring.tld │ │ │ └── web.xml │ │ │ ├── css │ │ │ ├── print.css │ │ │ ├── reset.css │ │ │ ├── screen.css │ │ │ └── typography.css │ │ │ ├── fonts │ │ │ ├── droid-sans-v6-latin-700.eot │ │ │ ├── droid-sans-v6-latin-700.svg │ │ │ ├── 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.svg │ │ │ ├── droid-sans-v6-latin-regular.ttf │ │ │ ├── droid-sans-v6-latin-regular.woff │ │ │ └── droid-sans-v6-latin-regular.woff2 │ │ │ ├── images │ │ │ ├── explorer_icons.png │ │ │ ├── logo_small.png │ │ │ ├── pet_store_api.png │ │ │ ├── throbber.gif │ │ │ └── wordnik_api.png │ │ │ ├── index.html │ │ │ ├── lib │ │ │ ├── backbone-min.js │ │ │ ├── handlebars-2.0.0.js │ │ │ ├── highlight.7.3.pack.js │ │ │ ├── jquery-1.8.0.min.js │ │ │ ├── jquery.ba-bbq.min.js │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── marked.js │ │ │ ├── shred.bundle.js │ │ │ ├── swagger-client.js │ │ │ ├── swagger-oauth.js │ │ │ ├── underscore-min.js │ │ │ └── underscore-min.map │ │ │ ├── o2c.html │ │ │ ├── swagger-ui.js │ │ │ └── swagger-ui.min.js │ └── wrapper │ │ ├── grails-wrapper-runtime-2.2.1.jar │ │ ├── grails-wrapper.properties │ │ └── springloaded-core-1.1.1.jar ├── java-jaxrs-cxf │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── sample │ │ │ │ ├── data │ │ │ │ ├── PetData.java │ │ │ │ ├── StoreData.java │ │ │ │ └── UserData.java │ │ │ │ ├── exception │ │ │ │ ├── ApiException.java │ │ │ │ ├── BadRequestException.java │ │ │ │ └── NotFoundException.java │ │ │ │ ├── model │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Category.java │ │ │ │ ├── Order.java │ │ │ │ ├── Pet.java │ │ │ │ ├── Tag.java │ │ │ │ └── User.java │ │ │ │ ├── resource │ │ │ │ ├── JavaRestResourceUtil.java │ │ │ │ ├── PetResource.java │ │ │ │ ├── PetStoreResource.java │ │ │ │ ├── SampleExceptionMapper.java │ │ │ │ └── UserResource.java │ │ │ │ └── util │ │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ │ ├── applicationContext.xml │ │ │ └── logback.xml │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ │ └── test │ │ └── scala │ │ └── ResourceListingIT.scala ├── java-jaxrs-no-annotations │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── sample │ │ │ │ ├── Bootstrap.java │ │ │ │ ├── data │ │ │ │ ├── PetData.java │ │ │ │ ├── StoreData.java │ │ │ │ └── UserData.java │ │ │ │ ├── exception │ │ │ │ ├── ApiException.java │ │ │ │ ├── BadRequestException.java │ │ │ │ └── NotFoundException.java │ │ │ │ ├── model │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Category.java │ │ │ │ ├── Order.java │ │ │ │ ├── Pet.java │ │ │ │ ├── Tag.java │ │ │ │ └── User.java │ │ │ │ ├── resource │ │ │ │ ├── JavaRestResourceUtil.java │ │ │ │ ├── PetResource.java │ │ │ │ ├── PetStoreResource.java │ │ │ │ ├── SampleExceptionMapper.java │ │ │ │ └── UserResource.java │ │ │ │ └── util │ │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ │ └── logback.xml │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ │ └── test │ │ └── scala │ │ └── ResourceListingIT.scala ├── java-jaxrs-no-webxml │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── logs │ │ └── wordnik.log │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── sample │ │ │ │ ├── Bootstrap.java │ │ │ │ ├── data │ │ │ │ ├── PetData.java │ │ │ │ ├── StoreData.java │ │ │ │ └── UserData.java │ │ │ │ ├── exception │ │ │ │ ├── ApiException.java │ │ │ │ ├── BadRequestException.java │ │ │ │ └── NotFoundException.java │ │ │ │ ├── model │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Category.java │ │ │ │ ├── Order.java │ │ │ │ ├── Pet.java │ │ │ │ ├── Tag.java │ │ │ │ └── User.java │ │ │ │ ├── resource │ │ │ │ ├── JavaRestResourceUtil.java │ │ │ │ ├── PetResource.java │ │ │ │ ├── PetStoreResource.java │ │ │ │ └── UserResource.java │ │ │ │ └── util │ │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ │ └── logback.xml │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ │ └── test │ │ └── scala │ │ └── ResourceListingIT.scala ├── java-jaxrs-subresource │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── data │ │ │ └── PetData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Owner.java │ │ │ ├── Pet.java │ │ │ └── Tag.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── OwnerResource.java │ │ │ ├── PetResource.java │ │ │ └── SampleExceptionMapper.java │ │ │ └── util │ │ │ └── ApiOriginFilter.java │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-jaxrs-wink │ ├── LICENSE │ ├── README.md │ ├── pom.xml │ ├── runServer.sh │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Bootstrap.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resources │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ ├── PetStoreResource.java │ │ │ ├── ResourceConfiguration.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ └── util │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ └── log4j.properties │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-jaxrs │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── sample │ │ │ │ ├── Bootstrap.java │ │ │ │ ├── data │ │ │ │ ├── PetData.java │ │ │ │ ├── StoreData.java │ │ │ │ ├── UserData.java │ │ │ │ └── VehicleData.java │ │ │ │ ├── exception │ │ │ │ ├── ApiException.java │ │ │ │ ├── BadRequestException.java │ │ │ │ └── NotFoundException.java │ │ │ │ ├── model │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Car.java │ │ │ │ ├── Cat.java │ │ │ │ ├── Category.java │ │ │ │ ├── Order.java │ │ │ │ ├── Pet.java │ │ │ │ ├── Tag.java │ │ │ │ ├── User.java │ │ │ │ └── Vehicle.java │ │ │ │ ├── resource │ │ │ │ ├── JavaRestResourceUtil.java │ │ │ │ ├── PetResource.java │ │ │ │ ├── PetStoreResource.java │ │ │ │ ├── UserResource.java │ │ │ │ └── VehicleResource.java │ │ │ │ └── util │ │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ │ └── logback.xml │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ │ └── test │ │ └── scala │ │ └── ResourceListingIT.scala ├── java-jersey-governator │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── StartServer.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── modules │ │ │ ├── PetstoreModule.java │ │ │ ├── ServletConfigProvider.java │ │ │ └── SwaggerModule.java │ │ │ ├── resources │ │ │ ├── PetResource.java │ │ │ ├── PetStoreResource.java │ │ │ ├── RootResource.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ └── util │ │ │ └── ApiOriginCorsFilter.java │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── docs │ │ └── index.html ├── java-jersey-jaxrs-multi-simple-servlet │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Bootstrap.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ └── SampleExceptionMapper.java │ │ │ ├── storeresource │ │ │ └── PetStoreResource.java │ │ │ ├── userresource │ │ │ └── UserResource.java │ │ │ └── util │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ └── logback.xml │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-jersey-jaxrs-multi-simple-webxml │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ ├── storeresource │ │ │ └── PetStoreResource.java │ │ │ └── util │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ └── logback.xml │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-jersey-jaxrs-multi-use-basepath │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Bootstrap.java │ │ │ ├── Bootstrap2.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ ├── PetStoreResource.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ └── util │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ └── logback.xml │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-jersey-jaxrs-multi │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Bootstrap.java │ │ │ ├── Bootstrap2.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ ├── PetStoreResource.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ └── util │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ └── logback.xml │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-jersey-jaxrs │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Bootstrap.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ ├── PetStoreResource.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ └── util │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ └── logback.xml │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-jersey-spring │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── sample │ │ │ │ ├── Bootstrap.java │ │ │ │ ├── bean │ │ │ │ ├── JavaRestResourceUtil.java │ │ │ │ ├── PetResourceBean.java │ │ │ │ ├── PetStoreResourceBean.java │ │ │ │ ├── SampleExceptionMapper.java │ │ │ │ └── UserResourceBean.java │ │ │ │ ├── data │ │ │ │ ├── PetData.java │ │ │ │ ├── StoreData.java │ │ │ │ └── UserData.java │ │ │ │ ├── exception │ │ │ │ ├── ApiException.java │ │ │ │ ├── BadRequestException.java │ │ │ │ └── NotFoundException.java │ │ │ │ ├── model │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Category.java │ │ │ │ ├── Order.java │ │ │ │ ├── Pet.java │ │ │ │ ├── Tag.java │ │ │ │ └── User.java │ │ │ │ ├── resource │ │ │ │ ├── PetResource.java │ │ │ │ ├── PetStoreResource.java │ │ │ │ └── UserResource.java │ │ │ │ └── util │ │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ │ ├── beans-asset-ws.xml │ │ │ └── logback.xml │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ │ └── test │ │ └── scala │ │ └── ResourceListingIT.scala ├── java-jersey2-guice │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── sample │ │ │ │ ├── Application.java │ │ │ │ ├── Bootstrap.java │ │ │ │ ├── SwaggerExampleGuiceContextListener.java │ │ │ │ ├── data │ │ │ │ ├── PetData.java │ │ │ │ ├── StoreData.java │ │ │ │ └── UserData.java │ │ │ │ ├── exception │ │ │ │ ├── ApiException.java │ │ │ │ ├── BadRequestException.java │ │ │ │ └── NotFoundException.java │ │ │ │ ├── model │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Category.java │ │ │ │ ├── Order.java │ │ │ │ ├── Pet.java │ │ │ │ ├── Tag.java │ │ │ │ └── User.java │ │ │ │ ├── resource │ │ │ │ ├── JavaRestResourceUtil.java │ │ │ │ ├── PetResource.java │ │ │ │ ├── PetStoreResource.java │ │ │ │ ├── SampleExceptionMapper.java │ │ │ │ └── UserResource.java │ │ │ │ └── util │ │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ │ └── logback.xml │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ │ └── test │ │ └── scala │ │ └── ResourceListingIT.scala ├── java-jersey2 │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Bootstrap.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── AuthenticationInfo.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ ├── PetStoreResource.java │ │ │ ├── QueryResultBean.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ └── util │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ └── logback.xml │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-mule │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── mule-project.xml │ ├── pom.xml │ └── src │ │ └── main │ │ ├── app │ │ ├── log4j.properties │ │ ├── mule-deploy.properties │ │ └── mule-swagger-integration.xml │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Bootstrap.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ ├── PetStoreResource.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ └── util │ │ │ └── ApiOriginFilter.java │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── javax.ws.rs.ext.MessageBodyWriter │ │ ├── config.properties │ │ ├── log4j.properties │ │ └── logback.xml ├── java-resteasy-filter │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Bootstrap.java │ │ │ ├── PetStoreApplication.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ ├── PetStoreResource.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ └── util │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ └── logback.xml │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-resteasy-spring │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── sample │ │ │ │ ├── Bootstrap.java │ │ │ │ ├── bean │ │ │ │ ├── JavaRestResourceUtil.java │ │ │ │ ├── PetResourceBean.java │ │ │ │ ├── PetStoreResourceBean.java │ │ │ │ ├── SampleExceptionMapper.java │ │ │ │ └── UserResourceBean.java │ │ │ │ ├── data │ │ │ │ ├── PetData.java │ │ │ │ ├── StoreData.java │ │ │ │ └── UserData.java │ │ │ │ ├── exception │ │ │ │ ├── ApiException.java │ │ │ │ ├── BadRequestException.java │ │ │ │ └── NotFoundException.java │ │ │ │ ├── model │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Category.java │ │ │ │ ├── Order.java │ │ │ │ ├── Pet.java │ │ │ │ ├── Tag.java │ │ │ │ └── User.java │ │ │ │ ├── resource │ │ │ │ ├── PetResource.java │ │ │ │ ├── PetStoreResource.java │ │ │ │ └── UserResource.java │ │ │ │ └── util │ │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ │ ├── beans-asset-ws.xml │ │ │ └── logback.xml │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ │ └── test │ │ └── scala │ │ └── ResourceListingIT.scala ├── java-resteasy │ ├── README.md │ ├── conf │ │ └── log4j.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Bootstrap.java │ │ │ ├── PetStoreApplication.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── model │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── JavaRestResourceUtil.java │ │ │ ├── PetResource.java │ │ │ ├── PetStoreResource.java │ │ │ ├── SampleExceptionMapper.java │ │ │ └── UserResource.java │ │ │ └── util │ │ │ ├── ApiAuthorizationFilterImpl.java │ │ │ └── ApiOriginFilter.java │ │ ├── resources │ │ └── logback.xml │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.html ├── java-servlet │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── swagger │ │ │ │ └── sample │ │ │ │ ├── model │ │ │ │ ├── ApiResponse.java │ │ │ │ └── SampleData.java │ │ │ │ ├── servlet │ │ │ │ └── SampleServlet.java │ │ │ │ └── util │ │ │ │ └── ApiOriginFilter.java │ │ ├── resource │ │ │ └── logback.xml │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ │ └── test │ │ └── java │ │ └── io │ │ └── swagger │ │ └── sample │ │ └── ResourceListingIT.java ├── java-spring-boot │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── Application.java │ │ │ ├── data │ │ │ ├── PetData.java │ │ │ ├── StoreData.java │ │ │ └── UserData.java │ │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ ├── BadRequestException.java │ │ │ └── NotFoundException.java │ │ │ ├── models │ │ │ ├── ApiResponse.java │ │ │ ├── Category.java │ │ │ ├── Order.java │ │ │ ├── Pet.java │ │ │ ├── Tag.java │ │ │ └── User.java │ │ │ ├── resource │ │ │ ├── AbstractResource.java │ │ │ ├── PetResource.java │ │ │ └── StoreResource.java │ │ │ └── utils │ │ │ └── SimpleCORSFilter.java │ │ └── resources │ │ └── application.properties └── swagger-petstore-v2 │ └── README.md ├── pom.xml └── scala ├── scala-play2.4 ├── README.md ├── app │ ├── api │ │ ├── PetData.scala │ │ ├── StoreData.scala │ │ └── UserData.scala │ ├── controllers │ │ ├── BaseApiController.scala │ │ ├── PetApiController.scala │ │ ├── StoreApiController.scala │ │ └── UserApiController.scala │ ├── models │ │ ├── ApiResponse.scala │ │ ├── Category.scala │ │ ├── Order.scala │ │ ├── Pet.scala │ │ ├── Tag.scala │ │ └── User.scala │ ├── security │ │ └── AuthorisationFilter.scala │ ├── util │ │ └── RestResourceUtil.scala │ └── value │ │ └── ApiResponse.scala ├── build.sbt ├── conf │ ├── application.conf │ ├── logback.xml │ └── routes ├── project │ ├── build.properties │ └── plugins.sbt ├── public │ └── images │ │ └── favicon.png └── test │ ├── IntegrationSpec.scala │ └── IntegrationTest.java └── scala-play2.6 ├── README.md ├── app ├── api │ ├── PetData.scala │ ├── StoreData.scala │ └── UserData.scala ├── controllers │ ├── BaseApiController.scala │ ├── PetApiController.scala │ ├── StoreApiController.scala │ └── UserApiController.scala ├── models │ ├── ApiResponse.scala │ ├── Category.scala │ ├── Order.scala │ ├── Pet.scala │ ├── Tag.scala │ └── User.scala ├── security │ └── AuthorisationFilter.scala ├── util │ └── RestResourceUtil.scala └── value │ └── ApiResponse.scala ├── build.sbt ├── conf ├── application.conf ├── logback.xml └── routes ├── project ├── build.properties └── plugins.sbt ├── public └── images │ └── favicon.png └── test ├── IntegrationSpec.scala └── IntegrationTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | lib/*.jar 3 | target 4 | samples/scala-play2/logs 5 | .idea 6 | .idea_modules 7 | .settings 8 | .project 9 | .classpath 10 | .cache 11 | atlassian-ide-plugin.xml 12 | *.iml 13 | .java-version -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Swagger Samples 2 | 3 | This repository serves for samples for various projects. Right now it contains the samples for swagger-core under 4 | the java library. Each sample contains a README file with details how to run it and what to check. 5 | 6 | ## Security contact 7 | 8 | This repository has been set to “archived” as these samples are no longer kept up to date with security patches. 9 | If you still wish to use these samples in production, it is highly advised to update all the dependencies to their latest versions 10 | to mitigate any potential security vulnerabilities from outdated dependencies. While this repo is unmaintained 11 | , the integration pattern of Swagger Core with the demonstrated frameworks and environments are valid and applicable 12 | to latest version of Swagger Core v1 (master branch) and v2 (2.0 branch) as of 30/10/2023 13 | -------------------------------------------------------------------------------- /java/inflector-dropwizard-guice/README.md: -------------------------------------------------------------------------------- 1 | ## Dropwizard-Guice Inflector Sample 2 | 3 | Simple example showing how to use the inflector with dropwizard and guice for DI. 4 | 5 | Build with 6 | 7 | ``` 8 | mvn clean install 9 | ``` 10 | 11 | Run with 12 | 13 | ``` 14 | java -jar ./target/inflector-dropwizard-guice-sample-1.0.0-SNAPSHOT.jar server server.yml 15 | ``` 16 | 17 | 18 | You can get to the swagger file at: 19 | 20 | ``` 21 | http://localhost:8080/v2/swagger.json 22 | ``` 23 | 24 | Have fun! 25 | 26 | -------------------------------------------------------------------------------- /java/inflector-dropwizard-guice/inflector.yaml: -------------------------------------------------------------------------------- 1 | controllerPackage: io.swagger.samples.inflector.dropwizard.controllers 2 | modelPackage: io.swagger.samples.inflector.dropwizard.models 3 | swaggerUrl: ./src/main/swagger/swagger.yaml 4 | modelMappings: 5 | Pet: io.swagger.samples.inflector.dropwizard.models.Pet 6 | 7 | # loads all by default, or pick and choose 8 | entityProcessors: 9 | - json 10 | - xml 11 | - yaml 12 | -------------------------------------------------------------------------------- /java/inflector-dropwizard-guice/server.yml: -------------------------------------------------------------------------------- 1 | config: inflector.yaml -------------------------------------------------------------------------------- /java/inflector-dropwizard-guice/src/main/java/io/swagger/samples/inflector/dropwizard/InflectorServerConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.samples.inflector.dropwizard; 18 | 19 | import io.dropwizard.Configuration; 20 | 21 | public class InflectorServerConfiguration extends Configuration { 22 | private String config; 23 | 24 | public String getConfig() { 25 | return config; 26 | } 27 | 28 | public void setConfig(String config) { 29 | this.config = config; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/inflector-dropwizard-guice/src/main/java/io/swagger/samples/inflector/dropwizard/InflectorServerModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.samples.inflector.dropwizard; 18 | 19 | import com.google.inject.AbstractModule; 20 | 21 | public class InflectorServerModule extends AbstractModule { 22 | @Override 23 | protected void configure() { 24 | // bind your guice stuff here 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/inflector-dropwizard/README.md: -------------------------------------------------------------------------------- 1 | ## Dropwizard Inflector Sample 2 | 3 | Simple example showing how to use the inflector with dropwizard. 4 | 5 | Build with 6 | 7 | ``` 8 | mvn clean install 9 | ``` 10 | 11 | Run with 12 | 13 | ``` 14 | java -jar ./target/inflector-dropwizard-sample-1.0.0-SNAPSHOT.jar server server.yml 15 | ``` 16 | 17 | You can get to the swagger file at: 18 | 19 | ``` 20 | http://localhost:8080/v2/swagger.json 21 | ``` 22 | 23 | Have fun! 24 | 25 | -------------------------------------------------------------------------------- /java/inflector-dropwizard/inflector.yaml: -------------------------------------------------------------------------------- 1 | controllerPackage: io.swagger.samples.inflector.dropwizard.controllers 2 | modelPackage: io.swagger.samples.inflector.dropwizard.models 3 | swaggerUrl: ./src/main/swagger/swagger.yaml 4 | modelMappings: 5 | Pet: io.swagger.samples.inflector.dropwizard.models.Pet 6 | 7 | # loads all by default, or pick and choose 8 | entityProcessors: 9 | - json 10 | - xml 11 | - yaml 12 | -------------------------------------------------------------------------------- /java/inflector-dropwizard/server.yml: -------------------------------------------------------------------------------- 1 | config: inflector.yaml -------------------------------------------------------------------------------- /java/inflector-dropwizard/src/main/java/io/swagger/samples/inflector/dropwizard/InflectorServerConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.samples.inflector.dropwizard; 18 | 19 | import io.dropwizard.Configuration; 20 | 21 | public class InflectorServerConfiguration extends Configuration { 22 | private String config; 23 | 24 | public String getConfig() { 25 | return config; 26 | } 27 | 28 | public void setConfig(String config) { 29 | this.config = config; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/inflector-jetty-webxml/inflector.yaml: -------------------------------------------------------------------------------- 1 | controllerPackage: io.swagger.sample.controllers 2 | modelPackage: io.swagger.sample.models 3 | swaggerUrl: ./src/main/swagger/swagger.yaml 4 | modelMappings: 5 | Pet: io.swagger.sample.models.Pet 6 | # allows environment to be develop, staging, production. Production will not start if 7 | # unimplemented models or methods are detected 8 | environment: development 9 | 10 | # loads all by default, or pick and choose 11 | entityProcessors: 12 | - json 13 | - xml 14 | - yaml 15 | -------------------------------------------------------------------------------- /java/inflector-jetty-webxml/src/main/java/io/swagger/sample/controllers/SampleController.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.controllers; 2 | 3 | import io.swagger.inflector.models.RequestContext; 4 | import io.swagger.inflector.models.ResponseContext; 5 | import io.swagger.sample.models.Pet; 6 | import org.apache.commons.io.IOUtils; 7 | 8 | import javax.ws.rs.core.Response.Status; 9 | import java.io.ByteArrayOutputStream; 10 | import java.io.IOException; 11 | 12 | public class SampleController { 13 | public ResponseContext addPet(RequestContext request, Pet body) { 14 | 15 | 16 | return new ResponseContext() 17 | .status(Status.OK) 18 | .entity(body); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java/inflector-jetty-webxml/src/main/java/io/swagger/sample/controllers/UserController.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.controllers; 2 | 3 | import io.swagger.inflector.models.RequestContext; 4 | import io.swagger.inflector.models.ResponseContext; 5 | import io.swagger.sample.models.User; 6 | 7 | import javax.ws.rs.core.Response.Status; 8 | 9 | public class UserController { 10 | public ResponseContext createUsersWithListInput(RequestContext request, User[] body) { 11 | int count = 0; 12 | 13 | if(body != null) { 14 | count = body.length; 15 | } 16 | System.out.println("created " + count + " users"); 17 | 18 | return new ResponseContext() 19 | .status(Status.OK); 20 | } 21 | } -------------------------------------------------------------------------------- /java/inflector-jetty-webxml/src/main/java/io/swagger/sample/models/Category.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.models; 2 | 3 | public class Category { 4 | private long id; 5 | private String name; 6 | 7 | public long getId() { 8 | return id; 9 | } 10 | 11 | public void setId(long id) { 12 | this.id = id; 13 | } 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public void setName(String name) { 20 | this.name = name; 21 | } 22 | } -------------------------------------------------------------------------------- /java/inflector-jetty-webxml/src/main/java/io/swagger/sample/models/Tag.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.models; 2 | 3 | public class Tag { 4 | private long id; 5 | private String name; 6 | 7 | public long getId() { 8 | return id; 9 | } 10 | 11 | public void setId(long id) { 12 | this.id = id; 13 | } 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public void setName(String name) { 20 | this.name = name; 21 | } 22 | } -------------------------------------------------------------------------------- /java/inflector-jetty-webxml/src/main/java/io/swagger/sample/models/User.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.models; 2 | 3 | public class User { 4 | private Long id; 5 | private String user; 6 | 7 | public User id(Long id) { 8 | this.id = id; 9 | return this; 10 | } 11 | 12 | public User user(String user) { 13 | this.user = user; 14 | return this; 15 | } 16 | 17 | public Long getId() { 18 | return id; 19 | } 20 | 21 | public void setId(Long id) { 22 | this.id = id; 23 | } 24 | 25 | public String getUser() { 26 | return user; 27 | } 28 | 29 | public void setUser(String user) { 30 | this.user = user; 31 | } 32 | } -------------------------------------------------------------------------------- /java/inflector-springboot-jersey/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | nbproject/private/ 21 | build/ 22 | nbbuild/ 23 | dist/ 24 | nbdist/ 25 | .nb-gradle/ -------------------------------------------------------------------------------- /java/inflector-springboot-jersey/README.md: -------------------------------------------------------------------------------- 1 | ## Spring Boot Jersey Inflector Sample 2 | 3 | A simple example demonstrating how to use Swagger Inflector with Spring Boot. This project integrates both Spring Boot Actuator and the Spring Boot Jersey integration. Because Actuator is built upon SpringMVC, [Jersey and Actuator must listen on different endpoints](http://docs.spring.io/spring-boot/docs/current/reference/html/howto-actuator.html#howto-use-actuator-with-jersey). Please see the `applictaion.yaml` for how this is accomplished. 4 | 5 | 6 | The project uses [Gradle](https://gradle.org/) for its build system and you can build the project by running: 7 | 8 | ./gradlew build 9 | 10 | You can also run the app using the [Spring Boot Gradle Plugin](http://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-gradle-plugin.html) like so: 11 | 12 | ./gradlew bootRun 13 | 14 | The swagger definition will be available at the following URI: 15 | 16 | [http://localhost:8080/api/v2/swagger.json](http://localhost:8080/api/v2/swagger.json) 17 | 18 | The Spring Boot Actuator endpoints are avilable here: 19 | 20 | [http://localhost:8080/info](http://localhost:8080/info) 21 | [http://localhost:8080/env](http://localhost:8080/env) 22 | 23 | Have fun! 24 | 25 | -------------------------------------------------------------------------------- /java/inflector-springboot-jersey/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/inflector-springboot-jersey/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /java/inflector-springboot-jersey/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Nov 25 10:53:22 EST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip 7 | -------------------------------------------------------------------------------- /java/inflector-springboot-jersey/inflector.yaml: -------------------------------------------------------------------------------- 1 | controllerPackage: io.swagger.samples.inflector.springboot.controllers 2 | modelPackage: io.swagger.samples.inflector.springboot.models 3 | swaggerUrl: ./src/main/swagger/swagger.yaml 4 | modelMappings: 5 | Pet: io.swagger.samples.inflector.springboot.models.Pet 6 | # loads all by default, or pick and choose 7 | entityProcessors: 8 | - json 9 | # - xml 10 | # - yaml 11 | -------------------------------------------------------------------------------- /java/inflector-springboot-jersey/src/main/java/io/swagger/samples/inflector/springboot/config/InflectorConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 SmartBear Software 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.swagger.samples.inflector.springboot.config; 17 | 18 | import io.swagger.inflector.SwaggerInflector; 19 | import io.swagger.inflector.config.Configuration; 20 | import org.springframework.beans.factory.annotation.Autowired; 21 | import org.springframework.stereotype.Component; 22 | 23 | /** 24 | * 25 | */ 26 | @Component 27 | public class InflectorConfig extends SwaggerInflector { 28 | 29 | @Autowired 30 | public InflectorConfig(Configuration configuration) { 31 | super(configuration); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /java/inflector-springboot-jersey/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet-path: / 4 | spring: 5 | application: 6 | name: inflector-springboot-jersey 7 | jersey: 8 | application-path: /api 9 | jackson: 10 | date-format: com.fasterxml.jackson.databind.util.ISO8601DateFormat 11 | default-property-inclusion: NON_ABSENT 12 | serialization: 13 | WRITE_DATES_AS_TIMESTAMPS: false 14 | INDENT_OUTPUT: true -------------------------------------------------------------------------------- /java/inflector-springboot-jersey/src/test/java/io/swagger/samples/inflector/springboot/InflectorApplicationTests.java: -------------------------------------------------------------------------------- 1 | package io.swagger.samples.inflector.springboot; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class InflectorApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /java/java-dropwizard/README.md: -------------------------------------------------------------------------------- 1 | To run the sample: 2 | 3 | ``` 4 | mvn package 5 | 6 | java -jar target/swagger-java-dropwizard-sample-app-2.0.0.jar server conf/swagger-sample.yml 7 | 8 | ``` 9 | 10 | You can then access swagger at http://localhost:8080/swagger.json 11 | -------------------------------------------------------------------------------- /java/java-dropwizard/conf/swagger-sample.yml: -------------------------------------------------------------------------------- 1 | defaultName: Swagger-sample 2 | logging: 3 | level: ERROR 4 | appenders: 5 | - type: console 6 | threshold: ALL 7 | timeZone: UTC 8 | target: stdout 9 | -------------------------------------------------------------------------------- /java/java-dropwizard/src/main/java/io/swagger/sample/SwaggerSampleConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample; 2 | 3 | import io.dropwizard.Configuration; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | import org.hibernate.validator.constraints.NotEmpty; 8 | 9 | public class SwaggerSampleConfiguration extends Configuration { 10 | @NotEmpty 11 | @JsonProperty 12 | private String defaultName = "swagger-sample"; 13 | 14 | public String getDefaultName() { 15 | return defaultName; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/java-dropwizard/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-dropwizard/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-dropwizard/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-dropwizard/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-dropwizard/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-grails2/README.md: -------------------------------------------------------------------------------- 1 | # Swagger Sample App 2 | 3 | ## Overview 4 | This is a grails project to build a stand-alone server which implements the OpenAPI Spec. You can find out more about both the spec and the framework at http://swagger.io. There is an online version similar to this server at http://petstore.swagger.io/v2/swagger.json 5 | 6 | ### Running the app 7 | You do not need to install Grails separately to run this project. 8 | 9 | To start simply run: 10 | 11 | ``` 12 | ./grailsw run-app 13 | ``` 14 | 15 | This will download required framework files and dependencies and start the app on port 8080. You can then navigate to the swagger-ui here: 16 | 17 | ``` 18 | http://localhost:8080/java-grails2/index.html 19 | ``` 20 | 21 | -------------------------------------------------------------------------------- /java/java-grails2/grails-app/conf/ApplicationResources.groovy: -------------------------------------------------------------------------------- 1 | modules = { 2 | application { 3 | resource url:'js/application.js' 4 | } 5 | } -------------------------------------------------------------------------------- /java/java-grails2/grails-app/conf/BootStrap.groovy: -------------------------------------------------------------------------------- 1 | class BootStrap { 2 | 3 | def init = { servletContext -> 4 | } 5 | def destroy = { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /java/java-grails2/grails-app/conf/UrlMappings.groovy: -------------------------------------------------------------------------------- 1 | class UrlMappings { 2 | 3 | static mappings = { 4 | "/$controller/$action?/$id?"{ 5 | constraints { 6 | // apply constraints here 7 | } 8 | } 9 | 10 | "500"(view:'/error') 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /java/java-grails2/grails-app/conf/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-grails2/grails-app/conf/spring/resources.groovy: -------------------------------------------------------------------------------- 1 | // Place your Spring DSL code here 2 | beans = { 3 | } 4 | -------------------------------------------------------------------------------- /java/java-grails2/grails-app/views/error.gsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Grails Runtime Exception 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /java/java-grails2/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-grails2/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-grails2/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-grails2/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-grails2/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-grails2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #Grails Metadata file 2 | #Thu Aug 01 08:46:22 PDT 2013 3 | app.grails.version=2.2.4 4 | app.name=java-grails2 5 | app.version=0.1 6 | plugins.jaxrs=0.8 7 | -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/WEB-INF/sitemesh.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-700.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-700.eot -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-700.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-700.ttf -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-700.woff -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-700.woff2 -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-regular.eot -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-regular.ttf -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-regular.woff -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/fonts/droid-sans-v6-latin-regular.woff2 -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/images/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/images/explorer_icons.png -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/images/logo_small.png -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/images/pet_store_api.png -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/images/throbber.gif -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/images/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/src/main/web-app/images/wordnik_api.png -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/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 | -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/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();}});}});}; -------------------------------------------------------------------------------- /java/java-grails2/src/main/web-app/o2c.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /java/java-grails2/wrapper/grails-wrapper-runtime-2.2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/wrapper/grails-wrapper-runtime-2.2.1.jar -------------------------------------------------------------------------------- /java/java-grails2/wrapper/grails-wrapper.properties: -------------------------------------------------------------------------------- 1 | wrapper.dist.url=http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/ 2 | -------------------------------------------------------------------------------- /java/java-grails2/wrapper/springloaded-core-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-grails2/wrapper/springloaded-core-1.1.1.jar -------------------------------------------------------------------------------- /java/java-jaxrs-cxf/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-cxf/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-cxf/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-cxf/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs-cxf/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs-cxf/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} %-5level [%thread] %logger#%method:%line - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /java/java-jaxrs-cxf/src/test/scala/ResourceListingIT.scala: -------------------------------------------------------------------------------- 1 | import io.swagger.models._ 2 | 3 | import io.swagger.util.Json 4 | 5 | import org.junit.runner.RunWith 6 | 7 | import org.scalatest.junit.JUnitRunner 8 | import org.scalatest.FlatSpec 9 | import org.scalatest.Matchers 10 | 11 | import java.net.URL 12 | 13 | import scala.collection.JavaConversions._ 14 | 15 | @RunWith(classOf[JUnitRunner]) 16 | class ResourceListingIT extends FlatSpec with Matchers { 17 | it should "read a resource listing" in { 18 | val swagger = Json.mapper().readValue(new URL("http://localhost:8002/api/swagger.json"), classOf[Swagger]) 19 | 20 | swagger.getHost() should be ("localhost:8002") 21 | swagger.getBasePath() should be ("/api") 22 | 23 | val info = swagger.getInfo() 24 | 25 | info should not be (null) 26 | info.getVersion() should be ("1.0.0") 27 | info.getTitle() should be ("Swagger Petstore") 28 | info.getContact() should not be (null) 29 | info.getContact().getName() should be ("apiteam@swagger.io") 30 | info.getLicense() should not be (null) 31 | info.getLicense().getName() should be ("Apache 2.0") 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-annotations/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private static final long serialVersionUID = 1L; 21 | private int code; 22 | public ApiException (int code, String msg) { 23 | super(msg); 24 | this.code = code; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-annotations/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private static final long serialVersionUID = 1L; 21 | private int code; 22 | public BadRequestException (int code, String msg) { 23 | super(code, msg); 24 | this.code = code; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-annotations/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private static final long serialVersionUID = 1L; 21 | private int code; 22 | public NotFoundException (int code, String msg) { 23 | super(code, msg); 24 | this.code = code; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-annotations/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-webxml/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-webxml/logs/wordnik.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-jaxrs-no-webxml/logs/wordnik.log -------------------------------------------------------------------------------- /java/java-jaxrs-no-webxml/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-webxml/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-webxml/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-webxml/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs-no-webxml/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs-no-webxml/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-jaxrs-no-webxml/src/test/scala/ResourceListingIT.scala: -------------------------------------------------------------------------------- 1 | import io.swagger.models._ 2 | 3 | import io.swagger.util.Json 4 | 5 | import org.junit.runner.RunWith 6 | 7 | import org.scalatest.junit.JUnitRunner 8 | import org.scalatest.FlatSpec 9 | import org.scalatest.Matchers 10 | 11 | import java.net.URL 12 | 13 | import scala.collection.JavaConversions._ 14 | 15 | @RunWith(classOf[JUnitRunner]) 16 | class ResourceListingIT extends FlatSpec with Matchers { 17 | it should "read a resource listing" in { 18 | val swagger = Json.mapper().readValue(new URL("http://localhost:8002/api/swagger.json"), classOf[Swagger]) 19 | 20 | swagger.getHost() should be ("localhost:8002") 21 | swagger.getBasePath() should be ("/api") 22 | 23 | val info = swagger.getInfo() 24 | 25 | info should not be (null) 26 | info.getVersion() should be ("1.0.0") 27 | info.getTitle() should be ("Swagger Petstore") 28 | info.getContact() should not be (null) 29 | info.getContact().getEmail() should be ("apiteam@swagger.io") 30 | info.getLicense() should not be (null) 31 | info.getLicense().getName() should be ("Apache 2.0") 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /java/java-jaxrs-subresource/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jaxrs-subresource/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-subresource/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-subresource/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-subresource/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs-subresource/src/main/java/io/swagger/sample/model/Owner.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Owner") 22 | public class Owner { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs-subresource/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs-wink/runServer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PORT=9999 4 | 5 | if [[ $# -eq 1 ]] ; then 6 | PORT=${1} 7 | fi 8 | 9 | mvn package jetty:run -Djetty.port=${PORT} -------------------------------------------------------------------------------- /java/java-jaxrs-wink/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-wink/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-wink/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private final int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs-wink/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs-wink/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs-wink/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=info, stdout, R 2 | 3 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | 6 | # Pattern to output the caller's file name and line number. 7 | log4j.appender.stdout.layout.ConversionPattern=[%d{ISO8601}] [%-5p] [%t] [%c{1}] %m%n 8 | 9 | log4j.appender.R=org.apache.log4j.RollingFileAppender 10 | log4j.appender.R.File=jetty.log 11 | 12 | log4j.appender.R.MaxFileSize=100MB 13 | # Keep one backup file 14 | log4j.appender.R.MaxBackupIndex=1 15 | 16 | log4j.appender.R.layout=org.apache.log4j.PatternLayout 17 | log4j.appender.R.layout.ConversionPattern=[%d{ISO8601}] [%-5p] [%t] [%c{1}] %m%n -------------------------------------------------------------------------------- /java/java-jaxrs/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jaxrs/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jaxrs/src/main/java/io/swagger/sample/model/Car.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.model; 2 | 3 | import javax.xml.bind.annotation.XmlRootElement; 4 | 5 | @XmlRootElement(name = "Car") 6 | public class Car extends Vehicle { 7 | private Integer seats; 8 | 9 | public Integer getSeats() { 10 | return seats; 11 | } 12 | 13 | public void setSeats(Integer seats) { 14 | this.seats = seats; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /java/java-jaxrs/src/main/java/io/swagger/sample/model/Cat.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.model; 2 | 3 | import javax.xml.bind.annotation.XmlRootElement; 4 | 5 | @XmlRootElement(name = "Cat") 6 | public class Cat extends Pet { 7 | 8 | String catBreed; 9 | 10 | public String getCatBreed() { 11 | return catBreed; 12 | } 13 | 14 | public void setCatBreed(String catBreed) { 15 | this.catBreed = catBreed; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/java-jaxrs/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jaxrs/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-jaxrs/src/test/scala/ResourceListingIT.scala: -------------------------------------------------------------------------------- 1 | import io.swagger.models._ 2 | 3 | import io.swagger.util.Json 4 | 5 | import org.junit.runner.RunWith 6 | 7 | import org.scalatest.junit.JUnitRunner 8 | import org.scalatest.FlatSpec 9 | import org.scalatest.Matchers 10 | 11 | import java.net.URL 12 | 13 | import scala.collection.JavaConversions._ 14 | 15 | @RunWith(classOf[JUnitRunner]) 16 | class ResourceListingIT extends FlatSpec with Matchers { 17 | it should "read a resource listing" in { 18 | val swagger = Json.mapper().readValue(new URL("http://localhost:8002/api/swagger.json"), classOf[Swagger]) 19 | 20 | swagger.getHost() should be ("localhost:8002") 21 | swagger.getBasePath() should be ("/api") 22 | 23 | val info = swagger.getInfo() 24 | 25 | info should not be (null) 26 | info.getVersion() should be ("1.0.0") 27 | info.getTitle() should be ("Swagger Petstore") 28 | info.getContact() should not be (null) 29 | info.getContact().getEmail() should be ("apiteam@swagger.io") 30 | info.getLicense() should not be (null) 31 | info.getLicense().getName() should be ("Apache 2.0") 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /java/java-jersey-governator/README.md: -------------------------------------------------------------------------------- 1 | # Swagger, Jersey, Governator Sample App 2 | 3 | This app shows you how to combine Swagger, Jersey 1.X, and [Governator](https://github.com/Netflix/governator) 4 | 5 | ### To run (with Maven) 6 | To run the server, run this task: 7 | 8 | ``` 9 | mvn package jetty:run-war 10 | ``` 11 | 12 | This will start Jetty embedded on port 8002. 13 | 14 | ### Testing the server 15 | Once started, you can navigate to http://localhost:8002/swagger.json to view the Swagger Resource Listing. 16 | This tells you that the server is up and ready to demonstrate Swagger. 17 | 18 | 19 | ### Using the UI 20 | There is an HTML5-based API tool bundled in this sample--you can view it it at [http://localhost:8002/docs](http://localhost:8002/docs). This lets you inspect the API using an interactive UI. You can access the source of this code from [here](https://github.com/swagger-api/swagger-ui) 21 | 22 | ### Using the Karyon 2 Admin Page 23 | 24 | You can view the Karyon 2 Admin Page at [http://localhost:8077/adminres](http://localhost:8077/adminres). This page gives you access to debug/admin features provided by karyon. 25 | 26 | -------------------------------------------------------------------------------- /java/java-jersey-governator/src/main/java/io/swagger/sample/StartServer.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample; 2 | 3 | import com.google.inject.Injector; 4 | import com.netflix.governator.InjectorBuilder; 5 | import com.netflix.governator.guice.servlet.GovernatorServletContextListener; 6 | import io.swagger.sample.modules.PetstoreModule; 7 | import io.swagger.sample.modules.SwaggerModule; 8 | import netflix.adminresources.resources.KaryonWebAdminModule; 9 | 10 | /** 11 | * Created by rbolles on 2/18/16. 12 | */ 13 | public class StartServer extends GovernatorServletContextListener { 14 | 15 | @Override 16 | protected Injector createInjector() throws Exception { 17 | return InjectorBuilder.fromModules( 18 | new PetstoreModule(), 19 | new SwaggerModule(), 20 | new KaryonWebAdminModule() 21 | ).createInjector(); 22 | } 23 | } -------------------------------------------------------------------------------- /java/java-jersey-governator/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception { 20 | private int code; 21 | 22 | public ApiException (int code, String msg) { 23 | super(msg); 24 | this.code = code; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/java-jersey-governator/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException { 20 | private int code; 21 | 22 | public BadRequestException (int code, String msg) { 23 | super(code, msg); 24 | this.code = code; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/java-jersey-governator/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | 22 | public NotFoundException (int code, String msg) { 23 | super(code, msg); 24 | this.code = code; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/java-jersey-governator/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.XmlElement; 20 | import javax.xml.bind.annotation.XmlRootElement; 21 | 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | public long getId() { 27 | return id; 28 | } 29 | 30 | public void setId(long id) { 31 | this.id = id; 32 | } 33 | 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | } -------------------------------------------------------------------------------- /java/java-jersey-governator/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.XmlElement; 20 | import javax.xml.bind.annotation.XmlRootElement; 21 | 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | public long getId() { 27 | return id; 28 | } 29 | 30 | public void setId(long id) { 31 | this.id = id; 32 | } 33 | 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | public void setName(String name) { 39 | this.name = name; 40 | } 41 | } -------------------------------------------------------------------------------- /java/java-jersey-governator/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | guiceFilter 9 | com.google.inject.servlet.GuiceFilter 10 | 11 | 12 | 13 | guiceFilter 14 | /* 15 | 16 | 17 | 18 | io.swagger.sample.StartServer 19 | 20 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-servlet/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-servlet/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-servlet/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-servlet/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-servlet/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-servlet/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-webxml/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-webxml/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-webxml/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-webxml/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-webxml/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-simple-webxml/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-use-basepath/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-use-basepath/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-use-basepath/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-use-basepath/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-use-basepath/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi-use-basepath/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey-jaxrs-multi/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-jaxrs/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey-jaxrs/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey-jaxrs/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-jersey-spring/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jersey-spring/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-spring/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-spring/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey-spring/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey-spring/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey-spring/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-jersey2-guice/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jersey2-guice/src/main/java/io/swagger/sample/Application.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample; 2 | 3 | import org.glassfish.jersey.server.ResourceConfig; 4 | 5 | public class Application extends ResourceConfig { 6 | public Application() { 7 | packages("io.swagger.sample.resource"). 8 | packages("io.swagger.sample.util"). 9 | register(io.swagger.jaxrs.listing.ApiListingResource.class). 10 | register(io.swagger.jaxrs.listing.SwaggerSerializers.class); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /java/java-jersey2-guice/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey2-guice/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey2-guice/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey2-guice/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey2-guice/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey2-guice/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-jersey2-guice/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | io.swagger.sample.SwaggerExampleGuiceContextListener 8 | 9 | 10 | 11 | guiceFilter 12 | com.google.inject.servlet.GuiceFilter 13 | 14 | 15 | 16 | guiceFilter 17 | /api/* 18 | 19 | 20 | -------------------------------------------------------------------------------- /java/java-jersey2/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-jersey2/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey2/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey2/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-jersey2/src/main/java/io/swagger/sample/model/AuthenticationInfo.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.model; 2 | 3 | import io.swagger.annotations.ApiParam; 4 | 5 | import javax.ws.rs.*; 6 | 7 | public class AuthenticationInfo { 8 | @HeaderParam("X-TOKEN") 9 | @ApiParam("The an expiring token assigned to a user") 10 | protected String token; 11 | @HeaderParam("X-REQUEST-HASH") 12 | @ApiParam("A HMAC-SHA hash based on the request being made") 13 | protected String hash; 14 | 15 | public String getHash() { 16 | return token; 17 | } 18 | public void setHash(String token) { 19 | this.token = token; 20 | } 21 | 22 | public String getToken() { 23 | return token; 24 | } 25 | public void setToken(String token) { 26 | this.token = token; 27 | } 28 | } -------------------------------------------------------------------------------- /java/java-jersey2/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey2/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-jersey2/src/main/java/io/swagger/sample/resource/QueryResultBean.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.resource; 18 | 19 | import javax.ws.rs.*; 20 | 21 | public class QueryResultBean { 22 | @QueryParam("skip") 23 | private Integer skip; 24 | 25 | @QueryParam("limit") 26 | private Integer limit; 27 | 28 | 29 | public Integer getSkip() { 30 | return skip; 31 | } 32 | public void setSkip(Integer skip) { 33 | this.skip = skip; 34 | } 35 | 36 | public Integer getLimit() { 37 | return limit; 38 | } 39 | public void setLimit(Integer limit) { 40 | this.limit = limit; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /java/java-jersey2/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-mule/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-mule/mule-project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | mule-swagger-integration 4 | 5 | -------------------------------------------------------------------------------- /java/java-mule/src/main/app/log4j.properties: -------------------------------------------------------------------------------- 1 | # Default log level 2 | log4j.rootLogger=DEBUG,applogger 3 | log4j.appender.applogger=org.apache.log4j.DailyRollingFileAppender 4 | log4j.appender.applogger.DatePattern=yyyyMMdd 5 | log4j.appender.applogger.File=${log_dir}/mule-app-swagger-integration-v1.0.log 6 | log4j.appender.applogger.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.applogger.layout.ConversionPattern=%-5p %d [%t] %c: %m%n 8 | 9 | ################################################ 10 | # You can set custom log levels per-package here 11 | ################################################ 12 | 13 | # CXF is used heavily by Mule for web services 14 | log4j.logger.org.apache.cxf=WARN 15 | 16 | # Apache Commons tend to make a lot of noise which can clutter the log. 17 | log4j.logger.org.apache=WARN 18 | 19 | log4j.logger.io.swagger=INFO 20 | 21 | # Reduce startup noise 22 | log4j.logger.org.springframework.beans.factory=WARN 23 | 24 | # Mule classes 25 | log4j.logger.org.mule=DEBUG 26 | log4j.logger.com.mulesoft=DEBUG 27 | 28 | # Reduce DM verbosity 29 | log4j.logger.org.jetel=WARN 30 | log4j.logger.Tracking=WARN 31 | log4j.logger.org.mortbay=INFO 32 | -------------------------------------------------------------------------------- /java/java-mule/src/main/app/mule-deploy.properties: -------------------------------------------------------------------------------- 1 | redeployment.enabled=true 2 | encoding=UTF-8 3 | domain=default 4 | config.resources=mule-swagger-integration.xml 5 | -------------------------------------------------------------------------------- /java/java-mule/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-mule/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-mule/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-mule/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-mule/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-mule/src/main/resources/META-INF/services/javax.ws.rs.ext.MessageBodyWriter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/java/java-mule/src/main/resources/META-INF/services/javax.ws.rs.ext.MessageBodyWriter -------------------------------------------------------------------------------- /java/java-mule/src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | Access-Control-Allow-Origin=* 2 | Access-Control-Allow-Headers=Origin, X-Requested-With, Content-Type, Accept -------------------------------------------------------------------------------- /java/java-mule/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Default log level 2 | log4j.rootLogger=DEBUG,applogger 3 | log4j.appender.applogger=org.apache.log4j.DailyRollingFileAppender 4 | log4j.appender.applogger.DatePattern=yyyyMMdd 5 | log4j.appender.applogger.File=${log_dir}/mule-app-swagger-integration-v1.0.log 6 | log4j.appender.applogger.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.applogger.layout.ConversionPattern=%-5p %d [%t] %c: %m%n 8 | 9 | ################################################ 10 | # You can set custom log levels per-package here 11 | ################################################ 12 | 13 | # CXF is used heavily by Mule for web services 14 | log4j.logger.org.apache.cxf=WARN 15 | 16 | # Apache Commons tend to make a lot of noise which can clutter the log. 17 | log4j.logger.org.apache=WARN 18 | 19 | log4j.logger.io.swagger=INFO 20 | 21 | # Reduce startup noise 22 | log4j.logger.org.springframework.beans.factory=WARN 23 | 24 | # Mule classes 25 | log4j.logger.org.mule=INFO 26 | log4j.logger.com.mulesoft=INFO 27 | 28 | # Reduce DM verbosity 29 | log4j.logger.org.jetel=WARN 30 | log4j.logger.Tracking=WARN 31 | log4j.logger.org.mortbay=INFO -------------------------------------------------------------------------------- /java/java-mule/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-resteasy-filter/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-resteasy-filter/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-resteasy-filter/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-resteasy-filter/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-resteasy-filter/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-resteasy-filter/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-resteasy-filter/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-resteasy-spring/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-resteasy-spring/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-resteasy-spring/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-resteasy-spring/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-resteasy-spring/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-resteasy-spring/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-resteasy-spring/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-resteasy/conf/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootCategory=ERROR, CONSOLE, LOGFILE 2 | 3 | log4j.logger.io.swagger=ERROR 4 | log4j.logger.org.atmosphere=ERROR 5 | 6 | # CONSOLE is set to be a ConsoleAppender using a PatternLayout. 7 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 8 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 10 | 11 | # LOGFILE is set to be a File appender using a PatternLayout. 12 | log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender 13 | log4j.appender.LOGFILE.File=logs/swagger.log 14 | log4j.appender.LOGFILE.Append=true 15 | log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n 17 | log4j.appender.LOGFILE.MaxFileSize=10MB 18 | log4j.appender.LOGFILE.MaxBackupIndex=10 19 | -------------------------------------------------------------------------------- /java/java-resteasy/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-resteasy/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException{ 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-resteasy/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-resteasy/src/main/java/io/swagger/sample/model/Category.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Category") 22 | public class Category { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-resteasy/src/main/java/io/swagger/sample/model/Tag.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.model; 18 | 19 | import javax.xml.bind.annotation.*; 20 | 21 | @XmlRootElement(name = "Tag") 22 | public class Tag { 23 | private long id; 24 | private String name; 25 | 26 | @XmlElement(name = "id") 27 | public long getId() { 28 | return id; 29 | } 30 | 31 | public void setId(long id) { 32 | this.id = id; 33 | } 34 | 35 | @XmlElement(name = "name") 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | } -------------------------------------------------------------------------------- /java/java-resteasy/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-servlet/src/main/java/io/swagger/sample/util/ApiOriginFilter.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.util; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.Filter; 6 | import javax.servlet.FilterChain; 7 | import javax.servlet.FilterConfig; 8 | import javax.servlet.ServletException; 9 | import javax.servlet.ServletRequest; 10 | import javax.servlet.ServletResponse; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | public class ApiOriginFilter implements Filter { 14 | 15 | @Override 16 | public void init(FilterConfig filterConfig) throws ServletException { 17 | 18 | } 19 | 20 | @Override 21 | public void doFilter(ServletRequest request, ServletResponse response, 22 | FilterChain chain) throws IOException, ServletException { 23 | final HttpServletResponse res = (HttpServletResponse) response; 24 | res.addHeader("Access-Control-Allow-Origin:", "*"); 25 | res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); 26 | res.addHeader("Access-Control-Allow-Headers", "Content-Type"); 27 | chain.doFilter(request, response); 28 | } 29 | 30 | @Override 31 | public void destroy() { 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /java/java-servlet/src/main/resource/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/java-spring-boot/README.md: -------------------------------------------------------------------------------- 1 | # Swagger + SpringFox + SpringBoot example 2 | 3 | This is a simple example to demonstrate Swagger with Spring Boot. The integration 4 | is handled by SpringFox, a 3rd party library for enabling Swagger on Spring MVC projects. 5 | 6 | For more information on SpringFox, pleas visit [http://springfox.io](http://springfox.io) 7 | 8 | ## Building 9 | 10 | This project requires Java 7 or greater. 11 | 12 | To build: 13 | 14 | ``` 15 | mvn clean package 16 | ``` 17 | 18 | This produces an exectuable jar in the `target` folder. 19 | 20 | To run: 21 | 22 | ``` 23 | java -jar target/swaggerhub-spring-boot-sample-1.0.0-SNAPSHOT.jar 24 | ``` 25 | 26 | -------------------------------------------------------------------------------- /java/java-spring-boot/src/main/java/io/swagger/sample/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class ApiException extends Exception{ 20 | private int code; 21 | public ApiException (int code, String msg) { 22 | super(msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-spring-boot/src/main/java/io/swagger/sample/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class BadRequestException extends ApiException { 20 | private int code; 21 | public BadRequestException (int code, String msg) { 22 | super(code, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-spring-boot/src/main/java/io/swagger/sample/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 SmartBear Software 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 | 17 | package io.swagger.sample.exception; 18 | 19 | public class NotFoundException extends ApiException { 20 | private int code; 21 | public NotFoundException (int code, String msg) { 22 | super(404, msg); 23 | this.code = code; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java/java-spring-boot/src/main/java/io/swagger/sample/models/Category.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.models; 2 | 3 | import javax.xml.bind.annotation.XmlElement; 4 | import javax.xml.bind.annotation.XmlRootElement; 5 | 6 | @XmlRootElement(name = "Category") 7 | public class Category { 8 | private long id; 9 | private String name; 10 | 11 | @XmlElement(name = "id") 12 | public long getId() { 13 | return id; 14 | } 15 | 16 | public void setId(long id) { 17 | this.id = id; 18 | } 19 | 20 | @XmlElement(name = "name") 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | } -------------------------------------------------------------------------------- /java/java-spring-boot/src/main/java/io/swagger/sample/models/Tag.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.models; 2 | 3 | import javax.xml.bind.annotation.XmlElement; 4 | import javax.xml.bind.annotation.XmlRootElement; 5 | 6 | @XmlRootElement(name = "Tag") 7 | public class Tag { 8 | private long id; 9 | private String name; 10 | 11 | @XmlElement(name = "id") 12 | public long getId() { 13 | return id; 14 | } 15 | 16 | public void setId(long id) { 17 | this.id = id; 18 | } 19 | 20 | @XmlElement(name = "name") 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | } -------------------------------------------------------------------------------- /java/java-spring-boot/src/main/java/io/swagger/sample/resource/AbstractResource.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.resource; 2 | 3 | import io.swagger.sample.exception.NotFoundException; 4 | import io.swagger.sample.models.ApiResponse; 5 | import org.springframework.http.HttpStatus; 6 | import org.springframework.web.bind.annotation.CrossOrigin; 7 | import org.springframework.web.bind.annotation.ExceptionHandler; 8 | import org.springframework.web.bind.annotation.ResponseStatus; 9 | 10 | public class AbstractResource { 11 | 12 | @CrossOrigin(allowedHeaders = "foo", origins = "*") 13 | @ResponseStatus(HttpStatus.NOT_FOUND) 14 | @ExceptionHandler(NotFoundException.class) 15 | public ApiResponse exception(NotFoundException e) { 16 | return new ApiResponse(ApiResponse.ERROR, e.getMessage()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /java/java-spring-boot/src/main/java/io/swagger/sample/resource/StoreResource.java: -------------------------------------------------------------------------------- 1 | package io.swagger.sample.resource; 2 | 3 | /** 4 | * Created by tony on 9/9/16. 5 | */ 6 | public class StoreResource { 7 | } 8 | -------------------------------------------------------------------------------- /java/java-spring-boot/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # prefix for all requests 2 | server.contextPath=/v2 3 | 4 | # location of the swagger json 5 | springfox.documentation.swagger.v2.path=/swagger.json -------------------------------------------------------------------------------- /java/swagger-petstore-v2/README.md: -------------------------------------------------------------------------------- 1 | # Swagger Sample Petstore App 2 | 3 | This project has been moved to https://github.com/swagger-api/swagger-petstore/tree/v2 4 | 5 | -------------------------------------------------------------------------------- /scala/scala-play2.4/README.md: -------------------------------------------------------------------------------- 1 | # Swagger Playframework Sample App 2 | 3 | ## Overview 4 | This is a scala project to build a stand-alone server which implements the OpenAPI Spec. You can find out 5 | more about both the spec and the framework at http://swagger.io. There is an online version of this 6 | server at [http://petstore.swagger.io](http://petstore.swagger.io) 7 | 8 | ## Version compatibility 9 | ======= 10 | This version is compatible with Play 2.4.0 and Swagger 1.5.0-SNAPSHOT 11 | 12 | ### To build Swagger from source (optional) 13 | Please follow instructions to build the top-level [swagger-core project](https://github.com/swagger-api/swagger-play) 14 | 15 | ### To run 16 | The swagger-play2 module lives in maven central: 17 | 18 | ```scala 19 | val appDependencies: Seq[sbt.ModuleID] = Seq( 20 | /* your other dependencies */ 21 | "io.swagger" %% "swagger-play2" % "1.5.0-SNAPSHOT" 22 | ) 23 | ``` 24 | 25 | You can run the sample app as such: 26 | 27 | ``` 28 | sbt run 29 | ``` 30 | or 31 | ``` 32 | activator testProd 33 | ```` 34 | 35 | The application will listen on port 9000 and respond to `http://localhost:9000/swagger.json` 36 | 37 | You can test the sample app as such: 38 | 39 | 40 | ```` 41 | activator test 42 | ```` -------------------------------------------------------------------------------- /scala/scala-play2.4/app/models/Category.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Reverb Technologies, Inc. 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 | 17 | package models 18 | 19 | import io.swagger.annotations._ 20 | 21 | import scala.annotation.meta.field 22 | 23 | @ApiModel(value="Category",description="category of a pet") 24 | case class Category( 25 | @(ApiModelProperty @field)(position=1)id: Long, 26 | @(ApiModelProperty @field)(position=2)name: String) 27 | -------------------------------------------------------------------------------- /scala/scala-play2.4/app/models/Order.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Reverb Technologies, Inc. 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 | 17 | package models 18 | 19 | import io.swagger.annotations._ 20 | 21 | import java.util.Date 22 | 23 | import scala.annotation.meta.field 24 | 25 | @ApiModel("Order") 26 | case class Order ( 27 | @(ApiModelProperty @field)(position=1)id: Long, 28 | @(ApiModelProperty @field)(position=2)petId: Long, 29 | @(ApiModelProperty @field)(position=3)quantity: Int, 30 | @(ApiModelProperty @field)(position=4)shipDate: Date, 31 | @(ApiModelProperty @field)(position=5)status: String 32 | ) 33 | -------------------------------------------------------------------------------- /scala/scala-play2.4/app/models/Pet.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Reverb Technologies, Inc. 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 | 17 | package models 18 | 19 | import io.swagger.annotations._ 20 | 21 | import scala.annotation.meta.field 22 | 23 | @ApiModel("Pet") 24 | case class Pet( 25 | @(ApiModelProperty @field)(position=1, value="id")id: Long, 26 | @(ApiModelProperty @field)(position=2)category: Category, 27 | @(ApiModelProperty @field)(position=3)name: String, 28 | @(ApiModelProperty @field)(position=4)photoUrls: List[String], 29 | @(ApiModelProperty @field)(position=5)tags: List[Tag], 30 | @(ApiModelProperty @field)(position=6)status: String 31 | ) 32 | -------------------------------------------------------------------------------- /scala/scala-play2.4/app/models/Tag.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Reverb Technologies, Inc. 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 | 17 | package models 18 | 19 | import io.swagger.annotations._ 20 | 21 | import scala.annotation.meta.field 22 | 23 | 24 | @ApiModel("Tag") 25 | case class Tag ( 26 | @(ApiModelProperty @field)(position=1)id: Long, 27 | @(ApiModelProperty @field)(position=2)name: String) 28 | -------------------------------------------------------------------------------- /scala/scala-play2.4/app/value/ApiResponse.scala: -------------------------------------------------------------------------------- 1 | package value 2 | 3 | import javax.xml.bind.annotation._ 4 | 5 | object ApiResponse { 6 | val ERROR = 1 7 | val WARNING = 2 8 | val INFO = 3 9 | val OK = 4 10 | val TOO_BUSY = 5 11 | } 12 | 13 | @XmlRootElement 14 | class ApiResponse(@XmlElement var code: Int, @XmlElement var message: String) { 15 | def this() = this(0, null) 16 | 17 | @XmlTransient 18 | def getCode(): Int = code 19 | def setCode(code: Int) = this.code = code 20 | 21 | def getType(): String = code match { 22 | case ApiResponse.ERROR => "error" 23 | case ApiResponse.WARNING => "warning" 24 | case ApiResponse.INFO => "info" 25 | case ApiResponse.OK => "ok" 26 | case ApiResponse.TOO_BUSY => "too busy" 27 | case _ => "unknown" 28 | } 29 | def setType(`type`: String) = {} 30 | 31 | def getMessage(): String = message 32 | def setMessage(message: String) = this.message = message 33 | } 34 | -------------------------------------------------------------------------------- /scala/scala-play2.4/conf/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %coloredLevel - %logger - %message%n%xException 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /scala/scala-play2.4/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.9 2 | -------------------------------------------------------------------------------- /scala/scala-play2.4/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | // The Play plugin 2 | addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.6") 3 | 4 | // Web plugins 5 | addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0") 6 | addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6") 7 | addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3") 8 | addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7") 9 | addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0") 10 | addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0") 11 | 12 | // Play enhancer - this automatically generates getters/setters for public fields 13 | // and rewrites accessors of these fields to use the getters/setters. Remove this 14 | // plugin if you prefer not to have this feature, or disable on a per project 15 | // basis using disablePlugins(PlayEnhancer) in your build.sbt 16 | addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0") 17 | 18 | // Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using 19 | // enablePlugins(SbtEbean). Note, uncommenting this line will automatically bring in 20 | // Play enhancer, regardless of whether the line above is commented out or not. 21 | // addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "2.0.0") 22 | 23 | addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3") 24 | -------------------------------------------------------------------------------- /scala/scala-play2.4/public/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/scala/scala-play2.4/public/images/favicon.png -------------------------------------------------------------------------------- /scala/scala-play2.6/README.md: -------------------------------------------------------------------------------- 1 | # Swagger Playframework Sample App 2 | 3 | ## Overview 4 | This is a scala project to build a stand-alone server which implements the OpenAPI Spec. You can find out 5 | more about both the spec and the framework at http://swagger.io. There is an online version of this 6 | server at [http://petstore.swagger.io](http://petstore.swagger.io) 7 | 8 | ## Version compatibility 9 | ======= 10 | This version is compatible with Play 2.6 and Swagger 1.5.X 11 | 12 | 13 | ### To run 14 | The swagger-play2 module lives in maven central: 15 | 16 | ```scala 17 | val appDependencies: Seq[sbt.ModuleID] = Seq( 18 | /* your other dependencies */ 19 | "io.swagger" %% "swagger-play2" % "1.6.1" 20 | ) 21 | ``` 22 | 23 | You can run the sample app as such: 24 | 25 | ``` 26 | sbt run 27 | ``` 28 | or 29 | ``` 30 | activator testProd 31 | ```` 32 | 33 | The application will listen on port 9000 and respond to `http://localhost:9000/swagger.json` 34 | 35 | You can test the sample app as such: 36 | 37 | 38 | ```` 39 | activator test 40 | ```` -------------------------------------------------------------------------------- /scala/scala-play2.6/app/models/Category.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Reverb Technologies, Inc. 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 | 17 | package models 18 | 19 | import io.swagger.annotations._ 20 | 21 | import scala.annotation.meta.field 22 | 23 | @ApiModel(value="Category",description="category of a pet") 24 | case class Category( 25 | @(ApiModelProperty @field)(position=1)id: Long, 26 | @(ApiModelProperty @field)(position=2)name: String) 27 | -------------------------------------------------------------------------------- /scala/scala-play2.6/app/models/Order.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Reverb Technologies, Inc. 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 | 17 | package models 18 | 19 | import io.swagger.annotations._ 20 | 21 | import java.util.Date 22 | 23 | import scala.annotation.meta.field 24 | 25 | @ApiModel("Order") 26 | case class Order ( 27 | @(ApiModelProperty @field)(position=1)id: Long, 28 | @(ApiModelProperty @field)(position=2)petId: Long, 29 | @(ApiModelProperty @field)(position=3)quantity: Int, 30 | @(ApiModelProperty @field)(position=4)shipDate: Date, 31 | @(ApiModelProperty @field)(position=5)status: String 32 | ) 33 | -------------------------------------------------------------------------------- /scala/scala-play2.6/app/models/Pet.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Reverb Technologies, Inc. 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 | 17 | package models 18 | 19 | import io.swagger.annotations._ 20 | 21 | import scala.annotation.meta.field 22 | 23 | @ApiModel("Pet") 24 | case class Pet( 25 | @(ApiModelProperty @field)(position=1, value="id")id: Long, 26 | @(ApiModelProperty @field)(position=2)category: Category, 27 | @(ApiModelProperty @field)(position=3)name: String, 28 | @(ApiModelProperty @field)(position=4)photoUrls: List[String], 29 | @(ApiModelProperty @field)(position=5)tags: List[Tag], 30 | @(ApiModelProperty @field)(position=6)status: String 31 | ) 32 | -------------------------------------------------------------------------------- /scala/scala-play2.6/app/models/Tag.scala: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Reverb Technologies, Inc. 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 | 17 | package models 18 | 19 | import io.swagger.annotations._ 20 | 21 | import scala.annotation.meta.field 22 | 23 | 24 | @ApiModel("Tag") 25 | case class Tag ( 26 | @(ApiModelProperty @field)(position=1)id: Long, 27 | @(ApiModelProperty @field)(position=2)name: String) 28 | -------------------------------------------------------------------------------- /scala/scala-play2.6/app/value/ApiResponse.scala: -------------------------------------------------------------------------------- 1 | package value 2 | 3 | import javax.xml.bind.annotation._ 4 | 5 | object ApiResponse { 6 | val ERROR = 1 7 | val WARNING = 2 8 | val INFO = 3 9 | val OK = 4 10 | val TOO_BUSY = 5 11 | } 12 | 13 | @XmlRootElement 14 | class ApiResponse(@XmlElement var code: Int, @XmlElement var message: String) { 15 | def this() = this(0, null) 16 | 17 | @XmlTransient 18 | def getCode(): Int = code 19 | def setCode(code: Int) = this.code = code 20 | 21 | def getType(): String = code match { 22 | case ApiResponse.ERROR => "error" 23 | case ApiResponse.WARNING => "warning" 24 | case ApiResponse.INFO => "info" 25 | case ApiResponse.OK => "ok" 26 | case ApiResponse.TOO_BUSY => "too busy" 27 | case _ => "unknown" 28 | } 29 | def setType(`type`: String) = {} 30 | 31 | def getMessage(): String = message 32 | def setMessage(message: String) = this.message = message 33 | } 34 | -------------------------------------------------------------------------------- /scala/scala-play2.6/conf/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %coloredLevel - %logger - %message%n%xException 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /scala/scala-play2.6/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.1.2 2 | -------------------------------------------------------------------------------- /scala/scala-play2.6/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | // The Play plugin 2 | addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.6") 3 | 4 | // Web plugins 5 | addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.2") 6 | addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.2") 7 | addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.6") 8 | addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.10") 9 | addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.3") 10 | addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.2") 11 | 12 | // Play enhancer - this automatically generates getters/setters for public fields 13 | // and rewrites accessors of these fields to use the getters/setters. Remove this 14 | // plugin if you prefer not to have this feature, or disable on a per project 15 | // basis using disablePlugins(PlayEnhancer) in your build.sbt 16 | addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.2.2") 17 | 18 | // Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using 19 | // enablePlugins(SbtEbean). Note, uncommenting this line will automatically bring in 20 | // Play enhancer, regardless of whether the line above is commented out or not. 21 | // addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "2.0.0") 22 | 23 | addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9") 24 | -------------------------------------------------------------------------------- /scala/scala-play2.6/public/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swagger-api/swagger-samples/cdef17ac1137902226f51e15bdfc8e4ec329bd7d/scala/scala-play2.6/public/images/favicon.png --------------------------------------------------------------------------------