{"id":299305,"date":"2021-01-18T07:01:02","date_gmt":"2021-01-17T23:01:02","guid":{"rendered":"http:\/\/4563.org\/?p=299305"},"modified":"2021-01-18T07:01:02","modified_gmt":"2021-01-17T23:01:02","slug":"%e6%9c%89%e7%94%a8%e8%bf%87-go-swagger-%e7%9a%84%e5%a4%a7%e4%bd%ac%e4%b9%88-%e8%af%b7%e6%95%99%e5%87%a0%e4%b8%aa%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=299305","title":{"rendered":"\u6709\u7528\u8fc7 go-swagger \u7684\u5927\u4f6c\u4e48 \u8bf7\u6559\u51e0\u4e2a\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6709\u7528\u8fc7 go-swagger \u7684\u5927\u4f6c\u4e48 \u8bf7\u6559\u51e0\u4e2a\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Goat121 <\/span>  <span><i><\/i> 8<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h1>1. \u6211\u5728\u670d\u52a1\u5668\u4e0a\u7528 swagger serve \u628a\u670d\u52a1\u542f\u5728 7500 \u7aef\u53e3\uff0c\u70b9\u6d4b\u8bd5\u7684\u65f6\u5019\u4e5f\u8bbf\u95ee\u4e86 7500\uff0c\u4f46\u662f\u6211\u8981\u6d4b\u8bd5\u7684\u4e1a\u52a1\u542f\u5728 7501\uff0c\u600e\u4e48\u89e3\u51b3\u8fd9\u4e2a\u554a<\/h1>\n<p> <\/p>\n<h1>2. \u6211\u6309\u5982\u4e0b\u683c\u5f0f\u5b9a\u4e49\u4e86\u4e00\u4e2a GET \u8bf7\u6c42\u7684 form \u53c2\u6570\uff0c\u65e0\u6cd5\u6b63\u786e\u663e\u793a\u3002\u8fd9\u79cd\u8be5\u600e\u4e48\u5b9a\u4e49\u5462\uff1f<\/h1>\n<p> <\/p>\n<pre><code>\/\/ swagger:parameters download type download struct {  \/\/ in: path  resource.DownloadIn }  type DownloadIn struct {  ResourceId string `form:\"resourceId\" binding:\"required\"` } <\/code><\/pre>\n<h1>3. \u8fd4\u56de\u53c2\u6570\u6309\u5982\u4e0b\u5b9a\u4e49\uff0c\u80fd\u6b63\u5e38\u663e\u793a\u4f46\u662f code \u503c\u4e00\u76f4\u662f 0\uff0c\u6211\u60f3\u663e\u793a\u4e3a 200\uff0c\u6709\u529e\u6cd5\u4e48\uff1f<\/h1>\n<p> <\/p>\n<pre><code>\/\/ Success response \/\/ swagger:response downloadWrapper type downloadWrapper struct {  \/\/ in: body  Body struct {   Code int                `json:\"code\"`   Msg  resource.UploadOut `json:\"msg\"`  } } <\/code><\/pre>\n<p>\u591a\u8c22\u6307\u6559      <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5012512\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : pwli <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. nginx \u8f6c\u53d1\u4e0b\uff1f|| \u81ea\u5df1\u6e32\u67d3 swagger<br \/>2. \/\/ in: path \u4ee3\u8868\u8def\u7531\u53c2\u6570\uff0c\u8c8c\u4f3c\u4e0d\u80fd\u662f\u590d\u5408\u7ed3\u6784<br \/>3. \/\/ example: 200                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5012513\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jindeq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u770b\u61c2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5012514\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Goat121 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @pwli \u975e\u5e38\u611f\u8c22\u5927\u4f6c\uff01\u90fd\u89e3\u51b3\u5566                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u7528\u8fc7 go-swagger \u7684\u5927&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/299305"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=299305"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/299305\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299305"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}