Using JSON Schema in Visual Studio Code for `ida-plugin.json`

Visual Studio Code provides out of the box support for JSON files, including features like validation and auto-completion. To enhance your experience with the ida-plugin.json file, you can use a JSON schema that defines the structure and constraints of the file.

Here’s how to set it up:

  1. Download the JSON schema file for ida-plugin-schema.json from the my gist.
  2. Save the schema file in a directory where you keep your project files, for example, ~/Documents/schemas/ida-plugin-schema.json.
  3. Open your Visual Studio Code settings json.schemas and click on “Edit in settings.json”.
  4. Add the following configuration to your ~/Library/Application Support/Code/User/settings.json file:
    "json.schemas": [
        {
            "fileMatch": [
                "**/ida-plugin.json",
            ],
            "url": "/Users/<username>/Documents/schemas/ida-plugin-schema.json"
        }
    ],
  1. Make sure to adjust the url path to point to where you saved the schema file.
  2. Save the settings file.

From now on, when you open the ida-plugin.json file in Visual Studio Code, it will automatically validate against the schema and provide auto-completion for the fields defined in the schema.
This setup will help you ensure that your ida-plugin.json file adheres to the documentation and make it easier to develop IDA Pro plugins.

As an alternative, you can reference the schema directly in your settings.json file:

    "json.schemas": [
        {
            "fileMatch": [
                "**/ida-plugin.json",
            ],
            "url": "https://gist.githubusercontent.com/milankovo/a1ee7254053e384735010d1da9d91bcc/raw/d1dec1ba08c7c42e13f4ee3a9fcf23951b34e895/ida-plugin.schema.json"
        }
    ],

But that is not very privacy friendly and will not work if you are offline. So I recommend downloading the schema file and using the local path as described above.

Warning: Don’t look at the regular expression for idaVersions, it was automatically generated from the semver grammar and might induce you a headache.

2 Likes

Hello @Milanek,
It’s fantastic to see a JSON schema for the ida-plugin.json!
Thank you for taking the time to set it up for the benefit of the community and explain how to set it up step-by-step. We appreciate it, as this is the kind of tweak that makes preparing a plugin for submission a far more user-friendly experience.
I can imagine how this will make working with ida-plugin.json much smoother and less error-prone.

Another option is to add::

  "$schema": "https://gist.githubusercontent.com/milankovo/a1ee7254053e384735010d1da9d91bcc/raw/d1dec1ba08c7c42e13f4ee3a9fcf23951b34e895/ida-plugin.schema.json",

To the JSON itself. @teresa_hexrays If you could host it on your domain and add it to the tutorials, it would be great :slight_smile:

(just make sure to add “$schema” as a field to the schema in this case)

1 Like

Hi @yoavst, thanks for bringing it up! We’ve discussed this option internally, and this is something we are considering (although we can’t commit to a timeline at this point).