Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cxf BeanParam的招摇过市文档_Cxf_Jax Rs_Swagger - Fatal编程技术网

Cxf BeanParam的招摇过市文档

Cxf BeanParam的招摇过市文档,cxf,jax-rs,swagger,Cxf,Jax Rs,Swagger,我正试图使用Swagger记录我的一个javaapi(在apachecxf中实现),它使用Bean参数接收它的参数。比如: @GET @Produces({SemanticMediaType.JSON_LD, MediaType.APPLICATION_JSON_VALUE}) @ApiOperation(value = "Retrieves Themes", position = 0) @ApiResponses(value = {@ApiResponse(code = 200,

我正试图使用Swagger记录我的一个javaapi(在apachecxf中实现),它使用Bean参数接收它的参数。比如:

@GET
@Produces({SemanticMediaType.JSON_LD, MediaType.APPLICATION_JSON_VALUE})
@ApiOperation(value = "Retrieves Themes", position = 0)
@ApiResponses(value = {@ApiResponse(code = 200,
        message = "Retrieval was successful"), @ApiResponse(code = 403,
        message = "Missing or invalid x-business-group-id header"), @ApiResponse(code = 500,
        message = "Internal server error")})
public Response get(@QueryParam(URI_PARAM_NAME) String uri,
                    final @ApiParam @Valid @BeanParam ThemeParams themeParams) { ... }
我读到Swagger已经实现了对BeanParms的支持,但是当我尝试运行它时,在Swagger ui中,我只看到一个名为“body”的参数和一个文本字段,与BeanParam的内容无关


有人能提供一些帮助吗?

这有点老了,但对于那些有同样问题的人,我发现这里有帮助

  • 如果您使用的是DefaultJaxrsConfig,请将其更改为JerseyJaxrsConfig
  • 如果您正在链接到swagger-jersey-jaxrs_……,请将其更改为swagger-jersey2-jxsrs_
您可以参考

@POST
    @Path("/users")
    @ApiOperation(value = "vdc", position = 1, notes = "vdc")
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "OK",response=UserCreateResponse.class),
            @ApiResponse(code = 30601, message = "'httpcode': 400 'Errormsg': Request Params Not Valid"),
            @ApiResponse(code = 30602, message = "'httpcode':404 'Errormsg': Data Required Not Found"),
            @ApiResponse(code = 30603, message = "'httpcode':405 'Errormsg': Method Not Allowed"),
            @ApiResponse(code = 30604, message = "'httpcode':408 'Errormsg': Request Time Expires Timeout"),
            @ApiResponse(code = 30605, message = "'httpcode':500 'Errormsg': Internal Server Error") })
    public Response createUsersWithArrayInput(
            @ApiParam(value = "ID", name = "platform_id", required = true) @QueryParam(value = "platform_id") String platformId,
            @ApiParam(value="body",name="user",required=true)UserCreate userCreate) {}
UserCreate.java

@ApiModel("UserCreate")
public class UserCreate {
        @ApiModelProperty(value="VDC Id",required=false)
        @JsonStringSchema(optional=true,description="VDC Id")
        private String vdcId;
        @ApiModelProperty(value="description",required=true)

        private String name;
        @ApiModelProperty(value="description",required=false)

        private String password;
        }