Skip to content

Commit dee3f28

Browse files
authored
Merge pull request #8594 from swagger-api/resteasy-sample-tweaks
Resteasy sample tweaks
2 parents 9544f72 + 10f7f23 commit dee3f28

File tree

25 files changed

+916
-40
lines changed

25 files changed

+916
-40
lines changed

modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy/eap/pom.mustache

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</plugin>
2626
<plugin>
2727
<artifactId>maven-failsafe-plugin</artifactId>
28-
<version>2.6</version>
28+
<version>2.18.1</version>
2929
<executions>
3030
<execution>
3131
<goals>
@@ -35,6 +35,40 @@
3535
</execution>
3636
</executions>
3737
</plugin>
38+
<plugin>
39+
<groupId>org.eclipse.jetty</groupId>
40+
<artifactId>jetty-maven-plugin</artifactId>
41+
<version>${jetty-version}</version>
42+
<configuration>
43+
<webApp>
44+
<contextPath>/</contextPath>
45+
</webApp>
46+
<scanIntervalSeconds>10</scanIntervalSeconds>
47+
<stopKey>alpha</stopKey>
48+
<stopPort>9099</stopPort>
49+
<stopWait>2</stopWait>
50+
</configuration>
51+
<executions>
52+
<execution>
53+
<id>start-jetty</id>
54+
<phase>pre-integration-test</phase>
55+
<goals>
56+
<goal>start</goal>
57+
</goals>
58+
<configuration>
59+
<scanIntervalSeconds>0</scanIntervalSeconds>
60+
<daemon>true</daemon>
61+
</configuration>
62+
</execution>
63+
<execution>
64+
<id>stop-jetty</id>
65+
<phase>post-integration-test</phase>
66+
<goals>
67+
<goal>stop</goal>
68+
</goals>
69+
</execution>
70+
</executions>
71+
</plugin>
3872
<plugin>
3973
<groupId>org.codehaus.mojo</groupId>
4074
<artifactId>build-helper-maven-plugin</artifactId>
@@ -67,44 +101,42 @@
67101
<groupId>javax.servlet</groupId>
68102
<artifactId>servlet-api</artifactId>
69103
<version>${servlet-api-version}</version>
70-
<scope>provided</scope>
71104
</dependency>
72105

73106
<dependency>
74107
<groupId>org.jboss.resteasy</groupId>
75108
<artifactId>resteasy-jaxrs</artifactId>
76109
<version>${resteasy-version}</version>
77-
<scope>provided</scope>
110+
</dependency>
111+
<dependency>
112+
<groupId>org.jboss.resteasy</groupId>
113+
<artifactId>resteasy-servlet-initializer</artifactId>
114+
<version>${resteasy-version}</version>
78115
</dependency>
79116
<dependency>
80117
<groupId>org.jboss.resteasy</groupId>
81118
<artifactId>jaxrs-api</artifactId>
82119
<version>${resteasy-version}</version>
83-
<scope>provided</scope>
84120
</dependency>
85121
<dependency>
86122
<groupId>org.jboss.resteasy</groupId>
87123
<artifactId>resteasy-validator-provider-11</artifactId>
88124
<version>${resteasy-version}</version>
89-
<scope>provided</scope>
90125
</dependency>
91126
<dependency>
92127
<groupId>org.jboss.resteasy</groupId>
93128
<artifactId>resteasy-multipart-provider</artifactId>
94129
<version>${resteasy-version}</version>
95-
<scope>provided</scope>
96130
</dependency>
97131
<dependency>
98132
<groupId>org.jboss.resteasy</groupId>
99133
<artifactId>resteasy-jackson2-provider</artifactId>
100134
<version>${resteasy-version}</version>
101-
<scope>provided</scope>
102135
</dependency>
103136
<dependency>
104137
<groupId>javax.annotation</groupId>
105138
<artifactId>javax.annotation-api</artifactId>
106139
<version>1.2</version>
107-
<scope>provided</scope>
108140
</dependency>
109141

