Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Master #76

Open
wants to merge 102 commits into
base: develop_2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
b629a22
Merge pull request #2 from swagger-api/develop_2.0
fehguy Jun 7, 2015
f819604
Fixed migrated codehaus maven repo
webron Jun 10, 2015
313e4c1
clean up project and subproject structure for the java-grails2 sample…
Jul 22, 2015
b57671c
Update README.md
mar612 Sep 1, 2015
f179625
Merge pull request #13 from mar612/patch-1
fehguy Sep 2, 2015
d90ee33
Merge pull request #11 from ceekayel/develop
webron Sep 6, 2015
630616a
Changed project configuration method
webron Sep 6, 2015
f286cae
Update swagger-core version to 1.5.3
webron Sep 6, 2015
baeb8c8
Merge pull request #15 from swagger-api/swagger_core_1_5_3
webron Sep 6, 2015
d5e9b68
Fixed #16: Migrate swagger-servlet sample
iushankin Sep 8, 2015
5809a49
Merge pull request #17 from iushankin/issue-16
webron Sep 20, 2015
95a60a5
java-dropwizard sample has been modified
lugaru1234 Oct 13, 2015
b3aaf40
java-jaxrs-subresource sample has been modified
lugaru1234 Oct 13, 2015
7d21023
java-grails2 sample has been modified
lugaru1234 Oct 13, 2015
971dd31
java-jaxrs sample has been modified
lugaru1234 Oct 13, 2015
200f47f
java-jaxrs-cxf sample has been modified
lugaru1234 Oct 13, 2015
0a2cb56
java-jaxrs-no-annotations sample has been modified
lugaru1234 Oct 13, 2015
4936522
java-jaxrs-no-webxml sample has been modified
lugaru1234 Oct 13, 2015
d93aed9
java-jaxrs-wink sample has been modified
lugaru1234 Oct 13, 2015
52236ca
java-jersey-spring has been modified
lugaru1234 Oct 13, 2015
1873238
java-jersey2 has been modified
lugaru1234 Oct 13, 2015
1711edd
java-mule has been modified
lugaru1234 Oct 14, 2015
906ee9b
java-resteasy has been modified
lugaru1234 Oct 14, 2015
1972963
java-resteasy-spring has been modified
lugaru1234 Oct 14, 2015
f47f072
java-jersey-jaxrs has been modified
lugaru1234 Oct 12, 2015
e1ed244
java-jersey2-guice has been modified
lugaru1234 Oct 14, 2015
7246bc6
Merge pull request #18 from lugaru1234/issue1458-java-jersey-jaxrs
webron Oct 16, 2015
83b250f
Merge pull request #19 from lugaru1234/issue1458-java-dropwizard
webron Oct 16, 2015
a1df038
Merge pull request #20 from lugaru1234/issue1458-java-grails2
webron Oct 16, 2015
9f590bc
Merge pull request #21 from lugaru1234/issue1458-java-jaxrs
webron Oct 16, 2015
81a195b
Merge pull request #22 from lugaru1234/issue1458-java-jaxrs-cxf
webron Oct 16, 2015
766ebfc
Merge pull request #23 from lugaru1234/issue1458-java-jaxrs-no-annota…
webron Oct 16, 2015
6889e39
Merge pull request #24 from lugaru1234/issue1458-java-jaxrs-no-webxml
webron Oct 16, 2015
6a42cdb
Merge pull request #25 from lugaru1234/issue1458-java-jaxrs-subresource
webron Oct 16, 2015
cad06f6
Merge pull request #26 from lugaru1234/issue1458-java-jaxrs-wink
webron Oct 16, 2015
8fcfd44
Merge pull request #27 from lugaru1234/issue1458-java-jersey-spring
webron Oct 16, 2015
6a9ed20
Merge pull request #28 from lugaru1234/issue1458-java-jersey2
webron Oct 16, 2015
d362ac8
Merge pull request #29 from lugaru1234/issue1458-java-jersey2-guice
webron Oct 16, 2015
3bb0931
Merge pull request #30 from lugaru1234/issue1458-java-mule
webron Oct 16, 2015
7782d12
Merge pull request #31 from lugaru1234/issue1458-java-resteasy
webron Oct 16, 2015
57e1852
Merge pull request #32 from lugaru1234/issue1458-java-resteasy-spring
webron Oct 16, 2015
2520b2f
Fix typos
machour Nov 2, 2015
26bc11c
Merge pull request #33 from machour/master
fehguy Nov 2, 2015
07b13b8
added dw sample
fehguy Nov 7, 2015
086efe6
added jetty sample
fehguy Nov 7, 2015
561d055
Merge branch 'master' of github.com:swagger-api/swagger-samples
fehguy Nov 7, 2015
11d1d4f
added files
fehguy Nov 30, 2015
5fb8134
swagger-play 1.5.0-SNAPSHOT support
frantuma Dec 2, 2015
f876127
Merge pull request #36 from frantuma/swagger-play-1.5.0
webron Dec 4, 2015
b58b2df
added swagger auth filter example
frantuma Dec 4, 2015
233d497
Merge pull request #37 from frantuma/swagger-play-1.5.0
webron Dec 4, 2015
42dfcbb
removed unused routes, updated default listing route
fehguy Dec 10, 2015
d9db0d1
updated README
fehguy Dec 10, 2015
a23ff73
Merge branch 'play-2.4'
fehguy Dec 10, 2015
a69a676
Upgrade Specs2 to avoid need for bintray resolver and Play for newer …
Dec 15, 2015
e0adf8e
Merge pull request #41 from benmccann/specs2
fehguy Dec 16, 2015
c3d702a
Rely on 1.5.0 now that there's a working released version
Dec 16, 2015
34c9c1d
Merge pull request #42 from benmccann/released-version
fehguy Dec 16, 2015
9407af2
Swagger Spec -> OpenAPI Spec
webron Dec 30, 2015
12086b0
Happy new year!
webron Jan 7, 2016
57b1fe7
updated to latest release
fehguy Jan 13, 2016
3f18d6d
refs #1482 extend scanner scopes
frantuma Jan 14, 2016
9751b8b
refs #1482 extend config and scanner scopes
frantuma Jan 15, 2016
4573b90
refs #1482 adds jersey-jaxrs-multi samples module
frantuma Jan 18, 2016
104b742
refs #1482 cleanup sample modules
frantuma Jan 19, 2016
92d06b9
updated index, versions
fehguy Jan 21, 2016
18be63e
Merge pull request #46 from frantuma/issue_1482_refactor
fehguy Jan 21, 2016
b196acf
updated context
fehguy Jan 21, 2016
0cc83f6
merged
fehguy Jan 21, 2016
27a5b88
initial sample
Feb 2, 2016
ab34586
added inflector samples to root pom
Feb 2, 2016
a71aa88
Merge pull request #47 from swagger-api/dropwizard-guice-sample
webron Feb 2, 2016
d27c203
Update README.md
webron Feb 2, 2016
951a61f
Update README.md
webron Feb 2, 2016
5fd4f37
added remove reference call
fehguy Feb 5, 2016
7e3f599
updated version
fehguy Feb 5, 2016
8cc646d
Merge branch 'master' of github.com:swagger-api/swagger-samples
fehguy Feb 5, 2016
de6cedf
Used the correct order for init for servlets
MathieuAA Feb 5, 2016
a61618b
Merge pull request #48 from MathieuAA/patch-1
webron Feb 5, 2016
6fa9e8a
Refs #43 (https://github.com/swagger-api/swagger-play/issues/43) - Pa…
frantuma Feb 3, 2016
3cfd307
Merge pull request #49 from frantuma/issue-43-test
fehguy Feb 12, 2016
4277232
Update README.md
webron Feb 12, 2016
29e29cb
Add Swagger, Jersey, Governor example
Helmsdown Feb 19, 2016
7543478
remove files i didn't meant to commit
Helmsdown Feb 19, 2016
d8be949
Merge pull request #50 from Helmsdown/swagger-karyon-example
fehguy Feb 19, 2016
930b3c0
updated version to 1.5.8-SNAPSHOT
frantuma Mar 5, 2016
8270c6b
added RESTEasy filter dispatcher sample
frantuma Mar 5, 2016
0882e7b
Refs swagger-api/swagger-core#851 - add composition sample
frantuma Mar 11, 2016
698f266
Merge pull request #53 from frantuma/issue-851
frantuma Mar 11, 2016
88ba0a6
update swagger version to 1.5.8
frantuma Mar 18, 2016
d34d6eb
Merge pull request #51 from frantuma/samples-enhancement
frantuma Mar 18, 2016
1d6ad34
updates swagger-play version, adds assembly
frantuma Apr 13, 2016
e725cd4
Merge pull request #59 from frantuma/master
frantuma Apr 13, 2016
ba25470
bump core version, adds multi sample with basepath discriminator refs…
frantuma Aug 19, 2016
445906d
Merge pull request #62 from frantuma/release-1.5.10
webron Aug 19, 2016
3f18a37
added spring boot sample
fehguy Sep 9, 2016
6fe9f6d
Upgraded the DropWizard version in swagger-java-dropwizard-sample-app…
Oct 17, 2016
0599bec
Merge pull request #66 from fipp/master
fehguy Oct 17, 2016
9cb76c6
Added Spring Boot + Jersey sample
damnhandy Nov 25, 2016
4a2edbb
Merge pull request #67 from damnhandy/springboot-1.4.x
fehguy Nov 28, 2016
fbb7b27
Fix jar name in instruction sample of swagger-java-dropwizard-sample-app
wiktor-k Dec 1, 2016
4e4d8f1
Merge pull request #68 from wiktor-k/master
fehguy Dec 2, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ through network traffic inspection. When properly defined via Swagger, a consume
remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level
programming, Swagger removes the guesswork in calling the service.

Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger
Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger
project, including additional libraries with support for SpringMVC, other languages and more.

