OpenAPI3.0やCloudFormationのYamlをVSCodeで作成する方法

OpenAPI3.0やCloudFormationのYamlをVSCodeで作成する方法

OpenAPI3.0のYamlをVSCodeで書いていきます。

便利なプラグインを入れて多少でも効率よく書きたいものなので「YAML Red Hat」プラグインを入れます。

OpenAPI3.0のYamlをVSCodeで作成する方法

ctrl + ,でsettings.jsonを開きます。

以下を追記します。JSONスキーマは「https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v3.0/schema.json」を指定します。

  "yaml.schemas": {
    "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v3.0/schema.json": ["*.yaml", "*.yml"]
  },
  "yaml.format.enable": true,
  "yaml.hover": true,
  "yaml.schemaStore.enable": true,
  "yaml.completion": true,
  "yaml.validate": true

.yamlと.ymlファイルはOpenAPI3.0形式でコード保管やフォーマッター、hover時にエラー内容などが表示されるようになります。

非常に便利です。

OpenAPI3.0のYamlをVSCodeで作成する方法

CloudFormation用のsettings.json

OpenAPI3.0のJSONスキーマと被らないようにファイル名と拡張子で指定しておきます。

"yaml.schemas": {
    "https://d33vqc0rt9ld30.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json": [
        "*.cf.yaml",
        "*.cf.yml",
        "cloud*formation/*.yaml",
        "cloud*formation/*.yml"
   ]
}

AWS CloudFormation リソース仕様

コメント

株式会社CONFRAGE ITソリューション事業部をもっと見る

今すぐ購読し、続きを読んで、すべてのアーカイブにアクセスしましょう。

続きを読む

タイトルとURLをコピーしました