Skip to content

Commit f77a867

Browse files
committed
Merge pull request #2011 from nickcmaynard/defaultvalue
Only define @DefaultValue if it's specified in the swagger spec
2 parents b2d98ac + 943c66a commit f77a867

19 files changed

+97
-70
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @DefaultValue("{{defaultValue}}") @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
1+
{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}

samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.swagger.api;
22

3-
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
3+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
44
public class ApiException extends Exception{
55
private int code;
66
public ApiException (int code, String msg) {

samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import javax.servlet.*;
66
import javax.servlet.http.HttpServletResponse;
77

8-
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
8+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
99
public class ApiOriginFilter implements javax.servlet.Filter {
1010
public void doFilter(ServletRequest request, ServletResponse response,
1111
FilterChain chain) throws IOException, ServletException {

samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import javax.xml.bind.annotation.XmlTransient;
44

55
@javax.xml.bind.annotation.XmlRootElement
6-
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
6+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
77
public class ApiResponseMessage {
88
public static final int ERROR = 1;
99
public static final int WARNING = 2;

samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.swagger.api;
22

3-
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
3+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
44
public class NotFoundException extends ApiException {
55
private int code;
66
public NotFoundException (int code, String msg) {

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

+36-22
Original file line numberDiff line numberDiff line change
@@ -28,45 +28,47 @@
2828

2929

3030
@io.swagger.annotations.Api(description = "the pet API")
31-
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
31+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
3232
public class PetApi {
3333
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
3434

3535
@PUT
3636

3737
@Consumes({ "application/json", "application/xml" })
3838
@Produces({ "application/json", "application/xml" })
39-
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = {
39+
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = void.class, authorizations = {
4040
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
4141
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
4242
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
4343
})
4444
}, tags={ "pet", })
4545
@io.swagger.annotations.ApiResponses(value = {
46-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
46+
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
4747

48-
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class),
48+
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class),
4949

50-
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) })
50+
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = void.class) })
5151

52-
public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body,@Context SecurityContext securityContext)
52+
public Response updatePet(
53+
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body,@Context SecurityContext securityContext)
5354
throws NotFoundException {
5455
return delegate.updatePet(body,securityContext);
5556
}
5657
@POST
5758

5859
@Consumes({ "application/json", "application/xml" })
5960
@Produces({ "application/json", "application/xml" })
60-
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
61+
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = void.class, authorizations = {
6162
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
6263
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
6364
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
6465
})
6566
}, tags={ "pet", })
6667
@io.swagger.annotations.ApiResponses(value = {
67-
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
68+
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
6869

69-
public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body,@Context SecurityContext securityContext)
70+
public Response addPet(
71+
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body,@Context SecurityContext securityContext)
7072
throws NotFoundException {
7173
return delegate.addPet(body,securityContext);
7274
}
@@ -85,7 +87,8 @@ public Response addPet(@ApiParam(value = "Pet object that needs to be added to t
8587

8688
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") })
8789

88-
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue="available") @QueryParam("status") List<String> status,@Context SecurityContext securityContext)
90+
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue="available") @DefaultValue("available") @QueryParam("status") List<String> status
91+
,@Context SecurityContext securityContext)
8992
throws NotFoundException {
9093
return delegate.findPetsByStatus(status,securityContext);
9194
}
@@ -104,7 +107,8 @@ public Response findPetsByStatus(@ApiParam(value = "Status values that need to b
104107

105108
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "List") })
106109

107-
public Response findPetsByTags(@ApiParam(value = "Tags to filter by") @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext)
110+
public Response findPetsByTags(@ApiParam(value = "Tags to filter by") @QueryParam("tags") List<String> tags
111+
,@Context SecurityContext securityContext)
108112
throws NotFoundException {
109113
return delegate.findPetsByTags(tags,securityContext);
110114
}
@@ -122,58 +126,67 @@ public Response findPetsByTags(@ApiParam(value = "Tags to filter by") @QueryPara
122126

123127
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
124128

125-
public Response getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("petId") Long petId,@Context SecurityContext securityContext)
129+
public Response getPetById(
130+
@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("petId") Long petId,@Context SecurityContext securityContext)
126131
throws NotFoundException {
127132
return delegate.getPetById(petId,securityContext);
128133
}
129134
@POST
130135
@Path("/{petId}")
131136
@Consumes({ "application/x-www-form-urlencoded" })
132137
@Produces({ "application/json", "application/xml" })
133-
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {
138+
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = void.class, authorizations = {
134139
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
135140
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
136141
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
137142
})
138143
}, tags={ "pet", })
139144
@io.swagger.annotations.ApiResponses(value = {
140-
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
145+
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
141146

142-
public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") String petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext)
147+
public Response updatePetWithForm(
148+
@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") String petId,
149+
@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,
150+
@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext)
143151
throws NotFoundException {
144152
return delegate.updatePetWithForm(petId,name,status,securityContext);
145153
}
146154
@DELETE
147155
@Path("/{petId}")
148156

149157
@Produces({ "application/json", "application/xml" })
150-
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
158+
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = void.class, authorizations = {
151159
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
152160
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
153161
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
154162
})
155163
}, tags={ "pet", })
156164
@io.swagger.annotations.ApiResponses(value = {
157-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
165+
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = void.class) })
158166