## What's here?

This repository serves for samples for various projects. Right now it contains the samples for swagger-core under
the java library. Each sample contains a README file with details how to run it and what to check.

---
<img src="http://swagger.io/wp-content/uploads/2016/02/logo.jpg"/>
25 changes: 25 additions & 0 deletions java/inflector-dropwizard-guice/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Dropwizard-Guice Inflector Sample

Simple example showing how to use the inflector with dropwizard and guice for DI.

Build with

```
mvn clean install
```

Run with

```
java -jar ./target/inflector-dropwizard-guice-sample-1.0.0-SNAPSHOT.jar server server.yml
```


You can get to the swagger file at:

```
http://localhost:8080/v2/swagger.json
```

Have fun!

11 changes: 11 additions & 0 deletions java/inflector-dropwizard-guice/inflector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
controllerPackage: io.swagger.samples.inflector.dropwizard.controllers
modelPackage: io.swagger.samples.inflector.dropwizard.models
swaggerUrl: ./src/main/swagger/swagger.yaml
modelMappings:
Pet: io.swagger.samples.inflector.dropwizard.models.Pet

# loads all by default, or pick and choose
entityProcessors:
- json
- xml
- yaml
176 changes: 176 additions & 0 deletions java/inflector-dropwizard-guice/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 SmartBear Software
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.swagger</groupId>
<artifactId>inflector-dropwizard-guice-sample</artifactId>
<version>1.0.0-SNAPSHOT</version>

