Scala上的招摇过市、uuid类型和long类型未定义
我正在尝试使用Scala上的招摇过市、uuid类型和long类型未定义,scala,akka,swagger,akka-http,swagger-akka-http,Scala,Akka,Swagger,Akka Http,Swagger Akka Http,我正在尝试使用akka-http10.0.0和swagger-akka-http0.8.2在我的路由上实现swagger。它工作正常,但类型为UUID和Long的查询参数被认为是未定义的 我应该使用格式吗 如何使用它 以下是我的路线之一: @GET @Path("/{publisher_id}/{app_id}") @ApiOperation( value = "get a app Installation stat for an app ID", n
akka-http
10.0.0和swagger-akka-http
0.8.2在我的路由上实现swagger。它工作正常,但类型为UUID和Long的查询参数被认为是未定义的
我应该使用格式吗
如何使用它
以下是我的路线之一:
@GET @Path("/{publisher_id}/{app_id}")
@ApiOperation(
value = "get a app Installation stat for an app ID",
notes = "Returns a session based on ID",
httpMethod = "GET"
)
@ApiImplicitParams(Array(
new ApiImplicitParam(name = "app_id", value = "ID of app that needs to be fetched, format com.totot.plop ", required = true, dataType = "string", paramType = "path"),
new ApiImplicitParam(name = "publisher_id", value = "publisher id : publisher_id ", required = true, dataType = "UUID?", paramType = "path"),
new ApiImplicitParam(name = "date_start", value = "Timestamp start date ", required = true, dataType = "LONG???" , paramType = "query"),
new ApiImplicitParam(name = "date_end", value = "Timestamp end date", required = true, dataType = "LONG???", paramType = "query"),
new ApiImplicitParam(name = "access_token", value = "session token of the user ", required = true, dataType = "UUID????", paramType = "query")
))
@ApiResponses(Array(
new ApiResponse(code = 404, message = "App not found"),
new ApiResponse(code = 400, message = "Invalid ID supplied"),
new ApiResponse(code = 401, message = "access token invalid")
))
对于Long,请使用
@apimplicitparam(…dataType=“Long”…)
。为参数生成的招摇过市json:
{
"name" : "name",
"in" : "query",
"description" : "param desc",
"required" : true/false,
"type" : "int",
"format" : "int64"
}
有这样一个例子param
对于java.util.UUID类型的参数,据我所知,swagger.io代码中没有对UUID进行特殊处理。因此,我建议使用dataType=“string”。作为通用指针,@apimplicitparam
数据类型记录为:
/**
* The data type of the parameter.
* <p>
* This can be the class name or a primitive.
*/
/**
*参数的数据类型。
*
*这可以是类名或原语。
*/
原语值似乎是java原语类型名称,例如int、long等。还支持
string
。首先,您可以按照文档中的说明指定一个类:
数据类型可以是基元或类名
通过类名,这意味着您必须包含完整的类名,即文档中提到的“java.util.UUID”,或{UUID.class}。我没有看到UUID或这里列出的很长时间