{"id":3920,"date":"2022-11-30T22:17:40","date_gmt":"2022-11-30T13:17:40","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/?p=3920"},"modified":"2022-11-30T22:20:05","modified_gmt":"2022-11-30T13:20:05","slug":"sdd-hands-on","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2022\/11\/30\/sdd-hands-on\/","title":{"rendered":"\u30b9\u30ad\u30fc\u30de\u99c6\u52d5\u958b\u767a\u30cf\u30f3\u30ba\u30aa\u30f3\u3092\u5b9f\u8df5\u3059\u308b"},"content":{"rendered":"
\u672c\u8a18\u4e8b\u3067\u306f\u3001\u30b9\u30ad\u30fc\u30de\u99c6\u52d5\u958b\u767a\uff08SDD\uff09\u3092\u30cf\u30f3\u30ba\u30aa\u30f3\u7684\u306b\u5b9f\u8df5\u3057\u3066\u307f\u307e\u3059\u3002
\n\u6d41\u308c\u3068\u3057\u3066\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3067\u3059<\/p>\n
API\u5b9a\u7fa9\u3092\u521d\u3081\u306b\u884c\u3044\u3001\u5b9a\u7fa9\u3055\u308c\u305fAPI\u306e\u4ed5\u69d8\u3092\u3082\u3068\u306b\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u30fb\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306e\u5b9f\u88c5\u3092\u9032\u3081\u308b\u958b\u767a\u624b\u6cd5\u3092\u30b9\u30ad\u30fc\u30de\u99c6\u52d5\u958b\u767a\uff08SDD\uff09\u3068\u8a00\u3044\u307e\u3059\u3002API\u5b9a\u7fa9\u306e\u30c7\u30d5\u30a1\u30af\u30c8\u30b9\u30bf\u30f3\u30c0\u30fc\u30c9\u3067\u3042\u308bOpen API\u306b\u306f\u8c4a\u5bcc\u306a\u5468\u8fba\u30c4\u30fc\u30eb\u304c\u5b58\u5728\u3057\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30fb\u30b5\u30fc\u30d0\u30b5\u30a4\u30c9\u306e\u30b3\u30fc\u30c9\u306e\u81ea\u52d5\u51fa\u529b\u3084\u30e2\u30c3\u30ad\u30f3\u30b0\u7b49\u3092\u7c21\u5358\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002SDD\u306b\u5247\u308a\u958b\u767a\u3092\u9032\u3081\u308b\u3053\u3068\u3067\u3001\u3053\u308c\u3089\u306e\u30c4\u30fc\u30eb\u306e\u6069\u6075\u3092\u53d7\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u958b\u767a\u30b9\u30d4\u30fc\u30c9\u306e\u5411\u4e0a\u304c\u671f\u5f85\u3067\u304d\u307e\u3059\u3002<\/p>\n
\u4eca\u56de\u306e\u30cf\u30f3\u30ba\u30aa\u30f3\u3067\u306fAPI\u5b9a\u7fa9\u306bStoplight<\/a>\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002 Stoplight\u306f\u30d6\u30e9\u30a6\u30b6\u30fb\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30a2\u30d7\u30ea\u306e\u4e8c\u7a2e\u985e\u306e\u5b9f\u884c\u65b9\u6cd5\u3092\u9078\u3076\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30a2\u30d7\u30ea\u3092\u5229\u7528\u3057\u307e\u3059\u3002 Stoplight\u3067\u306f\u3001\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u9023\u643a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Stoplight\u4e0a\u3067\u5909\u66f4\u3092\u5b8c\u7d50\u3067\u304d\u308b\u306e\u9023\u643a\u3057\u3066\u304a\u304f\u3068\u4fbf\u5229\u3067\u3059\u3002 \u74b0\u5883<\/strong> API\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002git\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u9023\u643a\u3059\u308b\u3068project\u3068\u3057\u3066\u30db\u30fc\u30e0\u753b\u9762\u53f3\u306b\u8868\u793a\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30af\u30ea\u30c3\u30af\u3057\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u753b\u9762\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002 <\/p>\n API\u4f5c\u6210\u5f8c\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067User\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u307e\u3059\uff08\u753b\u50cf\u53c2\u7167\uff09\u3002\u4eca\u56de\u306f\u81ea\u524d\u3067API\u3092\u5b9f\u88c5\u305b\u305a\u3001\u3053\u306eUser\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n <\/p>\n \u53f3\u4e0a\u306e\u30dc\u30bf\u30f3\u3067\u30d5\u30a9\u30fc\u30e0\u5165\u529b\u30fb\u30b3\u30fc\u30c9\u5165\u529b\u3092\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u76f4\u63a5yaml\u3092\u7de8\u96c6\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u5b9f\u969b\u306e\u958b\u767a\u6642\u306f\u5909\u66f4\u306e\u898f\u6a21\u306b\u5408\u308f\u305b\u3066\u4f7f\u3044\u5206\u3051\u3066\u5229\u7528\u3059\u308b\u611f\u3058\u306b\u306a\u306a\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u5927\u898f\u6a21\u306a\u4fee\u6b63\u304c\u5fc5\u8981\u306b\u306a\u308b\u5834\u5408\u306fStoplight\u3067\u306f\u306a\u304f\u3001\u305d\u306e\u4ed6\u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u7de8\u96c6\u4f5c\u696d\u3092\u884c\u306a\u3063\u305f\u65b9\u304c\u52b9\u7387\u304c\u826f\u3044\u5834\u5408\u3082\u3042\u308b\u306e\u3067\u3001\u305d\u3053\u306f\u81e8\u6a5f\u5fdc\u5909\u306b\u5bfe\u5fdc\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n <\/p>\n Stoplight\u304c\u63d0\u4f9b\u3057\u3066\u3044\u308bPrism<\/a>\u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u7528\u3057\u3066\u3001\u524d\u7bc0\u3067\u4f5c\u6210\u3057\u305f API\u3092\u30e2\u30c3\u30ad\u30f3\u30b0\u3057\u307e\u3059\u3002<\/p>\n \u3053\u3061\u3089<\/a>\u3092\u53c2\u8003\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n \u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068API\u5b9a\u7fa9\u3092\u3082\u3068\u306b\u30b5\u30f3\u30d7\u30eb\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u8fd4\u3059\u30e2\u30c3\u30af\u30b5\u30fc\u30d0\u3092\u958b\u59cb\u3067\u304d\u307e\u3059\u3002<\/p>\n \u5b9f\u884c\u7d50\u679c<\/strong><\/p>\n Stoplight\u3067\u5b9a\u7fa9\u3057\u305f\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u304c\u30db\u30b9\u30c8\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n Prism\u3067\u306fOpenAPI\u306eExample\u30bf\u30b0\u3067\u5b9a\u7fa9\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30e2\u30c3\u30af\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u3068\u3057\u3066\u8fd4\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Stoplight\u3060\u3068\u753b\u50cf\u306e\u4f4d\u7f6e\u3067\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n <\/p>\n \u4e0a\u8a18\u753b\u50cf\u306b\u3042\u308b\u300cGet User Alice Smith\u300d\u30ec\u30b9\u30dd\u30f3\u30b9\u304c\u8fd4\u3063\u3066\u304f\u308b\u304b\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n \u5b9f\u884c\u7d50\u679c<\/strong><\/p>\n \u3053\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u7c21\u5358\u306b\u30e2\u30c3\u30ad\u30f3\u30b0\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n
\nStoplight\u3067\u306fOpenAPI\u306e\u5b9a\u7fa9\u3092GUI\u4e0a\u3067\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u3001OpenAPI\u306e\u8a18\u8ff0\u65b9\u6cd5\u3092\u5b66\u3076\u3053\u3068\u306a\u304f\u7c21\u5358\u306bAPI\u5b9a\u7fa9\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\u6e96\u5099<\/h4>\n
\n\u3053\u3061\u3089<\/a>\u304b\u3089\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30a2\u30d7\u30ea\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30fb\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n
\n\u3053\u306e\u30cf\u30f3\u30ba\u30aa\u30f3\u3067\u306fapi-scheme-practice\u3068\u3044\u3046\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u3053\u306e\u4e2d\u3067\u4f5c\u696d\u3057\u307e\u3059\u3002<\/p>\n
\nNode.js v18.12.1
\nyarn v1.22.10<\/p>\nAPI\u4f5c\u6210<\/h4>\n
\n\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u753b\u9762\u306b\u79fb\u52d5\u5f8c\u3001 \u300cCreate\u300d\u306b\u3042\u308b\u300cAPI\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001API\u4f5c\u6210\u30c0\u30a4\u30a2\u30ed\u30b0\u304c\u51fa\u308b\u306e\u3067\u3001API\u540d\u3092\u5165\u529b\u3057\u300cCreate\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u4f5c\u6210\u3057\u307e\u3059\uff08\u753b\u50cf\u53c2\u7167\uff09\u3002API\u4f5c\u6210\u304c\u6210\u529f\u3057\u3066\u3044\u308c\u3070\u3001reference\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306b\u6307\u5b9a\u3057\u305fAPI\u540d.yaml\u306e\u5f62\u3067\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n2. Prism\u3067\u30e2\u30c3\u30ad\u30f3\u30b0<\/h3>\n
\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n
yarn global add @stoplight\/prism-cli<\/code><\/pre>\n
\u5b9f\u884c<\/h4>\n
prism mock reference\/api-scheme-practice.yaml<\/code><\/pre>\n
[21:34:05] \u203a [CLI] \u2026 awaiting Starting Prism\u2026\n[21:34:05] \u203a [CLI] \u2139 info GET http:\/\/127.0.0.1:4010\/users\/77\n[21:34:05] \u203a [CLI] \u2139 info PATCH http:\/\/127.0.0.1:4010\/users\/655\n[21:34:05] \u203a [CLI] \u2139 info POST http:\/\/127.0.0.1:4010\/user\n[21:34:05] \u203a [CLI] \u25b6 start Prism is listening on http:\/\/127.0.0.1:4010<\/code><\/pre>\n
\u52d5\u4f5c\u78ba\u8a8d<\/h4>\n
curl -X GET 'http:\/\/localhost:4010\/users\/836'<\/code><\/pre>\n
{"id":142,"firstName":"Alice","lastName":"Smith","email":"alice.smith@gmail.com","dateOfBirth":"1997-10-31","emailVerified":true,"signUpDate":"2019-08-24"}% \n<\/code><\/pre>\n
3. OpenAPI Generator\u3067\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b3\u30fc\u30c9\u751f\u6210<\/h3>\n