Visual Studio Code plugin to make it easier to develop against Harness

Visual Studio Code plugin to make it easier to develop against Harness

This document walks you through the steps to follow to use the visual studio code plugin to make it easier to develop against Harness with some basic checks on syntax and object names.

  • This is possible with the existing plugin. which you can download from the marketplace YAML - Visual Studio Marketplace

  • JSON schemas describe the shape of the JSON file, as well as value sets and default values, which aHarnessnessthe JSON language support to provide completion proposals.

  • Once downloaded, you can include our schema JSON as part of it.

  • You can fetch the schema from harness using the below cURL command:

curl -i -X GET \ 
'https://app.harness.io/gateway/pipeline/api/yaml-schema?entityType=Pipelines&projectIdentifier=<project identifier>&orgIdentifier=<org identifier>&accountIdentifier=<account identifier>&scope=project' \
 -H 'x-api-key: <YOUR_API_KEY_HERE>'
  • Don’t forget to replace projectId, orgId, accountId and in the above cURL Command.

  • Once downloaded save this in your local in my case it is test.json.

  • Set the “$scheme” property in a #json file to apply a schema to it(test.json).

  • Schemas validate your json and provide IntelliSense while writing it.

  • The “$schema” can be a local file or hosted on a website

  • Then you can make use the same in your VS Code like shown below to develop against Harness:

You can find more information on how to use JSON schemas and settings in Visual studio code here: JSON editing in Visual Studio Code

4 Likes