Skip to content

Commit fe22a9e

Browse files
authored
Merge pull request #9756 from swagger-api/update-resteasy-samples
refs swagger-api/swagger-codegen-generators#492 - update resteasy samples
2 parents 4b1ea6a + d2146a4 commit fe22a9e

File tree

64 files changed

+2166
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2166
-256
lines changed

bin/java-petstore-resteasy-all.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
./bin/jaxrs-resteasy-eap-petstore-server.sh
55
./bin/jaxrs-resteasy-eap-java8-petstore-server.sh
66
./bin/jaxrs-resteasy-joda-petstore-server.sh
7+
./bin/jaxrs-resteasy-java8-petstore-server.sh
78
./bin/jaxrs-resteasy-eap-joda-petstore-server.sh
8-
./bin/jaxrs-resteasy-petstore-server.sh*
9+
./bin/jaxrs-resteasy-petstore-server.sh*
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"dateLibrary": "java8"
3+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
5+
while [ -h "$SCRIPT" ] ; do
6+
ls=`ls -ld "$SCRIPT"`
7+
link=`expr "$ls" : '.*-> \(.*\)$'`
8+
if expr "$link" : '/.*' > /dev/null; then
9+
SCRIPT="$link"
10+
else
11+
SCRIPT=`dirname "$SCRIPT"`/"$link"
12+
fi
13+
done
14+
15+
if [ ! -d "${APP_DIR}" ]; then
16+
APP_DIR=`dirname "$SCRIPT"`/..
17+
APP_DIR=`cd "${APP_DIR}"; pwd`
18+
fi
19+
20+
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
21+
22+
if [ ! -f "$executable" ]
23+
then
24+
mvn clean package
25+
fi
26+
27+
# if you've executed sbt assembly previously it will use that instead.
28+
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
29+
ags="$@ generate --artifact-id swagger-jaxrs-resteasy-java8-server -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/java8 -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-java8-petstore-server.json"
30+
echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/java8/src/main"
31+
rm -rf samples/server/petstore/jaxrs-resteasy/java8/src/main
32+
find samples/server/petstore/jaxrs-resteasy/java8 -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
33+
34+
java $JAVA_OPTS -jar $executable $ags

bin/jaxrs-resteasy-joda-petstore-server.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@ fi
2727
# if you've executed sbt assembly previously it will use that instead.
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
2929
ags="$@ generate --artifact-id swagger-jaxrs-resteasy-joda-server -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/joda -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-joda-petstore-server.json"
30+
echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/joda/src/main"
31+
rm -rf samples/server/petstore/jaxrs-resteasy/joda/src/main
32+
find samples/server/petstore/jaxrs-resteasy/joda -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
3033

3134
java $JAVA_OPTS -jar $executable $ags

bin/jaxrs-resteasy-petstore-server.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@ fi
2727
# if you've executed sbt assembly previously it will use that instead.
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
2929
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/default -DhideGenerationTimestamp=true"
30+
echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/default/src/main"
31+
rm -rf samples/server/petstore/jaxrs-resteasy/default/src/main
32+
find samples/server/petstore/jaxrs-resteasy/default -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
3033

3134
java $JAVA_OPTS -jar $executable $ags
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.0-SNAPSHOT
1+
3.0.12-SNAPSHOT

samples/server/petstore/jaxrs-resteasy/default/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
<version>1.2</version>
118118
<scope>provided</scope>
119119
</dependency>
120-
121120
<dependency>
122121
<groupId>com.fasterxml.jackson.datatype</groupId>
123122
<artifactId>jackson-datatype-joda</artifactId>
@@ -184,5 +183,6 @@
184183
<slf4j-version>1.6.3</slf4j-version>
185184
<junit-version>4.8.1</junit-version>
186185
<servlet-api-version>2.5</servlet-api-version>
186+
187187
</properties>
188188
</project>

samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/JacksonConfig.java

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
import com.fasterxml.jackson.databind.ObjectMapper;
66
import com.fasterxml.jackson.databind.SerializerProvider;
77
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
8-
import com.fasterxml.jackson.datatype.joda.JodaModule;
9-
import org.joda.time.DateTime;
10-
import org.joda.time.LocalDate;
11-
import org.joda.time.format.ISODateTimeFormat;
128