<properties>
<dropwizard-version>0.8.2</dropwizard-version>
<inflector-version>1.0.2</inflector-version>
<jackson.version>2.5.1</jackson.version>
</properties>

<dependencies>

<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-inflector</artifactId>
<version>${inflector-version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>

<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard-version}</version>
</dependency>

<dependency>
<groupId>com.hubspot.dropwizard</groupId>
<artifactId>dropwizard-guice</artifactId>
<version>0.8.0</version>
<exclusions>
<exclusion>
<artifactId>javax.inject</artifactId>
<groupId>javax.inject</groupId>
</exclusion>
<exclusion>
<artifactId>jsr305</artifactId>
<groupId>com.google.code.findbugs</groupId>
</exclusion>
<exclusion>
<artifactId>annotations</artifactId>
<groupId>com.google.code.findbugs</groupId>
</exclusion>
<exclusion>
<artifactId>aopalliance</artifactId>
<groupId>aopalliance</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.0</version>
<exclusions>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
<exclusion>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
</exclusions>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>io.swagger.samples.inflector.dropwizard.InflectorServer</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
1 change: 1 addition & 0 deletions java/inflector-dropwizard-guice/server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config: inflector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.swagger.samples.inflector.dropwizard;

import com.fasterxml.jackson.databind.module.SimpleModule;
import com.google.inject.Injector;
import com.google.inject.Stage;
import com.hubspot.dropwizard.guice.GuiceBundle;
import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import io.swagger.inflector.SwaggerInflector;
import io.swagger.inflector.config.Configuration;
import io.swagger.inflector.config.ControllerFactory;
import io.swagger.inflector.processors.JsonNodeExampleSerializer;
import io.swagger.inflector.processors.XMLExampleProvider;
import io.swagger.jaxrs.listing.SwaggerSerializers;
import io.swagger.util.Json;
import io.swagger.util.Yaml;
import org.eclipse.jetty.servlets.CrossOriginFilter;
import org.slf4j.LoggerFactory;

