mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 11:23:58 +00:00
Merge pull request #1392 from nbruno/add-auth-annotations-jaxrs
Add authorization scope data to CodegenSecurity
This commit is contained in:
commit
4ea797d0e8
@ -10,7 +10,7 @@ import java.util.Set;
|
||||
|
||||
public class CodegenOperation {
|
||||
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
||||
public Boolean hasConsumes, hasProduces, hasParams, returnTypeIsPrimitive,
|
||||
public Boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, returnTypeIsPrimitive,
|
||||
returnSimpleType, subresourceOperation, isMapContainer, isListContainer,
|
||||
hasMore = Boolean.TRUE, isMultipart, isResponseBinary = Boolean.FALSE;
|
||||
public String path, operationId, returnType, httpMethod, returnBaseType,
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.swagger.codegen;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CodegenSecurity {
|
||||
public String name;
|
||||
@ -11,5 +12,5 @@ public class CodegenSecurity {
|
||||
public Boolean isKeyInQuery, isKeyInHeader;
|
||||
// Oauth specific
|
||||
public String flow, authorizationUrl, tokenUrl;
|
||||
public Set<String> scopes;
|
||||
public List<Map<String, Object>> scopes;
|
||||
}
|
||||
|
@ -1346,7 +1346,23 @@ public class DefaultCodegen {
|
||||
sec.authorizationUrl = oauth2Definition.getAuthorizationUrl();
|
||||
sec.tokenUrl = oauth2Definition.getTokenUrl();
|
||||
if (oauth2Definition.getScopes() != null) {
|
||||
sec.scopes = oauth2Definition.getScopes().keySet();
|
||||
List<Map<String, Object>> scopes = new ArrayList<Map<String, Object>>();
|
||||
int count = 0, numScopes = oauth2Definition.getScopes().size();
|
||||
for(Map.Entry<String, String> scopeEntry : oauth2Definition.getScopes().entrySet()) {
|
||||
Map<String, Object> scope = new HashMap<String, Object>();
|
||||
scope.put("scope", scopeEntry.getKey());
|
||||
scope.put("description", scopeEntry.getValue());
|
||||
|
||||
count += 1;
|
||||
if (count < numScopes) {
|
||||
scope.put("hasMore", "true");
|
||||
} else {
|
||||
scope.put("hasMore", null);
|
||||
}
|
||||
|
||||
scopes.add(scope);
|
||||
}
|
||||
sec.scopes = scopes;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,6 +519,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
if (!authMethods.isEmpty()) {
|
||||
co.authMethods = config.fromSecurity(authMethods);
|
||||
co.hasAuthMethods = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
@ -54,7 +54,7 @@ public class ApiClient {
|
||||
if (authName == "{{name}}") { {{#isBasic}}
|
||||
auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}}
|
||||
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}}
|
||||
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{^-first}}, {{/-first}}{{this}}{{/scopes}}");{{/isOAuth}}
|
||||
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}}
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
@ -37,7 +37,13 @@ public class {{classname}} {
|
||||
{{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}}
|
||||
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
|
||||
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
|
||||
@io.swagger.annotations.ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}})
|
||||
@io.swagger.annotations.ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
|
||||
{{#authMethods}}@io.swagger.annotations.Authorization(value = "{{name}}"{{#isOAuth}}, scopes = {
|
||||
{{#scopes}}@io.swagger.annotations.AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
|
||||
{{/hasMore}}{{/scopes}}
|
||||
}{{/isOAuth}}){{#hasMore}},
|
||||
{{/hasMore}}{{/authMethods}}
|
||||
}{{/hasAuthMethods}})
|
||||
@io.swagger.annotations.ApiResponses(value = { {{#responses}}
|
||||
@io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}},
|
||||
{{/hasMore}}{{/responses}} })
|
||||
|
@ -10,6 +10,8 @@ import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
import io.swagger.annotations.AuthorizationScope;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -35,7 +37,13 @@ import static org.springframework.http.MediaType.*;
|
||||
public class {{classname}} {
|
||||
{{#operation}}
|
||||
|
||||
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}})
|
||||
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
|
||||
{{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = {
|
||||
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
|
||||
{{/hasMore}}{{/scopes}}
|
||||
}{{/isOAuth}}){{#hasMore}},
|
||||
{{/hasMore}}{{/authMethods}}
|
||||
}{{/hasAuthMethods}})
|
||||
@ApiResponses(value = { {{#responses}}
|
||||
@ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},{{/hasMore}}{{/responses}} })
|
||||
@RequestMapping(value = "{{path}}",
|
||||
|
@ -1,10 +1,8 @@
|
||||
# Swagger generated server
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
is an example of building a swagger-enabled scalatra server.
|
||||
is an example of building a swagger-enabled JAX-RS server.
|
||||
|
||||
This example uses the [scalatra](http://scalatra.org/) framework. To see how to make this your own, look here:
|
||||
|
||||
[README](https://github.com/swagger-api/swagger-codegen/tree/master/samples/server-generator/scalatra)
|
||||
This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework.
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class ApiException extends Exception{
|
||||
private int code;
|
||||
public ApiException (int code, String msg) {
|
||||
|
@ -5,7 +5,7 @@ import java.io.IOException;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class ApiOriginFilter implements javax.servlet.Filter {
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
|
@ -3,7 +3,7 @@ package io.swagger.api;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@javax.xml.bind.annotation.XmlRootElement
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class ApiResponseMessage {
|
||||
public static final int ERROR = 1;
|
||||
public static final int WARNING = 2;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class NotFoundException extends ApiException {
|
||||
private int code;
|
||||
public NotFoundException (int code, String msg) {
|
||||
|
@ -26,7 +26,7 @@ import javax.ws.rs.*;
|
||||
|
||||
|
||||
@io.swagger.annotations.Api(value = "/pet", description = "the pet API")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class PetApi {
|
||||
|
||||
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
|
||||
@ -35,35 +35,50 @@ public class PetApi {
|
||||
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class)
|
||||
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class) })
|
||||
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) })
|
||||
|
||||
public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePet(body);
|
||||
return delegate.updatePet(body);
|
||||
}
|
||||
@POST
|
||||
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class)
|
||||
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
|
||||
|
||||
public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
|
||||
throws NotFoundException {
|
||||
return delegate.addPet(body);
|
||||
return delegate.addPet(body);
|
||||
}
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List")
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
|
||||
@ -71,13 +86,18 @@ public class PetApi {
|
||||
|
||||
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue="available") @QueryParam("status") List<String> status)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByStatus(status);
|
||||
return delegate.findPetsByStatus(status);
|
||||
}
|
||||
@GET
|
||||
@Path("/findByTags")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List")
|
||||
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
|
||||
@ -85,29 +105,40 @@ public class PetApi {
|
||||
|
||||
public Response findPetsByTags(@ApiParam(value = "Tags to filter by") @QueryParam("tags") List<String> tags)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByTags(tags);
|
||||
return delegate.findPetsByTags(tags);
|
||||
}
|
||||
@GET
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class)
|
||||
@io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "api_key"),
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class) })
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
|
||||
|
||||
public Response getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathParam("petId") Long petId)
|
||||
throws NotFoundException {
|
||||
return delegate.getPetById(petId);
|
||||
return delegate.getPetById(petId);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class)
|
||||
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
|
||||
|
||||
@ -115,26 +146,36 @@ public class PetApi {
|
||||
@ApiParam(value = "Updated name of the pet" )@FormParam("name") String name,
|
||||
@ApiParam(value = "Updated status of the pet" )@FormParam("status") String status)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePetWithForm(petId,name,status);
|
||||
return delegate.updatePetWithForm(petId,name,status);
|
||||
}
|
||||
@DELETE
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class)
|
||||
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
|
||||
|
||||
public Response deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathParam("petId") Long petId,
|
||||
@ApiParam(value = "" )@HeaderParam("api_key") String apiKey)
|
||||
throws NotFoundException {
|
||||
return delegate.deletePet(petId,apiKey);
|
||||
return delegate.deletePet(petId,apiKey);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}/uploadImage")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = Void.class)
|
||||
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||
|
||||
@ -143,7 +184,7 @@ public class PetApi {
|
||||
@FormDataParam("file") InputStream inputStream,
|
||||
@FormDataParam("file") FormDataContentDisposition fileDetail)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(petId,additionalMetadata,fileDetail);
|
||||
return delegate.uploadFile(petId,additionalMetadata,fileDetail);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ import com.sun.jersey.multipart.FormDataParam;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public abstract class PetApiService {
|
||||
|
||||
public abstract Response updatePet(Pet body)
|
||||
|
@ -26,7 +26,7 @@ import javax.ws.rs.*;
|
||||
|
||||
|
||||
@io.swagger.annotations.Api(value = "/store", description = "the store API")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class StoreApi {
|
||||
|
||||
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
|
||||
@ -35,13 +35,15 @@ public class StoreApi {
|
||||
@Path("/inventory")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map")
|
||||
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
|
||||
@io.swagger.annotations.Authorization(value = "api_key")
|
||||
})
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class, responseContainer = "Map") })
|
||||
|
||||
public Response getInventory()
|
||||
throws NotFoundException {
|
||||
return delegate.getInventory();
|
||||
return delegate.getInventory();
|
||||
}
|
||||
@POST
|
||||
@Path("/order")
|
||||
@ -55,7 +57,7 @@ public class StoreApi {
|
||||
|
||||
public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ) Order body)
|
||||
throws NotFoundException {
|
||||
return delegate.placeOrder(body);
|
||||
return delegate.placeOrder(body);
|
||||
}
|
||||
@GET
|
||||
@Path("/order/{orderId}")
|
||||
@ -63,15 +65,15 @@ public class StoreApi {
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class)
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class) })
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) })
|
||||
|
||||
public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathParam("orderId") String orderId)
|
||||
throws NotFoundException {
|
||||
return delegate.getOrderById(orderId);
|
||||
return delegate.getOrderById(orderId);
|
||||
}
|
||||
@DELETE
|
||||
@Path("/order/{orderId}")
|
||||
@ -79,13 +81,13 @@ public class StoreApi {
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class)
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class) })
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
|
||||
|
||||
public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathParam("orderId") String orderId)
|
||||
throws NotFoundException {
|
||||
return delegate.deleteOrder(orderId);
|
||||
return delegate.deleteOrder(orderId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ import com.sun.jersey.multipart.FormDataParam;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public abstract class StoreApiService {
|
||||
|
||||
public abstract Response getInventory()
|
||||
|
@ -26,7 +26,7 @@ import javax.ws.rs.*;
|
||||
|
||||
|
||||
@io.swagger.annotations.Api(value = "/user", description = "the user API")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class UserApi {
|
||||
|
||||
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
|
||||
@ -41,7 +41,7 @@ public class UserApi {
|
||||
|
||||
public Response createUser(@ApiParam(value = "Created user object" ) User body)
|
||||
throws NotFoundException {
|
||||
return delegate.createUser(body);
|
||||
return delegate.createUser(body);
|
||||
}
|
||||
@POST
|
||||
@Path("/createWithArray")
|
||||
@ -53,7 +53,7 @@ public class UserApi {
|
||||
|
||||
public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ) List<User> body)
|
||||
throws NotFoundException {
|
||||
return delegate.createUsersWithArrayInput(body);
|
||||
return delegate.createUsersWithArrayInput(body);
|
||||
}
|
||||
@POST
|
||||
@Path("/createWithList")
|
||||
@ -65,7 +65,7 @@ public class UserApi {
|
||||
|
||||
public Response createUsersWithListInput(@ApiParam(value = "List of user object" ) List<User> body)
|
||||
throws NotFoundException {
|
||||
return delegate.createUsersWithListInput(body);
|
||||
return delegate.createUsersWithListInput(body);
|
||||
}
|
||||
@GET
|
||||
@Path("/login")
|
||||
@ -80,7 +80,7 @@ public class UserApi {
|
||||
public Response loginUser(@ApiParam(value = "The user name for login") @QueryParam("username") String username,
|
||||
@ApiParam(value = "The password for login in clear text") @QueryParam("password") String password)
|
||||
throws NotFoundException {
|
||||
return delegate.loginUser(username,password);
|
||||
return delegate.loginUser(username,password);
|
||||
}
|
||||
@GET
|
||||
@Path("/logout")
|
||||
@ -92,7 +92,7 @@ public class UserApi {
|
||||
|
||||
public Response logoutUser()
|
||||
throws NotFoundException {
|
||||
return delegate.logoutUser();
|
||||
return delegate.logoutUser();
|
||||
}
|
||||
@GET
|
||||
@Path("/{username}")
|
||||
@ -100,15 +100,15 @@ public class UserApi {
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class)
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class) })
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) })
|
||||
|
||||
public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathParam("username") String username)
|
||||
public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true ) @PathParam("username") String username)
|
||||
throws NotFoundException {
|
||||
return delegate.getUserByName(username);
|
||||
return delegate.getUserByName(username);
|
||||
}
|
||||
@PUT
|
||||
@Path("/{username}")
|
||||
@ -116,14 +116,14 @@ public class UserApi {
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class)
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class) })
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
|
||||
|
||||
public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathParam("username") String username,
|
||||
@ApiParam(value = "Updated user object" ) User body)
|
||||
throws NotFoundException {
|
||||
return delegate.updateUser(username,body);
|
||||
return delegate.updateUser(username,body);
|
||||
}
|
||||
@DELETE
|
||||
@Path("/{username}")
|
||||
@ -131,13 +131,13 @@ public class UserApi {
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class)
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class) })
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
|
||||
|
||||
public Response deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathParam("username") String username)
|
||||
throws NotFoundException {
|
||||
return delegate.deleteUser(username);
|
||||
return delegate.deleteUser(username);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ import com.sun.jersey.multipart.FormDataParam;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public abstract class UserApiService {
|
||||
|
||||
public abstract Response createUser(User body)
|
||||
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T23:29:16.812-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-16T21:16:23.957-04:00")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class ApiException extends Exception{
|
||||
private int code;
|
||||
public ApiException (int code, String msg) {
|
||||
|
@ -5,7 +5,7 @@ import java.io.IOException;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class ApiOriginFilter implements javax.servlet.Filter {
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
|
@ -3,7 +3,7 @@ package io.swagger.api;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@javax.xml.bind.annotation.XmlRootElement
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class ApiResponseMessage {
|
||||
public static final int ERROR = 1;
|
||||
public static final int WARNING = 2;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.api;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class NotFoundException extends ApiException {
|
||||
private int code;
|
||||
public NotFoundException (int code, String msg) {
|
||||
|
@ -10,6 +10,8 @@ import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
import io.swagger.annotations.AuthorizationScope;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -30,15 +32,20 @@ import static org.springframework.http.MediaType.*;
|
||||
@Controller
|
||||
@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE})
|
||||
@Api(value = "/pet", description = "the pet API")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class PetApi {
|
||||
|
||||
|
||||
@ApiOperation(value = "Update an existing pet", notes = "", response = Void.class)
|
||||
@ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Validation exception"),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||
@ApiResponse(code = 404, message = "Pet not found"),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied") })
|
||||
@ApiResponse(code = 405, message = "Validation exception") })
|
||||
@RequestMapping(value = "",
|
||||
produces = { "application/json", "application/xml" },
|
||||
consumes = { "application/json", "application/xml" },
|
||||
@ -54,7 +61,12 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class)
|
||||
@ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input") })
|
||||
@RequestMapping(value = "",
|
||||
@ -72,7 +84,12 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List")
|
||||
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation"),
|
||||
@ApiResponse(code = 400, message = "Invalid status value") })
|
||||
@ -91,7 +108,12 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List")
|
||||
@ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation"),
|
||||
@ApiResponse(code = 400, message = "Invalid tag value") })
|
||||
@ -110,11 +132,17 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class)
|
||||
@ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = {
|
||||
@Authorization(value = "api_key"),
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 404, message = "Pet not found"),
|
||||
@ApiResponse(code = 200, message = "successful operation"),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied") })
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||
@ApiResponse(code = 404, message = "Pet not found") })
|
||||
@RequestMapping(value = "/{petId}",
|
||||
produces = { "application/json", "application/xml" },
|
||||
|
||||
@ -130,7 +158,12 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class)
|
||||
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input") })
|
||||
@RequestMapping(value = "/{petId}",
|
||||
@ -158,7 +191,12 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class)
|
||||
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid pet value") })
|
||||
@RequestMapping(value = "/{petId}",
|
||||
@ -180,7 +218,12 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "uploads an image", notes = "", response = Void.class)
|
||||
@ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
@RequestMapping(value = "/{petId}/uploadImage",
|
||||
|
@ -10,6 +10,8 @@ import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
import io.swagger.annotations.AuthorizationScope;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -30,11 +32,13 @@ import static org.springframework.http.MediaType.*;
|
||||
@Controller
|
||||
@RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE})
|
||||
@Api(value = "/store", description = "the store API")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class StoreApi {
|
||||
|
||||
|
||||
@ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map")
|
||||
@ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
|
||||
@Authorization(value = "api_key")
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
@RequestMapping(value = "/inventory",
|
||||
@ -70,9 +74,9 @@ public class StoreApi {
|
||||
|
||||
@ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 404, message = "Order not found"),
|
||||
@ApiResponse(code = 200, message = "successful operation"),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied") })
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||
@ApiResponse(code = 404, message = "Order not found") })
|
||||
@RequestMapping(value = "/order/{orderId}",
|
||||
produces = { "application/json", "application/xml" },
|
||||
|
||||
@ -90,8 +94,8 @@ public class StoreApi {
|
||||
|
||||
@ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 404, message = "Order not found"),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied") })
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied"),
|
||||
@ApiResponse(code = 404, message = "Order not found") })
|
||||
@RequestMapping(value = "/order/{orderId}",
|
||||
produces = { "application/json", "application/xml" },
|
||||
|
||||
|
@ -10,6 +10,8 @@ import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
import io.swagger.annotations.AuthorizationScope;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -30,7 +32,7 @@ import static org.springframework.http.MediaType.*;
|
||||
@Controller
|
||||
@RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE})
|
||||
@Api(value = "/user", description = "the user API")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class UserApi {
|
||||
|
||||
|
||||
@ -128,9 +130,9 @@ public class UserApi {
|
||||
|
||||
@ApiOperation(value = "Get user by user name", notes = "", response = User.class)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 404, message = "User not found"),
|
||||
@ApiResponse(code = 200, message = "successful operation"),
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied") })
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied"),
|
||||
@ApiResponse(code = 404, message = "User not found") })
|
||||
@RequestMapping(value = "/{username}",
|
||||
produces = { "application/json", "application/xml" },
|
||||
|
||||
@ -148,8 +150,8 @@ public class UserApi {
|
||||
|
||||
@ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 404, message = "User not found"),
|
||||
@ApiResponse(code = 400, message = "Invalid user supplied") })
|
||||
@ApiResponse(code = 400, message = "Invalid user supplied"),
|
||||
@ApiResponse(code = 404, message = "User not found") })
|
||||
@RequestMapping(value = "/{username}",
|
||||
produces = { "application/json", "application/xml" },
|
||||
|
||||
@ -171,8 +173,8 @@ public class UserApi {
|
||||
|
||||
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 404, message = "User not found"),
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied") })
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied"),
|
||||
@ApiResponse(code = 404, message = "User not found") })
|
||||
@RequestMapping(value = "/{username}",
|
||||
produces = { "application/json", "application/xml" },
|
||||
|
||||
|
@ -18,7 +18,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
@EnableSwagger2 //Loads the spring beans required by the framework
|
||||
@PropertySource("classpath:swagger.properties")
|
||||
@Import(SwaggerUiConfiguration.class)
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
ApiInfo apiInfo() {
|
||||
|
@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
||||
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter {
|
||||
private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" };
|
||||
|
||||
|
@ -2,7 +2,7 @@ package io.swagger.configuration;
|
||||
|
||||
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer {
|
||||
|
||||
@Override
|
||||
|
@ -3,7 +3,7 @@ package io.swagger.configuration;
|
||||
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class WebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||
@Override
|
||||
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
|
||||
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-09-30T16:27:59.075+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2015-10-16T21:16:24.594-04:00")
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
|
Loading…
Reference in New Issue
Block a user