Closed allwefantasy closed 5 years ago
现在你可以这么定义一个接口:
@OpenAPIDefinition( info = @BasicInfo(desc = "标签管理接口集合", contact = @Contact(url = "", name = "allwefantasy", email = "allwefantasy@gmail.com"), license = @License(name = "Apache", url = "...") ), externalDocs = @ExternalDocumentation(description = ""), servers = { @Server(url = "http://127.0.0.1", description = "测试服务器") } ) public class TagController extends ApplicationController { @At(path = "/tag", types = {RestRequest.Method.POST}) @Parameters( @Parameter(name = "name", required = true, description = "标签的名字") ) @Responses( @ApiResponse( responseCode = "200", description = "返回值为json", content = @Content( mediaType = "application/json", schema = @Schema(type = "string", format = "json", description = "") ) ) ) public void save() { Tag tag = Tag.create(params()); if (tag.save()) { render(200, "成功", ViewType.string); } render(400, "失败", ViewType.string); }
然后通过接口 http://..../openapi/ui/spec/ 可以访问到这些描述信息。
http://..../openapi/ui/spec/
现在你可以这么定义一个接口:
然后通过接口
http://..../openapi/ui/spec/
可以访问到这些描述信息。