Java Examples for com.wordnik.swagger.annotations.ApiImplicitParams
The following java examples will help you to understand the usage of com.wordnik.swagger.annotations.ApiImplicitParams. These source code samples are taken from different open source projects.
Example 1
| Project: PluginExpress-master File: ApiOperation.java View source code |
/** * Process any swagger annotations relating to parameters passed in the * body. * * Swagger annotations are @ApiParam, @ApiImplicitParam and * @ApiImplicitParams, a collection of @ApiImplicitParam annotations. * * @param method * - Controller method */ public void determineBodyInputParameters(Method method) { if (method.isAnnotationPresent(com.wordnik.swagger.annotations.ApiParam.class)) { com.wordnik.swagger.annotations.ApiParam ap = method.getAnnotation(com.wordnik.swagger.annotations.ApiParam.class); ApiOperationParameters inputParam = new ApiOperationParameters("body", ap.name(), "string", ap.required()); if (ap.allowableValues() != null && !ap.allowableValues().equals("")) inputParam.setAllowableValues(ap.allowableValues()); if (ap.value() != null && !ap.value().equals("")) inputParam.setDescription(ap.value()); if (ap.defaultValue() != null && !ap.defaultValue().equals("")) inputParam.setDefaultValue(ap.defaultValue()); addParameter(inputParam); } if (method.isAnnotationPresent(com.wordnik.swagger.annotations.ApiImplicitParam.class)) { com.wordnik.swagger.annotations.ApiImplicitParam aip = method.getAnnotation(com.wordnik.swagger.annotations.ApiImplicitParam.class); ApiOperationParameters inputParam = new ApiOperationParameters(aip.paramType(), aip.name(), aip.dataType(), aip.required()); if (aip.allowableValues() != null && !aip.allowableValues().equals("")) inputParam.setAllowableValues(aip.allowableValues()); if (aip.value() != null && !aip.value().equals("")) inputParam.setDescription(aip.value()); addParameter(inputParam); } if (method.isAnnotationPresent(com.wordnik.swagger.annotations.ApiImplicitParams.class)) { com.wordnik.swagger.annotations.ApiImplicitParams aip = method.getAnnotation(com.wordnik.swagger.annotations.ApiImplicitParams.class); for (com.wordnik.swagger.annotations.ApiImplicitParam ip : aip.value()) { ApiOperationParameters inputParam = new ApiOperationParameters(ip.paramType(), ip.name(), ip.dataType(), ip.required()); if (ip.allowableValues() != null && !ip.allowableValues().equals("")) inputParam.setAllowableValues(ip.allowableValues()); if (ip.value() != null && !ip.value().equals("")) inputParam.setDescription(ip.value()); addParameter(inputParam); } } }
Example 2
| Project: gazpachoquest-master File: QuestionnaireDefinitionResource.java View source code |
@POST
@Path("/import")
@Consumes("multipart/form-data")
@ApiOperation(value = "Import questionnaire definition", notes = "Only xml format supported", response = QuestionnaireDefinitionDTO.class)
@ApiResponses(value = { @ApiResponse(code = 415, message = "Unsupported format"), @ApiResponse(code = 200, message = "Imported questionnaire definition") })
@ApiImplicitParams(@ApiImplicitParam(dataType = "file", name = "content", paramType = "body"))
@Produces(MediaType.APPLICATION_JSON)
public QuestionnaireDefinitionDTO importQuestionnairDefinition(@Multipart(value = "content", type = "text/xml") @ApiParam(access = "internal") InputStream content) throws Exception {
logger.info("New import QuestionnaireDefinition petition received");
QuestionnaireDefinitionDTO imported = questionnaireDefinitionAccessorFacade.importQuestionnaireDefinition(content);
logger.info("QuestionnaireDefinition imported with id = {}", imported.getId());
return imported;
}Example 3
| Project: restlet-framework-java-master File: SwaggerAnnotationIntrospectionHelper.java View source code |
@Override
public java.util.List<Class<?>> processOperation(Resource resource, Operation operation, Class<?> resourceClass, Method javaMethod) {
List<Class<?>> representationsUsed = new ArrayList<>();
ApiOperation apiOperation = javaMethod.getAnnotation(ApiOperation.class);
if (apiOperation != null) {
SwaggerAnnotationUtils.processApiOperation(apiOperation, resource, operation);
}
ApiResponses apiResponses = javaMethod.getAnnotation(ApiResponses.class);
if (apiResponses != null) {
SwaggerAnnotationUtils.processApiResponses(apiResponses, operation, representationsUsed);
}
ApiResponse apiResponse = javaMethod.getAnnotation(ApiResponse.class);
if (apiResponse != null) {
SwaggerAnnotationUtils.processApiResponse(apiResponse, operation, representationsUsed);
}
ApiImplicitParams apiImplicitParams = javaMethod.getAnnotation(ApiImplicitParams.class);
if (apiImplicitParams != null) {
SwaggerAnnotationUtils.processApiImplicitParams(apiImplicitParams, operation);
}
ApiImplicitParam apiImplicitParam = javaMethod.getAnnotation(ApiImplicitParam.class);
if (apiImplicitParam != null) {
SwaggerAnnotationUtils.processApiImplicitParam(apiImplicitParam, operation);
}
return representationsUsed;
}Example 4
| Project: minnal-master File: AbstractMethodCreator.java View source code |
/**
* Returns the api parameter annotations
*
* @return
*/
protected Annotation getApiParamAnnotations() {
Annotation implicitParams = new Annotation(ApiImplicitParams.class.getCanonicalName(), ctClass.getClassFile().getConstPool());
List<AnnotationMemberValue> annotationMemberValues = new ArrayList<AnnotationMemberValue>();
List<Annotation> annotations = Lists.newArrayList();
annotations.addAll(getApiPathParamAnnotations());
annotations.addAll(getApiQueryParamAnnotations());
annotations.addAll(getApiAdditionalParamAnnotations());
for (Annotation annotation : annotations) {
annotationMemberValues.add(new AnnotationMemberValue(annotation, ctClass.getClassFile().getConstPool()));
}
ArrayMemberValue values = new ArrayMemberValue(ctClass.getClassFile().getConstPool());
values.setValue(annotationMemberValues.toArray(new AnnotationMemberValue[0]));
implicitParams.addMemberValue("value", values);
return implicitParams;
}Example 5
| Project: cxf-master File: Sample.java View source code |
@Path("/{name}")
@DELETE
@ApiOperation(value = "Delete operation with implicit header", notes = "Delete operation with implicit header")
@ApiImplicitParams(@ApiImplicitParam(name = "Accept-Language", value = "language", required = true, dataType = "String", paramType = "header"))
public Response delete(@ApiParam(value = "name", required = true) @PathParam("name") String name) {
items.remove(name);
return Response.ok().build();
}Example 6
| Project: POIProxy-master File: POIProxyApplication.java View source code |
@GET
@Path("/browse")
@ApiOperation(value = "Get POIs using a tile vector scheme", notes = "This API operation is used to get POIs from a POIProxy service contained in a vector tile. See http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/ to understand the tilling scheme used. The accuracy of the results obtained depends on the origin service and mainly the zoom level. This API operation works well at street level", response = FeatureCollection.class)
@ApiImplicitParams({ @ApiImplicitParam(name = "service", value = "A valid POIProxy service (see /poiproxy/describeServices)", required = true, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "z", value = "Zoom level", required = true, dataType = "integer", paramType = "query"), @ApiImplicitParam(name = "y", value = "Y tile", required = true, dataType = "integer", paramType = "query"), @ApiImplicitParam(name = "x", value = "X tile", required = true, dataType = "integer", paramType = "query"), @ApiImplicitParam(name = "query", value = "A keyword to search. The search operation depends on the service. To know which services allow the search param see /poiproxy/describeServices", required = false, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "apiKey", value = "Your apiKey to make requests to the origin service. Most services already have an apiKey configured or don't need one, but it is highly recommended to use your own apiKeys in order to avoid Rate Limits. Please refer to the origin service documentation in order to register for an apiKey", required = false, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "callback", value = "Provide a callback name for JSONP purposes", required = false, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "fromDate", value = "A date from which get POIs. Use this date_format: yyyy-MM-dd HH:mm:ss. This parameter has to be configured for the service you are requesting, please refer to the /poiproxy/describeServices operation for more info", required = false, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "toDate", value = "A date to which get POIs. Use this date_format: yyyy-MM-dd HH:mm:ss. This parameter has to be configured for the service you are requesting, please refer to the /poiproxy/describeServices operation for more info", required = false, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "offset", value = "The page from where to start to get results. Use it together with the limit parameter. The origin service has to support pagination, please refer to /poiproxy/describeServices for more info", required = false, dataType = "integer", paramType = "query"), @ApiImplicitParam(name = "limit", value = "The number of results. Use it together with the offset parameter. The origin service has to support pagination, please refer to /poiproxy/describeServices for more info", required = false, dataType = "integer", paramType = "query") })
@ApiResponses(value = { @ApiResponse(code = 500, message = "Server error"), @ApiResponse(code = 200, message = "OK", response = FeatureCollection.class) })
public void zxy(@ApiParam(value = "A valid POIProxy service (see /poiproxy/describeServices)", required = true) @QueryParam("service") String service, @ApiParam(value = "Zoom level", required = true) @QueryParam("z") Integer z, @ApiParam(value = "Y tile", required = true) @QueryParam("y") Integer y, @ApiParam(value = "X tile", required = true) @QueryParam("x") Integer x, @ApiParam(value = "A keyword to search. The search operation depends on the service. To know which services allow the search param see /poiproxy/describeServices", required = false) @QueryParam("query") String query, @ApiParam(value = "Your apiKey to make requests to the origin service. Most services already have an apiKey configured or don't need one, but it is highly recommended to use your own apiKeys in order to avoid Rate Limits. Please refer to the origin service documentation in order to register for an apiKey", required = false) @QueryParam("apiKey") String apiKey, @ApiParam(value = "Provide a callback name for JSONP purposes", required = false) @QueryParam("callback") String callback, @ApiParam(value = "A date from which get POIs. Use this date_format: yyyy-MM-dd HH:mm:ss. This parameter has to be configured for the service you are requesting, please refer to the /poiproxy/describeServices operation for more info", required = false) @QueryParam("fromDate") String fromDate, @ApiParam(value = "A date to which get POIs. Use this date_format: yyyy-MM-dd HH:mm:ss. This parameter has to be configured for the service you are requesting, please refer to the /poiproxy/describeServices operation for more info", required = false) @QueryParam("toDate") String toDate, @ApiParam(value = "The page from where to start to get results. Use it together with the limit parameter. The origin service has to support pagination, please refer to /poiproxy/describeServices for more info", required = false) @QueryParam("offset") String offset, @ApiParam(value = "The number of results. Use it together with the offset parameter. The origin service has to support pagination, please refer to /poiproxy/describeServices for more info", required = false) @QueryParam("limit") String limit) {
}