139
import javax.ws.rs.ext.ContextResolver;
1410
import javax.ws.rs.ext.Provider;
@@ -21,27 +17,10 @@ public class JacksonConfig implements ContextResolver<ObjectMapper> {
2117
public JacksonConfig() throws Exception {
2218

2319
objectMapper = new ObjectMapper()
24-
.setDateFormat(new RFC3339DateFormat())
25-
.registerModule(new JodaModule() {
26-
{
27-
addSerializer(DateTime.class, new StdSerializer<DateTime>(DateTime.class) {
28-
@Override
29-
public void serialize(DateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
30-
jgen.writeString(ISODateTimeFormat.dateTimeNoMillis().print(value));
31-
}
32-
});
33-
addSerializer(LocalDate.class, new StdSerializer<LocalDate>(LocalDate.class) {
34-
@Override
35-
public void serialize(LocalDate value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
36-
jgen.writeString(ISODateTimeFormat.date().print(value));
37-
}
38-
});
39-
40-
}
41-
});
20+
.setDateFormat(new RFC3339DateFormat());
4221
}
4322

4423
public ObjectMapper getContext(Class<?> arg0) {
4524
return objectMapper;
4625
}
47-
}
26+
}

samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/PetApi.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Response addPet(@Parameter(description = "Pet object that needs to be add
6363
}, tags={ "pet" })
6464
@ApiResponses(value = {
6565
@ApiResponse(responseCode = "400", description = "Invalid pet value") })
66-
public Response deletePet( @PathParam("petId") Integer petId,@Parameter(description = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
66+
public Response deletePet( @PathParam("petId") Long petId,@Parameter(description = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
6767
throws NotFoundException {
6868
return service.deletePet(petId,apiKey,securityContext);
6969
}
@@ -114,7 +114,7 @@ public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,
114114
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
115115

116116
@ApiResponse(responseCode = "404", description = "Pet not found") })
117-
public Response getPetById( @PathParam("petId") Integer petId,@Context SecurityContext securityContext)
117+
public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
118118
throws NotFoundException {
119119
return service.getPetById(petId,securityContext);
120120
}
@@ -148,7 +148,7 @@ public Response updatePet(@Parameter(description = "Pet object that needs to be
148148
}, tags={ "pet" })
149149
@ApiResponses(value = {
150150
@ApiResponse(responseCode = "405", description = "Invalid input") })
151-
public Response updatePetWithForm( @PathParam("petId") Integer petId,@Parameter(description = "")@FormParam("name") String name,@Parameter(description = "")@FormParam("status") String status,@Context SecurityContext securityContext)
151+
public Response updatePetWithForm( @PathParam("petId") Long petId,@Parameter(description = "")@FormParam("name") String name,@Parameter(description = "")@FormParam("status") String status,@Context SecurityContext securityContext)
152152
throws NotFoundException {
153153
return service.updatePetWithForm(petId,name,status,securityContext);
154154
}
@@ -163,7 +163,7 @@ public Response updatePetWithForm( @PathParam("petId") Integer petId,@Parameter(
163163
}, tags={ "pet" })
164164
@ApiResponses(value = {
165165
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = ModelApiResponse.class))) })
166-
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Integer petId,@Context SecurityContext securityContext)
166+
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext)
167167
throws NotFoundException {
168168
return service.uploadFile(input,petId,securityContext);
169169
}

samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/PetApiService.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,20 @@
1717
import javax.ws.rs.core.SecurityContext;
1818

1919
public interface PetApiService {
20-
Response addPet(Pet body,SecurityContext securityContext) throws NotFoundException;
21-
Response deletePet(Integer petId,String apiKey,SecurityContext securityContext) throws NotFoundException;
22-
Response findPetsByStatus(List<String> status,SecurityContext securityContext) throws NotFoundException;
23-
Response findPetsByTags(List<String> tags,SecurityContext securityContext) throws NotFoundException;
24-
Response getPetById(Integer petId,SecurityContext securityContext) throws NotFoundException;
25-
Response updatePet(Pet body,SecurityContext securityContext) throws NotFoundException;
26-
Response updatePetWithForm(Integer petId,String name,String status,SecurityContext securityContext) throws NotFoundException;
27-
Response uploadFile(MultipartFormDataInput input,Integer petId,SecurityContext securityContext) throws NotFoundException;
20+
Response addPet(Pet body,SecurityContext securityContext)
21+
throws NotFoundException;
22+
Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
23+
throws NotFoundException;
24+
Response findPetsByStatus(List<String> status,SecurityContext securityContext)
25+
throws NotFoundException;
26+
Response findPetsByTags(List<String> tags,SecurityContext securityContext)
27+
throws NotFoundException;
28+
Response getPetById(Long petId,SecurityContext securityContext)
29+
throws NotFoundException;
30+
Response updatePet(Pet body,SecurityContext securityContext)
31+
throws NotFoundException;
32+
Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
33+
throws NotFoundException;
34+
Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
35+
throws NotFoundException;
2836
}

0 commit comments

Comments
 (0)