{"id":2794,"date":"2022-08-07T08:19:45","date_gmt":"2022-08-06T23:19:45","guid":{"rendered":"https:\/\/blog.wsd.sh\/?p=2794"},"modified":"2022-08-07T17:26:33","modified_gmt":"2022-08-07T08:26:33","slug":"spectral-cli%e3%81%ae%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/blog.wsd.sh\/?p=2794","title":{"rendered":"<small>spectral-cli\u306e\u4f7f\u7528<\/small>"},"content":{"rendered":"<p>1.install<\/p>\n<pre>\r\n# npm install -g @stoplight\/spectral-cli\r\n<\/pre>\n<p>2.\u8a2d\u5b9a<\/p>\n<pre>\r\n# echo '{\\n\\t\"extends\": [\"spectral:oas\"]\\n}' > .spectral.json\r\n<\/pre>\n<p>3.version<\/p>\n<pre>\r\n# spectral --version\r\n6.5.0\r\n#\r\n<\/pre>\n<p>4.lint \u5b9f\u884c<\/p>\n<pre>\r\n# spectral lint openapi.yml\r\nNo results with a severity of 'error' found!#\r\n<\/pre>\n<p>5.\u4e0a\u306e\u7d50\u679c<br \/>\nExcute\u306ebutton\u304c\u62bc\u305b\u306a\u3044\u7406\u7531\u304c\u8868\u793a\u3055\u308c\u306a\u3044<\/p>\n<pre>\r\n# spectral lint openapi.yml -F warn\r\nNo results with a severity of 'warn' or higher found!#\r\n# spectral lint openapi.yml -F error\r\nNo results with a severity of 'error' found!#\r\n# spectral lint openapi.yml -F info\r\nNo results with a severity of 'info' or higher found!#\r\n# spectral lint openapi.yml -F hint\r\nNo results with a severity of 'hint' or higher found!#\r\n<\/pre>\n<p>6. \u4ee3\u308f\u308a\u306b\u3001Swagger\/OpenAPI online validator\u3092\u4f7f\u3046<br \/>\nhttps:\/\/apitools.dev\/swagger-parser\/online\/<br \/>\n&#8211; After pasting, just press the [Validate it!].<br \/>\n&#8211; result<\/p>\n<pre>\r\nbad indentation of a mapping entry at line 173, column 16:\r\n               name: contactType\r\n                   ^\r\n\r\nError: bad indentation of a mapping entry at line 173, column 16:\r\n               name: contactType\r\n                   ^\r\n<\/pre>\n<p>&#8211; Excute\u306ebutton\u304c\u62bc\u305b\u306a\u3044\u539f\u56e0\u306e\u884c\u3092\u6307\u793a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.install # npm install -g @stoplight\/spectral-cli 2.\u8a2d\u5b9a # echo &#8216;{\\n\\t&#8221;extends&#8221;: [&#8220;spectral:oas&#8221;]\\n}&#8217; > .spectr&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/2794"}],"collection":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2794"}],"version-history":[{"count":14,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/2794\/revisions"}],"predecessor-version":[{"id":2796,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/2794\/revisions\/2796"}],"wp:attachment":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}