本文整理了Java中io.swagger.annotations.Api
类的一些代码示例,展示了Api
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Api
类的具体详情如下:
包路径:io.swagger.annotations.Api
类名称:Api
暂无
代码示例来源:origin: hs-web/hsweb-framework
@RestController
@RequestMapping("/datasource")
@Api(tags = "开发人员工具-数据源", value = "数据源")
@Authorize(permission = "datasource", description = "数据源管理")
public class DatasourceController {
@Autowired
private DynamicDataSourceConfigRepository<? extends DynamicDataSourceConfig> repository;
@GetMapping
@Authorize(action = Permission.ACTION_QUERY)
@ApiOperation("获取全部数据源信息")
public ResponseMessage<List<? extends DynamicDataSourceConfig>> getAllConfig() {
return ResponseMessage.ok(repository.findAll());
}
}
代码示例来源:origin: Graylog2/graylog2-server
public synchronized Map<String, Object> generateOverview() {
if (!overviewResult.isEmpty()) {
return overviewResult;
}
final List<Map<String, Object>> apis = Lists.newArrayList();
for (Class<?> clazz : getAnnotatedClasses()) {
Api info = clazz.getAnnotation(Api.class);
Path path = clazz.getAnnotation(Path.class);
if (info == null || path == null) {
LOG.debug("Skipping REST resource with no Api or Path annotation: <{}>", clazz.getCanonicalName());
continue;
}
final String prefixedPath = prefixedPath(clazz, path.value());
final Map<String, Object> apiDescription = Maps.newHashMap();
apiDescription.put("name", prefixedPath.startsWith(pluginPathPrefix) ? "Plugins/" + info.value() : info.value());
apiDescription.put("path", prefixedPath);
apiDescription.put("description", info.description());
apis.add(apiDescription);
}
Collections.sort(apis, (o1, o2) -> ComparisonChain.start().compare(o1.get("name").toString(), o2.get("name").toString()).result());
Map<String, String> info = Maps.newHashMap();
info.put("title", "Graylog REST API");
overviewResult.put("apiVersion", ServerVersion.VERSION.toString());
overviewResult.put("swaggerVersion", EMULATED_SWAGGER_VERSION);
overviewResult.put("apis", apis);
return overviewResult;
}
代码示例来源:origin: org.activiti/activiti-rest
/**
* @author Frederik Heremans
*/
@RestController
@Api(tags = { "Engine" }, description = "Manage Engine", authorizations = { @Authorization(value = "basicAuth") })
public class PropertiesCollectionResource {
@Autowired
protected ManagementService managementService;
@ApiOperation(value = "Get engine properties", tags = {"Engine"})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates the properties are returned."),
})
@RequestMapping(value = "/management/properties", method = RequestMethod.GET, produces = "application/json")
public Map<String, String> getProperties() {
return managementService.getProperties();
}
}
代码示例来源:origin: apache/incubator-pinot
@Api(tags = Constants.HEALTH_TAG)
@Path("/pinot-controller/admin")
public class PinotControllerHealthCheck {
@Inject
ControllerConf controllerConf;
@GET
@Path("/")
@ApiOperation(value = "Check controller health")
@ApiResponses(value = {@ApiResponse(code = 200, message = "Good")})
@Produces(MediaType.TEXT_PLAIN)
public String checkHealth() {
if (StringUtils.isNotBlank(controllerConf.generateVipUrl())) {
return "GOOD";
}
return "";
}
}
代码示例来源:origin: macrozheng/mall
/**
* 收货地址管理Controller
* Created by macro on 2018/10/18.
*/
@Controller
@Api(tags = "OmsCompanyAddressController", description = "收货地址管理")
@RequestMapping("/companyAddress")
public class OmsCompanyAddressController {
@Autowired
private OmsCompanyAddressService companyAddressService;
@ApiOperation("获取所有收货地址")
@RequestMapping(value = "/list",method = RequestMethod.GET)
@ResponseBody
public Object list() {
List<OmsCompanyAddress> companyAddressList = companyAddressService.list();
return new CommonResult().success(companyAddressList);
}
}
代码示例来源:origin: hs-web/hsweb-framework
/**
* 关系定义
*
* @author hsweb-generator-online
*/
@RestController
@RequestMapping("${hsweb.web.mappings.relationDefine:relation/define}")
@Authorize(permission = "relation-define",description = "关系定义管理")
@Api(value = "关系定义管理",tags = "组织架构-关系定义管理")
public class RelationDefineController implements SimpleGenericEntityController<RelationDefineEntity, String, QueryParamEntity> {
private RelationDefineService relationDefineService;
@Autowired
public void setRelationDefineService(RelationDefineService relationDefineService) {
this.relationDefineService = relationDefineService;
}
@Override
public RelationDefineService getService() {
return relationDefineService;
}
}
代码示例来源:origin: Netflix/conductor
@Api(value = "/health", produces = MediaType.APPLICATION_JSON, tags = "Health Check")
@Path("/health")
@Produces({MediaType.APPLICATION_JSON})
@Singleton
public class HealthCheckResource {
private final HealthCheckAggregator healthCheck;
@Inject
public HealthCheckResource(HealthCheckAggregator healthCheck) {
this.healthCheck = healthCheck;
}
@GET
public HealthCheckStatus doCheck() throws Exception {
return healthCheck.check().get();
}
}
代码示例来源:origin: org.activiti/activiti-rest
/**
* @author Tijs Rademakers
*/
@RestController
@Api(tags = { "History" }, description = "Manage History", authorizations = { @Authorization(value = "basicAuth") })
public class HistoricDetailQueryResource extends HistoricDetailBaseResource {
@ApiOperation(value = "Query for historic details", tags = { "History" }, notes = "All supported JSON parameter fields allowed are exactly the same as the parameters found for getting a collection of historic process instances, but passed in as JSON-body arguments rather than URL-parameters to allow for more advanced querying and preventing errors with request-uri’s that are too long.")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates request was successful and the historic details are returned"),
@ApiResponse(code = 400, message = "Indicates an parameter was passed in the wrong format. The status-message contains additional information.") })
@RequestMapping(value = "/query/historic-detail", method = RequestMethod.POST, produces = "application/json")
public DataResponse queryHistoricDetail(@RequestBody HistoricDetailQueryRequest queryRequest,@ApiParam(hidden=true) @RequestParam Map<String, String> allRequestParams, HttpServletRequest request) {
return getQueryResponse(queryRequest, allRequestParams);
}
}
代码示例来源:origin: alien4cloud/alien4cloud
@RestController
@RequestMapping(value = { "/rest/repository-plugins", "/rest/v1/repository-plugins",
"/rest/latest/repository-plugins" }, produces = MediaType.APPLICATION_JSON_VALUE)
@Api(value = "List Repository Plugins", description = "Allow to list all repository plugins (artifact resolver).", authorizations = {
@Authorization("COMPONENTS_MANAGER") })
public class RepositoryPluginController {
@Resource
private RepositoryService repositoryService;
@ApiOperation(value = "Search for repository resolver plugins.", authorizations = { @Authorization("COMPONENTS_MANAGER") })
@RequestMapping(method = RequestMethod.GET)
@PreAuthorize("hasAnyAuthority('ADMIN', 'COMPONENTS_MANAGER')")
public RestResponse<List<RepositoryPluginComponent>> listRepositoryResolverPlugins() {
return RestResponseBuilder.<List<RepositoryPluginComponent>> builder().data(repositoryService.listPluginComponents()).build();
}
}
代码示例来源:origin: apache/incubator-pinot
/**
* Debug endpoint to check memory allocation.
*/
@Api(value = "debug", description = "Debug information", tags = "Debug")
@Path("debug")
public class MmapDebugResource {
@GET
@Path("memory/offheap")
@ApiOperation(value = "View current off-heap allocations", notes = "Lists all off-heap allocations and their associated sizes")
@ApiResponses(value = {@ApiResponse(code = 200, message = "Success")})
@Produces(MediaType.APPLICATION_JSON)
public List<String> getOffHeapSizes() {
return PinotDataBuffer.getBufferInfo();
}
}
代码示例来源:origin: io.swagger/swagger-jaxrs
protected Set<String> extractTags(Api api) {
Set<String> output = new LinkedHashSet<String>();
boolean hasExplicitTags = false;
for (String tag : api.tags()) {
if (!"".equals(tag)) {
hasExplicitTags = true;
output.add(tag);
}
}
if (!hasExplicitTags) {
// derive tag from api path + description
String tagString = api.value().replace("/", "");
if (!"".equals(tagString)) {
output.add(tagString);
}
}
return output;
}
代码示例来源:origin: kongchen/swagger-maven-plugin
protected Set<Tag> extractTags(Api api) {
Set<Tag> output = new LinkedHashSet<>();
if(api == null) {
return output;
}
boolean hasExplicitTags = false;
for (String tag : api.tags()) {
if (!tag.isEmpty()) {
hasExplicitTags = true;
output.add(new Tag().name(tag));
}
}
if (!hasExplicitTags) {
// derive tag from api path + description
String tagString = api.value().replace("/", "");
if (!tagString.isEmpty()) {
Tag tag = new Tag().name(tagString);
if (!api.description().isEmpty()) {
tag.description(api.description());
}
output.add(tag);
}
}
return output;
}
代码示例来源:origin: apache/servicecomb-java-chassis
private void setTags(Api api, SwaggerGenerator swaggerGenerator) {
String[] tags = api.tags();
for (String tagName : tags) {
if (StringUtils.isEmpty(tagName)) {
continue;
}
swaggerGenerator.addDefaultTag(tagName);
}
}
}
代码示例来源:origin: com.outbrain.swinfra/ob1k-swagger
private Tag buildTag(final Class<?> serviceClass) {
final Api annotation = serviceClass.getAnnotation(Api.class);
final String name = (annotation != null) ? annotation.value() : serviceClass.getSimpleName();
final String description = (annotation != null) ? annotation.description() : serviceClass.getCanonicalName();
return new Tag().name(name).description(description);
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public LoggerDefine parse(MethodInterceptorHolder holder) {
Api api = holder.findAnnotation(Api.class);
ApiOperation operation = holder.findAnnotation(ApiOperation.class);
String action = "";
if (api != null) {
action = action.concat(api.value());
}
if (null != operation) {
action = StringUtils.isEmpty(action) ? operation.value() : action + "-" + operation.value();
}
return new LoggerDefine(action, "");
}
}
代码示例来源:origin: io.springfox/springfox-swagger-common
@Override
public Integer getResourcePosition(RequestMappingInfo requestMappingInfo, HandlerMethod handlerMethod) {
Class<?> controllerClass = handlerMethod.getBeanType();
Api apiAnnotation = findAnnotation(controllerClass, Api.class);
if (null != apiAnnotation && hasText(apiAnnotation.value())) {
return apiAnnotation.position();
}
return 0;
}
代码示例来源:origin: org.activiti/activiti-rest
/**
* @author Frederik Heremans
*/
@RestController
@Api(tags = { "Database tables" }, description = "Manage Database tables", authorizations = { @Authorization(value = "basicAuth") })
public class TableCollectionResource {
@Autowired
protected RestResponseFactory restResponseFactory;
@Autowired
protected ManagementService managementService;
@ApiOperation(value = " List of tables", tags = {"Database tables"})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates the request was successful.")
})
@RequestMapping(value = "/management/tables", method = RequestMethod.GET, produces = "application/json")
public List<TableResponse> getTables(HttpServletRequest request) {
return restResponseFactory.createTableResponseList(managementService.getTableCount());
}
}
代码示例来源:origin: apache/incubator-pinot
@Api(tags = Constants.SCHEMA_TAG)
@Path("/")
public class PinotTableSchema {
private static final Logger LOGGER = LoggerFactory.getLogger(PinotTableSchema.class);
@Inject
PinotHelixResourceManager pinotHelixResourceManager;
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/tables/{tableName}/schema")
@ApiOperation(value = "Get table schema", notes = "Read table schema")
@ApiResponses(value = {@ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 404, message = "Table not found")})
public String getTableSchema(
@ApiParam(value = "Table name (without type)", required = true) @PathParam("tableName") String tableName) {
Schema schema = pinotHelixResourceManager.getTableSchema(tableName);
if (schema != null) {
return schema.getJSONSchema();
}
throw new ControllerApplicationException(LOGGER, "Schema not found for table: " + tableName,
Response.Status.NOT_FOUND);
}
}
代码示例来源:origin: macrozheng/mall
/**
* 商品优选管理Controller
* Created by macro on 2018/6/1.
*/
@Controller
@Api(tags = "CmsPrefrenceAreaController", description = "商品优选管理")
@RequestMapping("/prefrenceArea")
public class CmsPrefrenceAreaController {
@Autowired
private CmsPrefrenceAreaService prefrenceAreaService;
@ApiOperation("获取所有商品优选")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public Object listAll() {
List<CmsPrefrenceArea> prefrenceAreaList = prefrenceAreaService.listAll();
return new CommonResult().success(prefrenceAreaList);
}
}
代码示例来源:origin: hs-web/hsweb-framework
/**
* 权限管理
*
* @author zhouhao
*/
@RestController
@RequestMapping("${hsweb.web.mappings.permission:permission}")
@Authorize(permission = "permission", description = "权限管理")
@Api(value = "权限管理",tags = "权限-权限管理")
public class PermissionController implements SimpleGenericEntityController<PermissionEntity, String, QueryParamEntity> {
private PermissionService permissionService;
@Autowired
public void setPermissionService(PermissionService permissionService) {
this.permissionService = permissionService;
}
@Override
public PermissionService getService() {
return permissionService;
}
}
内容来源于网络,如有侵权,请联系作者删除!