110142
<dependency>
@@ -144,7 +176,6 @@
144176
<groupId>javax.validation</groupId>
145177
<artifactId>validation-api</artifactId>
146178
<version>1.1.0.Final</version>
147-
<scope>provided</scope>
148179
</dependency>
149180
{{/useBeanValidation}}
150181
{{^java8}}
@@ -166,7 +197,27 @@
166197
<version>2.6.3</version>
167198
</dependency>
168199
{{/java8}}
169-
200+
<dependency>
201+
<groupId>com.fasterxml.jackson.core</groupId>
202+
<artifactId>jackson-databind</artifactId>
203+
<version>2.6.3</version>
204+
</dependency>
205+
<dependency>
206+
<groupId>com.fasterxml.jackson.core</groupId>
207+
<artifactId>jackson-core</artifactId>
208+
<version>2.6.3</version>
209+
</dependency>
210+
<dependency>
211+
<groupId>com.fasterxml.jackson.core</groupId>
212+
<artifactId>jackson-annotations</artifactId>
213+
<version>2.6.3</version>
214+
</dependency>
215+
<dependency>
216+
<groupId>org.apache.httpcomponents</groupId>
217+
<artifactId>httpclient</artifactId>
218+
<version>4.5.2</version>
219+
<scope>test</scope>
220+
</dependency>
170221
</dependencies>
171222
<repositories>
172223
<repository>

samples/server/petstore/jaxrs-resteasy/eap-java8/pom.xml

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</plugin>
2626
<plugin>
2727
<artifactId>maven-failsafe-plugin</artifactId>
28-
<version>2.6</version>
28+
<version>2.18.1</version>
2929
<executions>
3030
<execution>
3131
<goals>
@@ -35,6 +35,40 @@
3535
</execution>
3636
</executions>
3737
</plugin>
38+
<plugin>
39+
<groupId>org.eclipse.jetty</groupId>
40+
<artifactId>jetty-maven-plugin</artifactId>
41+
<version>${jetty-version}</version>
42+
<configuration>
43+
<webApp>
44+
<contextPath>/</contextPath>
45+
</webApp>
46+
<scanIntervalSeconds>10</scanIntervalSeconds>
47+
<stopKey>alpha</stopKey>
48+
<stopPort>9099</stopPort>
49+
<stopWait>2</stopWait>
50+
</configuration>
51+
<executions>
52+
<execution>
53+
<id>start-jetty</id>
54+
<phase>pre-integration-test</phase>
55+
<goals>
56+
<goal>start</goal>
57+
</goals>
58+
<configuration>
59+
<scanIntervalSeconds>0</scanIntervalSeconds>
60+
<daemon>true</daemon>
61+
</configuration>
62+
</execution>
63+
<execution>
64+
<id>stop-jetty</id>
65+
<phase>post-integration-test</phase>
66+
<goals>
67+
<goal>stop</goal>
68+
</goals>
69+
</execution>
70+
</executions>
71+
</plugin>
3872
<plugin>
3973
<groupId>org.codehaus.mojo</groupId>
4074
<artifactId>build-helper-maven-plugin</artifactId>
@@ -67,44 +101,42 @@
67101
<groupId>javax.servlet</groupId>
68102
<artifactId>servlet-api</artifactId>
69103
<version>${servlet-api-version}</version>
70-
<scope>provided</scope>
71104
</dependency>
72105

73106
<dependency>
74107
<groupId>org.jboss.resteasy</groupId>
75108
<artifactId>resteasy-jaxrs</artifactId>
76109
<version>${resteasy-version}</version>
77-
<scope>provided</scope>
110+
</dependency>
111+
<dependency>
112+
<groupId>org.jboss.resteasy</groupId>
113+
<artifactId>resteasy-servlet-initializer</artifactId>
114+
<version>${resteasy-version}</version>
78115
</dependency>
79116
<dependency>
80117
<groupId>org.jboss.resteasy</groupId>
81118
<artifactId>jaxrs-api</artifactId>
82119
<version>${resteasy-version}</version>
83-
<scope>provided</scope>
84120
</dependency>
85121
<dependency>
86122
<groupId>org.jboss.resteasy</groupId>
87123
<artifactId>resteasy-validator-provider-11</artifactId>
88124
<version>${resteasy-version}</version>
89-
<scope>provided</scope>
90125
</dependency>
91126
<dependency>
92127
<groupId>org.jboss.resteasy</groupId>
93128
<artifactId>resteasy-multipart-provider</artifactId>
94129
<version>${resteasy-version}</version>
95-
<scope>provided</scope>
96130
</dependency>
97131
<dependency>
98132
<groupId>org.jboss.resteasy</groupId>
99133
<artifactId>resteasy-jackson2-provider</artifactId>
100134
<version>${resteasy-version}</version>
101-
<scope>provided</scope>
102135
</dependency>
103136
<dependency>
104137
<groupId>javax.annotation</groupId>
105138
<artifactId>javax.annotation-api</artifactId>
106139
<version>1.2</version>
107-
<scope>provided</scope>
108140
</dependency>
109141