159-
public Response deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
167+
public Response deletePet(
168+
@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId,
169+
@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
160170
throws NotFoundException {
161171
return delegate.deletePet(petId,apiKey,securityContext);
162172
}
163173
@POST
164174
@Path("/{petId}/uploadImage")
165175
@Consumes({ "multipart/form-data" })
166176
@Produces({ "application/json", "application/xml" })
167-
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = {
177+
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = void.class, authorizations = {
168178
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
169179
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
170180
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
171181
})
172182
}, tags={ "pet", })
173183
@io.swagger.annotations.ApiResponses(value = {
174-
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
184+
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) })
175185

176-
public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId,@ApiParam(value = "Additional data to pass to server")@FormParam("additionalMetadata") String additionalMetadata, @FormDataParam("file") InputStream inputStream,
186+
public Response uploadFile(
187+
@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId,
188+
@ApiParam(value = "Additional data to pass to server")@FormParam("additionalMetadata") String additionalMetadata,
189+
@FormDataParam("file") InputStream inputStream,
177190
@FormDataParam("file") FormDataContentDisposition fileDetail,@Context SecurityContext securityContext)
178191
throws NotFoundException {
179192
return delegate.uploadFile(petId,additionalMetadata,inputStream, fileDetail,securityContext);
@@ -192,7 +205,8 @@ public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true
192205

193206
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = byte[].class) })
194207

195-
public Response getPetByIdWithByteArray(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("petId") Long petId,@Context SecurityContext securityContext)
208+
public Response getPetByIdWithByteArray(
209+
@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("petId") Long petId,@Context SecurityContext securityContext)
196210
throws NotFoundException {
197211
return delegate.getPetByIdWithByteArray(petId,securityContext);
198212
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import javax.ws.rs.core.Response;
2020
import javax.ws.rs.core.SecurityContext;
2121

22-
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
22+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
2323
public abstract class PetApiService {
2424

2525
public abstract Response updatePet(Pet body,SecurityContext securityContext)

samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PettestingByteArraytrueApi.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,25 @@
2626

2727

2828
@io.swagger.annotations.Api(description = "the pet?testing_byte_array=true API")
29-
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
29+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
3030
public class PettestingByteArraytrueApi {
3131
private final PettestingByteArraytrueApiService delegate = PettestingByteArraytrueApiServiceFactory.getPettestingByteArraytrueApi();
3232

3333
@POST
3434

3535
@Consumes({ "application/json", "application/xml" })
3636
@Produces({ "application/json", "application/xml" })
37-
@io.swagger.annotations.ApiOperation(value = "Fake endpoint to test byte array in body parameter for adding a new pet to the store", notes = "", response = Void.class, authorizations = {
37+
@io.swagger.annotations.ApiOperation(value = "Fake endpoint to test byte array in body parameter for adding a new pet to the store", notes = "", response = void.class, authorizations = {
3838
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
3939
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
4040
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
4141
})
4242
}, tags={ "pet" })
4343
@io.swagger.annotations.ApiResponses(value = {
44-
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
44+
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) })
4545

46-
public Response addPetUsingByteArray(@ApiParam(value = "Pet object in the form of byte array" ) byte[] body,@Context SecurityContext securityContext)
46+
public Response addPetUsingByteArray(
47+
@ApiParam(value = "Pet object in the form of byte array" ) byte[] body,@Context SecurityContext securityContext)
4748
throws NotFoundException {
4849
return delegate.addPetUsingByteArray(body,securityContext);
4950
}

samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PettestingByteArraytrueApiService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import javax.ws.rs.core.Response;
1818
import javax.ws.rs.core.SecurityContext;
1919

20-
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2016-01-14T21:37:36.074Z")
20+
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-01-31T21:10:14.319Z")
2121
public abstract class PettestingByteArraytrueApiService {
2222

2323
public abstract Response addPetUsingByteArray(byte[] body,SecurityContext securityContext)

0 commit comments

Comments
 (0)