{"id":164991,"date":"2020-10-01T22:48:31","date_gmt":"2020-10-01T14:48:31","guid":{"rendered":"http:\/\/4563.org\/?p=164991"},"modified":"2020-10-01T22:48:31","modified_gmt":"2020-10-01T14:48:31","slug":"%e6%9c%89%e4%ba%ba%e7%94%a8%e8%bf%87-swagger-codegen-%e4%b9%8b%e7%b1%bb%e7%9a%84%e5%b7%a5%e5%85%b7%e4%b9%88","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=164991","title":{"rendered":"\u6709\u4eba\u7528\u8fc7 Swagger CodeGen \u4e4b\u7c7b\u7684\u5de5\u5177\u4e48"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6709\u4eba\u7528\u8fc7 Swagger CodeGen \u4e4b\u7c7b\u7684\u5de5\u5177\u4e48               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : calmzhu <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<ul>\n<li>\u5b9a\u4e49\u597d OpenAPI schema \u3002\u5373\u53ef\u81ea\u52a8\u751f\u6210 REST API \u7684\u5de5\u5177\u3002<\/li>\n<li>\u5355\u72ec model \u7684 CRUD \u5c31\u884c\uff0c\u4e0d\u9700\u8981\u6570\u636e\u5e93\u7684\u5173\u7cfb\u3002<\/li>\n<li>\u6c42\u7956\u5e08\u7237\u4eec\u7838\u996d\u7897<\/li>\n<\/ul>\n<p>\u987a\u4fbf\uff0c \u4eba\u5de5\u667a\u80fd\u81ea\u52a8\u5199\u4ee3\u7801\u4e0a\u5929\u8fd9\u4e48\u4e45\u4e86\u3002\u548b\u6837\u4e86\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3626394\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : passerbytiny <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             schema \u8f6c\u4ee3\u7801\u7684\u65b9\u6cd5\u7b7e\u540d\u90e8\u5206\u8fd8\u80fd\u627e\u627e\uff0c\u8981\u8fde\u65b9\u6cd5\u4f53\u751a\u81f3 CURD \u90fd\u81ea\u52a8\u751f\u6210\u7684\u8bdd\uff0c\u5efa\u8bae\u8f9e\u6389\u7a0b\u5e8f\u5458\u6362\u6210\u5ec9\u4ef7\u5916\u5305\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3626395\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : crclz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. \u4e1a\u52a1\u4ee3\u7801\u5176\u5b9e\u662f\u5bf9\u73b0\u5b9e\u4e16\u754c\u4e1a\u52a1\u89c4\u5219\u7684\u63cf\u8ff0\uff0c\u8fd9\u79cd\u63cf\u8ff0\u662f\u9700\u8981\u4eba\u7c7b\u5927\u8111\u6765\u8f6c\u6362\u5230\u4ee3\u7801\u3002\u4e1a\u52a1\u4ee3\u7801\u548c\u5355\u7eaf\u7684 CRUD \u6709\u5f88\u5927\u533a\u522b\u3002<\/p>\n<p>2. \u4f60\u7684\u8fd9\u4e2a\u5e16\u5b50\u6211\u770b\u4e0d\u592a\u61c2                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3626396\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : calmzhu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @passerbytiny <\/p>\n<p>\u61d2\u60f0\u662f\u7b2c\u4e00\u751f\u4ea7\u529b,\u5077\u61d2\u90fd\u4e0d\u4f1a\u7684\u8bdd\uff0c\u5efa\u8bae\u53bb\u642c\u7816\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3626397\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : calmzhu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @passerbytiny <\/p>\n<p>\u53ea\u8981\u4e1a\u52a1\u4ee3\u7801\u5bf9\u5355\u4e2a\u5b9e\u4f53\u7684\u7684 CRUD \u90e8\u5206<br \/>\u53ef\u4ee5\u7406\u89e3\u4e3a\u901a\u8fc7 RESTAPI \u5bf9\u6570\u636e\u5e93\u91cc\u9762\u7684\u5355\u5f20\u8868\u8fdb\u884c\u64cd\u4f5c\u3002\u5e76\u4e14\u6240\u6709\u6570\u636e\u5e93\u8868\u4e4b\u95f4\u65e0\u4efb\u4f55\u8054\u7cfb\u3002 \u4ea4\u4e92\u903b\u8f91\u4f1a\u5728\u5176\u4ed6\u5c42\u505a\u3002<br \/>\u73b0\u5728\u5199\u4e00\u4e2a\u7684\u8bdd\u7565\u7e41\u7410\u3002\u6bd4\u5982\u52a0\u4e00\u4e2a\u8868<\/p>\n<p>\u8981\u5b9a\u4e49 MODEL \/Validation\/View\/Contriller<\/p>\n<p>\u6700\u4e3b\u8981\u662f\u63a5\u53e3\u6587\u6863\u8ddf\u6d4b\u8bd5\u7528\u4f8b\u5bf9\u8f93\u5165\u6570\u636e\u7684\u6821\u9a8c\u592a\u7e41\u7410\u4e86\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3626398\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mtmax <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u54c8\u54c8 \u6211\u521a\u5165\u884c\u65f6\u5199\u8fc7 \u4e0d\u8fc7\u662f\u901a\u8fc7 service \u548c model \u4ee3\u7801\u81ea\u52a8\u751f\u6210 swagger \u6ce8\u89e3 \u5c31\u662f\u90a3\u4e00\u5806 @ApiOperation @ApiModel \u7b49<\/p>\n<p>\u539f\u56e0\u662f\u540c\u4e8b\u5199\u4ee3\u7801\u90fd\u4e0d\u5199 swagger \u7136\u540e leader \u8981\u6211\u53bb\u8865 swagger \u6587\u6863 \u90a3\u4e48\u591a\u63a5\u53e3 \u6211\u5c31\u5199\u4e86\u4e2a\u5de5\u5177\u7c7b\u53bb\u81ea\u52a8\u751f\u6210 <\/p>\n<p>\u4e3b\u8981\u539f\u7406\u5c31\u662f\u89e3\u6790\u5b57\u7b26\u4e32, \u7136\u540e\u5339\u914d\u7279\u70b9\u7684 kv \u7ffb\u8bd1\u6210\u4e2d\u6587, \u6ca1\u5339\u914d\u5230\u81ea\u52a8\u5f00\u542f\u767e\u5ea6\u7ffb\u8bd1 \u54c8\u54c8\u54c8\u73b0\u5728\u60f3\u8d77\u8fd8\u89c9\u5f97\u633a\u6709\u610f\u601d\u7684                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3626399\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u751f\u6210 curd \u554a\uff0c\u6211\u641e\u8fc7\uff1a<br \/>https:\/\/github.com\/fy0\/slim<\/p>\n<p>\u5c31\u662f\u6587\u6863\u5199\u7684\u4e0d\u597d\uff0c\u5b9e\u8df5\u4e86\u4e24\u4e09\u5e74\u4e86\uff0c\u6709\u4e9b API \u7684\u8bbe\u8ba1\u5b58\u5728\u95ee\u9898\uff0c\u6700\u8fd1\u6b63\u5728\u91cd\u6784\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3626400\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lychs1998 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u770b\u4e0a\u53bb\u662f\u2026\u2026\u4f4e\u4ee3\u7801\u5f00\u53d1\u5de5\u5177\uff1f\u80fd\u88ab\u751f\u6210\u7684\u4ee3\u7801\u4e1a\u52a1\u903b\u8f91\u80af\u5b9a\u4e0d\u590d\u6742\uff0c\u800c\u6709\u590d\u6742\u4e1a\u52a1\u903b\u8f91\u7684\u63a5\u53e3\u4e5f\u6ca1\u6cd5\u751f\u6210\u6216\u8005\u8bf4\u751f\u6210\u7684\u6210\u672c\u4e0d\u4f1a\u964d\u4f4e\u3002<\/p>\n<p>\u5176\u5b9e\u7f16\u7a0b\u8bed\u8a00\u5c31\u53ef\u4ee5\u7406\u89e3\u4e3a\u63cf\u8ff0\u4f60\u63a5\u53e3\u884c\u4e3a\u7684\u4e00\u79cd\u8bed\u8a00\uff0c\u53ea\u4e0d\u8fc7\u8fd9\u79cd\u8bed\u8a00\u4e0d\u6b62\u4e3a API \u63a5\u53e3\u7684\u6784\u5efa\u670d\u52a1\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u8bbe\u8ba1\u4e00\u79cd\u7075\u6d3b\u7684\u914d\u7f6e\u5f0f\u7684\u4ee3\u7801\u751f\u6210\u5de5\u5177\uff0c\u4f46\u63a5\u53e3\u7684\u5b9e\u73b0\u9700\u6c42\u8d8a\u7075\u6d3b\uff0c\u914d\u7f6e\u7684\u8fc7\u7a0b\u4e5f\u8d8a\u590d\u6742\uff0c\u5b66\u4e60\u6210\u672c\u4e5f\u8d8a\u5927\u3002\u6216\u8005\u5c31\u662f\u9075\u5faa\u4e00\u4e2a All in one \u7684\u63a5\u53e3\uff0c\u6bd4\u5982 Odata\uff0c\u670d\u52a1\u7aef\u914d\u7f6e\u5b8c\u540e\uff0c\u5269\u4e0b\u7684\u57fa\u672c\u5c31\u662f\u524d\u7aef\u7684\u4e8b\u60c5\u4e86\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3626401\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : calmzhu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @lychs1998 <br \/>\u662f\u7684\u3002\u5c31\u662f\u4f4e\u4ee3\u7801\u751a\u81f3\u65e0\u4ee3\u7801\u5f00\u53d1\u5de5\u5177\u3002<\/p>\n<p>\u73b0\u5728\u7684\u6846\u67b6\u529f\u80fd\u4e0d\u4ec5\u4ec5\u662f API \u6784\u5efa\u3002\u53ea\u662f\u9700\u8981 API \u6784\u5efa\u7684\u90e8\u5206\u3002 \u5e16\u5b50\u52a0\u4e86\u4e2a append \u90e8\u5206\u89e3\u91ca\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3626402\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : calmzhu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @calmzhu <br \/>\u4e0d\u7b97\u5f00\u53d1\u5de5\u5177\u5427\u3002\u5e76\u4e0d\u662f\u7ed9\u4e13\u804c\u7a0b\u5e8f\u5458\u7684\u3002\u800c\u662f\u9700\u8981\u7528\u5230\u4ee3\u7801\u7684\u5176\u4ed6\u5b66\u79d1\u4eba\u5458\u3002<br \/>\u6bd4\u5982\u6709\u7684\u6d41\u7a0b\u81ea\u52a8\u5316\u90e8\u5206\uff0c\u53ea\u662f\u9700\u8981\u901a\u8fc7 coding \u628a\u5b9e\u9645\u5bf9\u8c61\u505a\u4e2a\u5c55\u73b0\u6620\u5c04\u3002\u5b58\u7cb9\u7684 CRUD \u5c31\u591f\u4e86\uff08\u751a\u81f3\u53ea\u8981 UD \u90fd\u4e0d\u600e\u4e48\u7528\uff09\u3002\u5173\u6ce8\u70b9\u5e76\u4e0d\u5728 coding \u90e8\u5206\uff0c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u4eba\u7528\u8fc7 Swagger Code&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\/164991"}],"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=164991"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/164991\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=164991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=164991"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=164991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}