import javax.servlet.DispatcherType;
import javax.servlet.FilterRegistration;
import java.util.EnumSet;

public class InflectorServer extends Application<InflectorServerConfiguration> {
private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(InflectorServer.class);
private GuiceBundle<InflectorServerConfiguration> guiceBundle;

public static void main(String[] args) throws Exception {
new InflectorServer().run(args);
}

@Override
public String getName() {
return "Inflector Dropwizard Sample";
}

@Override
public void initialize(Bootstrap<InflectorServerConfiguration> bootstrap) {
guiceBundle = GuiceBundle.<InflectorServerConfiguration>newBuilder()
.addModule(new InflectorServerModule())
.setConfigClass(InflectorServerConfiguration.class)
.build(Stage.DEVELOPMENT);

bootstrap.addBundle(guiceBundle);
}

@Override
public void run(InflectorServerConfiguration configuration, Environment environment) throws Exception {
final FilterRegistration.Dynamic cors = environment.servlets().addFilter("crossOriginRequsts", CrossOriginFilter.class);
cors.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");

Configuration config = Configuration.read(configuration.getConfig());
config.setControllerFactory(new GuiceControllerFactory(guiceBundle.getInjector()));
SwaggerInflector inflector = new SwaggerInflector(config);
environment.jersey().getResourceConfig().registerResources(inflector.getResources());

// add serializers for swagger
environment.jersey().register(SwaggerSerializers.class);

// example serializers
environment.jersey().register(XMLExampleProvider.class);

// mappers
SimpleModule simpleModule = new SimpleModule();
simpleModule.addSerializer(new JsonNodeExampleSerializer());
Json.mapper().registerModule(simpleModule);
Yaml.mapper().registerModule(simpleModule);
}

private static class GuiceControllerFactory implements ControllerFactory {
private final Injector injector;

public GuiceControllerFactory(Injector injector) {
this.injector = injector;
}

public Object instantiateController(Class cls) throws IllegalAccessException, InstantiationException {
return this.injector.getInstance(cls);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.swagger.samples.inflector.dropwizard;

import io.dropwizard.Configuration;

public class InflectorServerConfiguration extends Configuration {
private String config;

public String getConfig() {
return config;
}

public void setConfig(String config) {
this.config = config;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.swagger.samples.inflector.dropwizard;

import com.google.inject.AbstractModule;

public class InflectorServerModule extends AbstractModule {
@Override
protected void configure() {
// bind your guice stuff here
}
}
Loading