110142
<dependency>
@@ -143,14 +175,33 @@
143175
<groupId>javax.validation</groupId>
144176
<artifactId>validation-api</artifactId>
145177
<version>1.1.0.Final</version>
146-
<scope>provided</scope>
147178
</dependency>
148179
<dependency>
149180
<groupId>com.fasterxml.jackson.datatype</groupId>
150181
<artifactId>jackson-datatype-jsr310</artifactId>
151182
<version>2.6.3</version>
152183
</dependency>
153-
184+
<dependency>
185+
<groupId>com.fasterxml.jackson.core</groupId>
186+
<artifactId>jackson-databind</artifactId>
187+
<version>2.6.3</version>
188+
</dependency>
189+
<dependency>
190+
<groupId>com.fasterxml.jackson.core</groupId>
191+
<artifactId>jackson-core</artifactId>
192+
<version>2.6.3</version>
193+
</dependency>
194+
<dependency>
195+
<groupId>com.fasterxml.jackson.core</groupId>
196+
<artifactId>jackson-annotations</artifactId>
197+
<version>2.6.3</version>
198+
</dependency>
199+
<dependency>
200+
<groupId>org.apache.httpcomponents</groupId>
201+
<artifactId>httpclient</artifactId>
202+
<version>4.5.2</version>
203+
<scope>test</scope>
204+
</dependency>
154205
</dependencies>
155206
<repositories>
156207
<repository>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package io.swagger.model;
2+
3+
import java.util.Objects;
4+
import java.util.ArrayList;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import com.fasterxml.jackson.annotation.JsonCreator;
7+
import io.swagger.annotations.ApiModel;
8+
import io.swagger.annotations.ApiModelProperty;
9+
import javax.validation.constraints.*;
10+
import io.swagger.annotations.*;
11+
12+
@ApiModel(description="some description ")
13+
14+
public class Amount {
15+
16+
private Double value = null;
17+
private String currency = null;
18+
19+
/**
20+
* some description
21+
* minimum: 0.01
22+
* maximum: 1000000000000000
23+
**/
24+
25+
@ApiModelProperty(required = true, value = "some description ")
26+
@JsonProperty("value")
27+
@NotNull
28+
@DecimalMin("0.01")
29+
@DecimalMax("1000000000000000")
30+
public Double getValue() {
31+
return value;
32+
}
33+
public void setValue(Double value) {
34+
this.value = value;
35+
}
36+
37+
/**
38+
**/
39+
40+
@ApiModelProperty(required = true, value = "")
41+
@JsonProperty("currency")
42+
@NotNull
43+
@Pattern(regexp="^[A-Z]{3,3}$")
44+
public String getCurrency() {
45+
return currency;
46+
}
47+
public void setCurrency(String currency) {
48+
this.currency = currency;
49+
}
50+
51+
52+
@Override
53+
public boolean equals(Object o) {
54+
if (this == o) {
55+
return true;
56+
}
57+
if (o == null || getClass() != o.getClass()) {
58+
return false;
59+
}
60+
Amount amount = (Amount) o;
61+
return Objects.equals(value, amount.value) &&
62+
Objects.equals(currency, amount.currency);
63+
}
64+
65+
@Override
66+
public int hashCode() {
67+
return Objects.hash(value, currency);
68+
}
69+
70+
@Override
71+
public String toString() {
72+
StringBuilder sb = new StringBuilder();
73+
sb.append("class Amount {\n");
74+
75+
sb.append(" value: ").append(toIndentedString(value)).append("\n");
76+
sb.append(" currency: ").append(toIndentedString(currency)).append("\n");
77+
sb.append("}");
78+
return sb.toString();
79+
}
80+
81+
/**
82+
* Convert the given object to string with each line indented by 4 spaces
83+
* (except the first line).
84+
*/
85+
private String toIndentedString(Object o) {
86+
if (o == null) {
87+
return "null";
88+
}
89+
return o.toString().replace("\n", "\n ");
90+
}
91+
}
92+

0 commit comments

Comments
 (0)