Configuring schema validation for VSCode

Defining what will happen when zBuilder ‘builds’ a language source file is done through YAML configuration files. Many YAML file editors provide IntelliSense and Code Completion if you configure a schema, so DBB provides the schema file that validates these YAML configurations to developers to allow them to validate their configurations inside of their editor. This way they can quickly understand, correct, and build out new YAML configurations without having to run zBuilder.

In this tutorial, you configure VSCode with the DBB schemas so that it can provide IntelliSense and Code Completion for YAML Build and Application Configuration files.

Prerequisites

Install Visual Studio Code.

Download either the "IBM Developer for z/OS Enterprise Edition (IDzEE) VS Code" or the "IBM Application Delivery Foundation for z/OS (ADFz)" package from the IBM Z VS Code Components list of the Mainframe DEV Downloads page, depending on which product you are entitled to use. Both these packages include the IBM Z Open Editor extension that is required for the following steps on the schema configuration.

Estimated time

This tutorial takes about 7 minutes to complete.

Steps

1. Install a YAML File Editor

Install the YAML Language Support by Red Hat plugin to enable YAML syntax and validation in your VSCode. This will also allow your VSCode to validate YAML by using schema files.

2. Acquire DBB Schema Files

Copy the buildConfigurationSchema.json build configuration schema and applicationConfigurationSchema.json application configuration schema from the samples folder in your DBB installation directory or download them directly from the links in Schema JSON files.

Alternatively, you can skip this step and use our publicly-hosted schema samples that are provided on the DBB Community Repository.

Then, configure VSCode to use these schemas in validating your configurations.

3. Open the yaml.schemas property in settings.json

Click the gear wheel in the bottom left of your editor and click Settings.

Settings

Search for Yaml: Schemas and press the Edit in settings.json label to open your settings.json.

Edit in settings.json

4. Add Schema File Paths as Properties

Add the two schemas as items under the yaml.schemas property as shown:

"yaml.schemas": {
    "file:///c%3A/path/to/applicationConfigurationSchema.json": [
        
    ],
    "file:///c%3A/path/to/buildConfigurationSchema.json": [
        
    ],
}

Alternatively, you can use the schema hosted on our DBB Community Repository as shown:

"yaml.schemas": {
    "https://raw.githubusercontent.com/IBM/dbb/refs/heads/main/Schema/applicationConfigurationSchema.json": [
        
    ],
    "https://raw.githubusercontent.com/IBM/dbb/refs/heads/main/Schema/buildConfigurationSchema.json": [
        
    ],
}

Review the community repository schema README for information on legacy schema.

5. Add File Patterns to Schema

Any files open in your editor that match one of the file patterns underneath one of the schemas will use that schema for validation. Below are a list of suggested file patterns that can be used to match common scenarios. Note that if you edit any YAML files other than zBuilder ones, they might use this schema as well if your patterns are too broad.

"yaml.schemas": {
    "file:///c%3A/path/to/applicationConfigurationSchema.json": [
        "dbb-app.yaml",
        "MortgageApplication/**-app.yaml"
    ],
    "file:///c%3A/path/to/buildConfigurationSchema.json": [
        "dbb-build.yaml",
        "Languages.yaml",
        "Cobol.yaml",
        "Assembler.yaml",
        "BMS.yaml",
        "CobolTestcase.yaml",
        "Db2Binds.yaml",
        "LinkEdit.yaml",
        "PLI.yaml"
    ],
}

Summary

You should now see the schema validation take effect inside your configuration files.

Schema validation in the configuration file

You can also use the autocomplete feature by pressing CTRL + Space to display options for your current index context, or by typing part of the keyword you want to use and pressing TAB.

Autocomplete feature

Next Steps

Use your IDE schema configuration by configuring language compiler scripts for your installation of zBuilder.