From 4b80ddfd29e5a54363e4a7b25121a372c66df22a Mon Sep 17 00:00:00 2001 From: tanghc Date: Fri, 12 Jul 2019 18:06:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=99=E7=AE=B1=E7=8E=AF=E5=A2=83=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storyweb/controller/AlipayController.java | 3 +- .../website-front/pages/sandbox/sandbox.js | 9 +- .../gitee/sop/websiteserver/bean/DocItem.java | 1 + .../sop/websiteserver/bean/HttpTool.java | 78 +- .../controller/SandboxController.java | 3 +- .../manager/SwaggerDocParser.java | 10 +- .../src/main/resources/api.json | 1947 +++++++++++++++++ 7 files changed, 2017 insertions(+), 34 deletions(-) create mode 100644 sop-website/website-server/src/main/resources/api.json diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java index 083cdc50..10930107 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java @@ -10,6 +10,7 @@ import io.swagger.annotations.ApiOperation; import lombok.Data; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; @@ -126,7 +127,7 @@ public class AlipayController { * @return */ @ApiOperation(value="获取分类信息", notes = "演示表格树") - @ApiMapping(value = "alipay.category.get") + @ApiMapping(value = "alipay.category.get", method = RequestMethod.POST) public Category getCategory(Category story) { StoryVO storyVO = new StoryVO(); storyVO.id = 1L; diff --git a/sop-website/website-front/pages/sandbox/sandbox.js b/sop-website/website-front/pages/sandbox/sandbox.js index b338de7c..f8bf2673 100644 --- a/sop-website/website-front/pages/sandbox/sandbox.js +++ b/sop-website/website-front/pages/sandbox/sandbox.js @@ -101,10 +101,11 @@ function doTest() { var method = currentItem.name; var version = currentItem.version; var data = { - appId: $('#appId').val(), - privateKey: $('#privateKey').val(), - method: method, - version: version + appId: $('#appId').val() + , privateKey: $('#privateKey').val() + , method: method + , version: version + , httpMethod: currentItem.httpMethod }; var uploadFileObjects = getUploadFileObjects(); var $inputs = $body.find('.test-input'); diff --git a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/bean/DocItem.java b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/bean/DocItem.java index 2d933f9c..fa26ee3c 100644 --- a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/bean/DocItem.java +++ b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/bean/DocItem.java @@ -16,6 +16,7 @@ public class DocItem { private String description; // 是否多文件上传 private boolean multiple; + private String httpMethod; List requestParameters; List responseParameters; diff --git a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/bean/HttpTool.java b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/bean/HttpTool.java index b9a6c727..d9e057db 100644 --- a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/bean/HttpTool.java +++ b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/bean/HttpTool.java @@ -46,6 +46,7 @@ public class HttpTool { public void saveFromResponse(HttpUrl httpUrl, List list) { cookieStore.put(httpUrl.host(), list); } + public List loadForRequest(HttpUrl httpUrl) { List cookies = cookieStore.get(httpUrl.host()); return cookies != null ? cookies : new ArrayList(); @@ -55,11 +56,17 @@ public class HttpTool { @Data public static class HttpToolConfig { - /** 请求超时时间 */ + /** + * 请求超时时间 + */ private int connectTimeoutSeconds = 10; - /** http读取超时时间 */ + /** + * http读取超时时间 + */ private int readTimeoutSeconds = 10; - /** http写超时时间 */ + /** + * http写超时时间 + */ private int writeTimeoutSeconds = 10; } @@ -84,33 +91,15 @@ public class HttpTool { /** * 提交表单 * - * @param url url - * @param form 参数 + * @param url url + * @param form 参数 * @param header header * @param method 请求方式,post,get等 * @return * @throws IOException */ public String request(String url, Map form, Map header, String method) throws IOException { - Request.Builder requestBuilder; - if (METHOD_GET.equalsIgnoreCase(method)) { - HttpUrl.Builder urlBuilder = HttpUrl.parse(url).newBuilder(); - for (Map.Entry entry : form.entrySet()) { - urlBuilder.addQueryParameter(entry.getKey(), entry.getValue()); - } - requestBuilder = new Request.Builder() - .url(urlBuilder.build()) - .get(); - } else { - FormBody.Builder paramBuilder = new FormBody.Builder(StandardCharsets.UTF_8); - for (Map.Entry entry : form.entrySet()) { - paramBuilder.add(entry.getKey(), entry.getValue()); - } - FormBody formBody = paramBuilder.build(); - requestBuilder = new Request.Builder() - .url(url) - .method(method, formBody); - } + Request.Builder requestBuilder = buildRequestBuilder(url, form, method); // 添加header addHeader(requestBuilder, header); @@ -125,6 +114,47 @@ public class HttpTool { } } + public static Request.Builder buildRequestBuilder(String url, Map form, String method) { + switch (method) { + case "get": + return new Request.Builder() + .url(buildHttpUrl(url, form)) + .get(); + case "head": + return new Request.Builder() + .url(buildHttpUrl(url, form)) + .head(); + case "put": + return new Request.Builder() + .url(url) + .put(buildFormBody(form)); + case "delete": + return new Request.Builder() + .url(url) + .delete(buildFormBody(form)); + default: + return new Request.Builder() + .url(url) + .post(buildFormBody(form)); + } + } + + public static HttpUrl buildHttpUrl(String url, Map form) { + HttpUrl.Builder urlBuilder = HttpUrl.parse(url).newBuilder(); + for (Map.Entry entry : form.entrySet()) { + urlBuilder.addQueryParameter(entry.getKey(), entry.getValue()); + } + return urlBuilder.build(); + } + + public static FormBody buildFormBody(Map form) { + FormBody.Builder paramBuilder = new FormBody.Builder(StandardCharsets.UTF_8); + for (Map.Entry entry : form.entrySet()) { + paramBuilder.add(entry.getKey(), entry.getValue()); + } + return paramBuilder.build(); + } + /** * 提交表单,并且上传文件 * diff --git a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/controller/SandboxController.java b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/controller/SandboxController.java index 96ac2026..cd89a8bc 100644 --- a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/controller/SandboxController.java +++ b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/controller/SandboxController.java @@ -58,6 +58,7 @@ public class SandboxController { , @RequestParam String method , @RequestParam String version , @RequestParam String bizContent + , @RequestParam(defaultValue = "get") String httpMethod , HttpServletRequest request) throws AlipayApiException { Assert.isTrue(StringUtils.isNotBlank(appId), "AppId不能为空"); @@ -112,7 +113,7 @@ public class SandboxController { if (!CollectionUtils.isEmpty(files)) { responseData = httpTool.requestFile(url, params, Collections.emptyMap(), files); } else { - responseData = httpTool.request(url, params, Collections.emptyMap(), "get"); + responseData = httpTool.request(url, params, Collections.emptyMap(), httpMethod); } result.apiResult = responseData; return result; diff --git a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java index 533ec699..fc2876f9 100644 --- a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java +++ b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/SwaggerDocParser.java @@ -30,14 +30,16 @@ public class SwaggerDocParser implements DocParser { JSONObject paths = docRoot.getJSONObject("paths"); Set pathNameSet = paths.keySet(); - for (String pathName : pathNameSet) { - JSONObject pathInfo = paths.getJSONObject(pathName); + for (String apiPath : pathNameSet) { + JSONObject pathInfo = paths.getJSONObject(apiPath); + // key: get,post,head... Set pathSet = pathInfo.keySet(); Optional first = pathSet.stream().findFirst(); if (first.isPresent()) { - String path = first.get(); - JSONObject docInfo = pathInfo.getJSONObject(path); + String method = first.get(); + JSONObject docInfo = pathInfo.getJSONObject(method); DocItem docItem = buildDocItem(docInfo, docRoot); + docItem.setHttpMethod(method); docItems.add(docItem); } } diff --git a/sop-website/website-server/src/main/resources/api.json b/sop-website/website-server/src/main/resources/api.json new file mode 100644 index 00000000..1c5ad911 --- /dev/null +++ b/sop-website/website-server/src/main/resources/api.json @@ -0,0 +1,1947 @@ +{ + "swagger": "2.0", + "info": { + "description": "文档描述", + "version": "1.0", + "title": "故事API", + "termsOfService": "文档" + }, + "host": "10.1.30.157:2222", + "basePath": "/", + "tags": [ + { + "name": "故事接口", + "description": "Alipay Controller" + }, + { + "name": "故事接口2", + "description": "Story 2 Controller" + }, + { + "name": "文件上传", + "description": "File Upload Demo Controller" + } + ], + "paths": { + "/alipay.category.get/": { + "get": { + "tags": [ + "故事接口" + ], + "summary": "获取分类信息", + "description": "演示表格树", + "operationId": "getCategoryUsingGET", + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "categoryName", + "in": "query", + "description": "分类名称", + "required": false, + "type": "string", + "x-example": "娱乐" + }, + { + "name": "story.gmt_create", + "in": "query", + "description": "创建时间", + "required": false, + "type": "string", + "format": "date-time", + "x-example": "2019-04-14 19:02:12" + }, + { + "name": "story.id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int64", + "x-example": 1 + }, + { + "name": "story.name", + "in": "query", + "description": "故事名称", + "required": false, + "type": "string", + "x-example": "海底小纵队" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Category", + "originalRef": "Category" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "alipay.category.get", + "sop_version": "1.0" + }, + "head": { + "tags": [ + "故事接口" + ], + "summary": "获取分类信息", + "description": "演示表格树", + "operationId": "getCategoryUsingHEAD", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "categoryName", + "in": "query", + "description": "分类名称", + "required": false, + "type": "string", + "x-example": "娱乐" + }, + { + "name": "story.gmt_create", + "in": "query", + "description": "创建时间", + "required": false, + "type": "string", + "format": "date-time", + "x-example": "2019-04-14 19:02:12" + }, + { + "name": "story.id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int64", + "x-example": 1 + }, + { + "name": "story.name", + "in": "query", + "description": "故事名称", + "required": false, + "type": "string", + "x-example": "海底小纵队" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Category", + "originalRef": "Category" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "alipay.category.get", + "sop_version": "1.0" + }, + "post": { + "tags": [ + "故事接口" + ], + "summary": "获取分类信息", + "description": "演示表格树", + "operationId": "getCategoryUsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "categoryName", + "in": "query", + "description": "分类名称", + "required": false, + "type": "string", + "x-example": "娱乐" + }, + { + "name": "story.gmt_create", + "in": "query", + "description": "创建时间", + "required": false, + "type": "string", + "format": "date-time", + "x-example": "2019-04-14 19:02:12" + }, + { + "name": "story.id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int64", + "x-example": 1 + }, + { + "name": "story.name", + "in": "query", + "description": "故事名称", + "required": false, + "type": "string", + "x-example": "海底小纵队" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Category", + "originalRef": "Category" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "alipay.category.get", + "sop_version": "1.0" + }, + "put": { + "tags": [ + "故事接口" + ], + "summary": "获取分类信息", + "description": "演示表格树", + "operationId": "getCategoryUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "categoryName", + "in": "query", + "description": "分类名称", + "required": false, + "type": "string", + "x-example": "娱乐" + }, + { + "name": "story.gmt_create", + "in": "query", + "description": "创建时间", + "required": false, + "type": "string", + "format": "date-time", + "x-example": "2019-04-14 19:02:12" + }, + { + "name": "story.id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int64", + "x-example": 1 + }, + { + "name": "story.name", + "in": "query", + "description": "故事名称", + "required": false, + "type": "string", + "x-example": "海底小纵队" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Category", + "originalRef": "Category" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "alipay.category.get", + "sop_version": "1.0" + }, + "delete": { + "tags": [ + "故事接口" + ], + "summary": "获取分类信息", + "description": "演示表格树", + "operationId": "getCategoryUsingDELETE", + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "categoryName", + "in": "query", + "description": "分类名称", + "required": false, + "type": "string", + "x-example": "娱乐" + }, + { + "name": "story.gmt_create", + "in": "query", + "description": "创建时间", + "required": false, + "type": "string", + "format": "date-time", + "x-example": "2019-04-14 19:02:12" + }, + { + "name": "story.id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int64", + "x-example": 1 + }, + { + "name": "story.name", + "in": "query", + "description": "故事名称", + "required": false, + "type": "string", + "x-example": "海底小纵队" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Category", + "originalRef": "Category" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "alipay.category.get", + "sop_version": "1.0" + }, + "options": { + "tags": [ + "故事接口" + ], + "summary": "获取分类信息", + "description": "演示表格树", + "operationId": "getCategoryUsingOPTIONS", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "categoryName", + "in": "query", + "description": "分类名称", + "required": false, + "type": "string", + "x-example": "娱乐" + }, + { + "name": "story.gmt_create", + "in": "query", + "description": "创建时间", + "required": false, + "type": "string", + "format": "date-time", + "x-example": "2019-04-14 19:02:12" + }, + { + "name": "story.id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int64", + "x-example": 1 + }, + { + "name": "story.name", + "in": "query", + "description": "故事名称", + "required": false, + "type": "string", + "x-example": "海底小纵队" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Category", + "originalRef": "Category" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "alipay.category.get", + "sop_version": "1.0" + }, + "patch": { + "tags": [ + "故事接口" + ], + "summary": "获取分类信息", + "description": "演示表格树", + "operationId": "getCategoryUsingPATCH", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "categoryName", + "in": "query", + "description": "分类名称", + "required": false, + "type": "string", + "x-example": "娱乐" + }, + { + "name": "story.gmt_create", + "in": "query", + "description": "创建时间", + "required": false, + "type": "string", + "format": "date-time", + "x-example": "2019-04-14 19:02:12" + }, + { + "name": "story.id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int64", + "x-example": 1 + }, + { + "name": "story.name", + "in": "query", + "description": "故事名称", + "required": false, + "type": "string", + "x-example": "海底小纵队" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Category", + "originalRef": "Category" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "alipay.category.get", + "sop_version": "1.0" + } + }, + "/alipay.story.find/": { + "get": { + "tags": [ + "故事接口" + ], + "summary": "获取故事信息", + "description": "说明接口的详细信息,介绍,用途,注意事项等。", + "operationId": "getStory2UsingGET", + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int32", + "x-example": 111 + }, + { + "name": "name", + "in": "query", + "description": "故事名称", + "required": true, + "type": "string", + "x-example": "白雪公主" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/StoryVO", + "originalRef": "StoryVO" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "alipay.story.find", + "sop_version": "1.0" + }, + "head": { + "tags": [ + "故事接口" + ], + "summary": "获取故事信息", + "description": "说明接口的详细信息,介绍,用途,注意事项等。", + "operationId": "getStory2UsingHEAD", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int32", + "x-example": 111 + }, + { + "name": "name", + "in": "query", + "description": "故事名称", + "required": true, + "type": "string", + "x-example": "白雪公主" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/StoryVO", + "originalRef": "StoryVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "alipay.story.find", + "sop_version": "1.0" + }, + "post": { + "tags": [ + "故事接口" + ], + "summary": "获取故事信息", + "description": "说明接口的详细信息,介绍,用途,注意事项等。", + "operationId": "getStory2UsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int32", + "x-example": 111 + }, + { + "name": "name", + "in": "query", + "description": "故事名称", + "required": true, + "type": "string", + "x-example": "白雪公主" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/StoryVO", + "originalRef": "StoryVO" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "alipay.story.find", + "sop_version": "1.0" + }, + "put": { + "tags": [ + "故事接口" + ], + "summary": "获取故事信息", + "description": "说明接口的详细信息,介绍,用途,注意事项等。", + "operationId": "getStory2UsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int32", + "x-example": 111 + }, + { + "name": "name", + "in": "query", + "description": "故事名称", + "required": true, + "type": "string", + "x-example": "白雪公主" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/StoryVO", + "originalRef": "StoryVO" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "alipay.story.find", + "sop_version": "1.0" + }, + "delete": { + "tags": [ + "故事接口" + ], + "summary": "获取故事信息", + "description": "说明接口的详细信息,介绍,用途,注意事项等。", + "operationId": "getStory2UsingDELETE", + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int32", + "x-example": 111 + }, + { + "name": "name", + "in": "query", + "description": "故事名称", + "required": true, + "type": "string", + "x-example": "白雪公主" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/StoryVO", + "originalRef": "StoryVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "alipay.story.find", + "sop_version": "1.0" + }, + "options": { + "tags": [ + "故事接口" + ], + "summary": "获取故事信息", + "description": "说明接口的详细信息,介绍,用途,注意事项等。", + "operationId": "getStory2UsingOPTIONS", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int32", + "x-example": 111 + }, + { + "name": "name", + "in": "query", + "description": "故事名称", + "required": true, + "type": "string", + "x-example": "白雪公主" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/StoryVO", + "originalRef": "StoryVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "alipay.story.find", + "sop_version": "1.0" + }, + "patch": { + "tags": [ + "故事接口" + ], + "summary": "获取故事信息", + "description": "说明接口的详细信息,介绍,用途,注意事项等。", + "operationId": "getStory2UsingPATCH", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "description": "故事ID", + "required": false, + "type": "integer", + "format": "int32", + "x-example": 111 + }, + { + "name": "name", + "in": "query", + "description": "故事名称", + "required": true, + "type": "string", + "x-example": "白雪公主" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/StoryVO", + "originalRef": "StoryVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "alipay.story.find", + "sop_version": "1.0" + } + }, + "/demo.file.upload/": { + "get": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例1", + "description": "上传文件demo", + "operationId": "file1UsingGET", + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "file1", + "in": "query", + "description": "文件1", + "required": true, + "type": "file" + }, + { + "name": "file2", + "in": "query", + "description": "文件2", + "required": true, + "type": "file" + }, + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "demo.file.upload", + "sop_version": "1.0" + }, + "head": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例1", + "description": "上传文件demo", + "operationId": "file1UsingHEAD", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "file1", + "in": "query", + "description": "文件1", + "required": true, + "type": "file" + }, + { + "name": "file2", + "in": "query", + "description": "文件2", + "required": true, + "type": "file" + }, + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "demo.file.upload", + "sop_version": "1.0" + }, + "post": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例1", + "description": "上传文件demo", + "operationId": "file1UsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "file1", + "in": "query", + "description": "文件1", + "required": true, + "type": "file" + }, + { + "name": "file2", + "in": "query", + "description": "文件2", + "required": true, + "type": "file" + }, + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "demo.file.upload", + "sop_version": "1.0" + }, + "put": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例1", + "description": "上传文件demo", + "operationId": "file1UsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "file1", + "in": "query", + "description": "文件1", + "required": true, + "type": "file" + }, + { + "name": "file2", + "in": "query", + "description": "文件2", + "required": true, + "type": "file" + }, + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "demo.file.upload", + "sop_version": "1.0" + }, + "delete": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例1", + "description": "上传文件demo", + "operationId": "file1UsingDELETE", + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "file1", + "in": "query", + "description": "文件1", + "required": true, + "type": "file" + }, + { + "name": "file2", + "in": "query", + "description": "文件2", + "required": true, + "type": "file" + }, + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "demo.file.upload", + "sop_version": "1.0" + }, + "options": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例1", + "description": "上传文件demo", + "operationId": "file1UsingOPTIONS", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "file1", + "in": "query", + "description": "文件1", + "required": true, + "type": "file" + }, + { + "name": "file2", + "in": "query", + "description": "文件2", + "required": true, + "type": "file" + }, + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "demo.file.upload", + "sop_version": "1.0" + }, + "patch": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例1", + "description": "上传文件demo", + "operationId": "file1UsingPATCH", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "file1", + "in": "query", + "description": "文件1", + "required": true, + "type": "file" + }, + { + "name": "file2", + "in": "query", + "description": "文件2", + "required": true, + "type": "file" + }, + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "demo.file.upload", + "sop_version": "1.0" + } + }, + "/demo.file.upload2/": { + "get": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例2", + "description": "可上传多个文件", + "operationId": "file2UsingGET", + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "multiple": "multiple", + "sop_name": "demo.file.upload2", + "sop_version": "1.0" + }, + "head": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例2", + "description": "可上传多个文件", + "operationId": "file2UsingHEAD", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "multiple": "multiple", + "sop_name": "demo.file.upload2", + "sop_version": "1.0" + }, + "post": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例2", + "description": "可上传多个文件", + "operationId": "file2UsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "multiple": "multiple", + "sop_name": "demo.file.upload2", + "sop_version": "1.0" + }, + "put": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例2", + "description": "可上传多个文件", + "operationId": "file2UsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "multiple": "multiple", + "sop_name": "demo.file.upload2", + "sop_version": "1.0" + }, + "delete": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例2", + "description": "可上传多个文件", + "operationId": "file2UsingDELETE", + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "multiple": "multiple", + "sop_name": "demo.file.upload2", + "sop_version": "1.0" + }, + "options": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例2", + "description": "可上传多个文件", + "operationId": "file2UsingOPTIONS", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "multiple": "multiple", + "sop_name": "demo.file.upload2", + "sop_version": "1.0" + }, + "patch": { + "tags": [ + "文件上传" + ], + "summary": "文件上传例2", + "description": "可上传多个文件", + "operationId": "file2UsingPATCH", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "remark", + "in": "query", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/FileUploadVO", + "originalRef": "FileUploadVO" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "multiple": "multiple", + "sop_name": "demo.file.upload2", + "sop_version": "1.0" + } + }, + "/story2/getStory4": { + "get": { + "tags": [ + "故事接口2" + ], + "summary": "获取故事信息2", + "description": "获取故事信息2的详细信息", + "operationId": "storygetUsingGET", + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Story", + "originalRef": "Story" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "story2.getStory4", + "sop_version": "1.4" + }, + "head": { + "tags": [ + "故事接口2" + ], + "summary": "获取故事信息2", + "description": "获取故事信息2的详细信息", + "operationId": "storygetUsingHEAD", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Story", + "originalRef": "Story" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "story2.getStory4", + "sop_version": "1.4" + }, + "post": { + "tags": [ + "故事接口2" + ], + "summary": "获取故事信息2", + "description": "获取故事信息2的详细信息", + "operationId": "storygetUsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Story", + "originalRef": "Story" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "story2.getStory4", + "sop_version": "1.4" + }, + "put": { + "tags": [ + "故事接口2" + ], + "summary": "获取故事信息2", + "description": "获取故事信息2的详细信息", + "operationId": "storygetUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Story", + "originalRef": "Story" + } + }, + "201": { + "description": "Created" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + }, + "deprecated": false, + "sop_name": "story2.getStory4", + "sop_version": "1.4" + }, + "delete": { + "tags": [ + "故事接口2" + ], + "summary": "获取故事信息2", + "description": "获取故事信息2的详细信息", + "operationId": "storygetUsingDELETE", + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Story", + "originalRef": "Story" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "story2.getStory4", + "sop_version": "1.4" + }, + "options": { + "tags": [ + "故事接口2" + ], + "summary": "获取故事信息2", + "description": "获取故事信息2的详细信息", + "operationId": "storygetUsingOPTIONS", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Story", + "originalRef": "Story" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "story2.getStory4", + "sop_version": "1.4" + }, + "patch": { + "tags": [ + "故事接口2" + ], + "summary": "获取故事信息2", + "description": "获取故事信息2的详细信息", + "operationId": "storygetUsingPATCH", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Story", + "originalRef": "Story" + } + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + }, + "deprecated": false, + "sop_name": "story2.getStory4", + "sop_version": "1.4" + } + } + }, + "definitions": { + "Category": { + "type": "object", + "properties": { + "categoryName": { + "type": "string", + "example": "娱乐", + "description": "分类名称" + }, + "story": { + "description": "分类故事", + "$ref": "#/definitions/StoryVO", + "originalRef": "StoryVO" + } + }, + "title": "Category" + }, + "FileMeta": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "size": { + "type": "integer", + "format": "int64" + } + }, + "title": "FileMeta" + }, + "FileUploadVO": { + "type": "object", + "properties": { + "files": { + "type": "array", + "items": { + "$ref": "#/definitions/FileMeta", + "originalRef": "FileMeta" + } + } + }, + "title": "FileUploadVO" + }, + "Story": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "name": { + "type": "string" + } + }, + "title": "Story" + }, + "StoryVO": { + "type": "object", + "properties": { + "gmt_create": { + "type": "string", + "format": "date-time", + "example": "2019-04-14 19:02:12", + "description": "创建时间" + }, + "id": { + "type": "integer", + "format": "int64", + "example": 1, + "description": "故事ID" + }, + "name": { + "type": "string", + "example": "海底小纵队", + "description": "故事名称" + } + }, + "title": "StoryVO" + } + } +} \ No newline at end of file