如何为json有效负载定义swagger注释

时间:2016-05-12 07:06:03

标签: java rest jax-rs swagger

如何为此示例post API定义swagger注释.TenantConfiguration将作为json有效内容获取。

@Consumes({ "application/json", "application/xml" })
@POST
    public Message configureSettings(TenantConfiguration configuration)
            throws AndroidAgentException {
.....................
}

1 个答案:

答案 0 :(得分:1)

我找到了一个注释json消费Jax-rs Apis的解决方案。它正常工作。

as

JSON对象的映射类。

@POST
@ApiOperation(
        consumes = MediaType.APPLICATION_JSON,
        httpMethod = "POST",
        value = "Configuring Android Platform Settings",
        notes = "Configure the Android platform settings using this REST API"
)
@ApiResponses(value = {
        @ApiResponse(code = 201, message = "Android platform configuration saved successfully"),
        @ApiResponse(code = 500, message = "Internal Server Error")
})
Message configureSettings(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration")
                                  TenantConfiguration configuration) throws AndroidAgentException;