Skip to main content
Bruno allows you to load any npm module for use in your scripting workflows.

Prerequisites

Before you begin, ensure that you have the following:
  1. Node.js installed on your system.
  2. Bruno installed.

Project Structure

The folder structure for this example will be:

Configuration

You need to initialize package.json file inside your collection. Navigate to your Bruno collection directory in the terminal.
Initialize package.json file inside your collection.
Now you can install any npm package or module to use in your collection.

Spectral Integration

In this example we’re using Spectral CLI as a npm package which help you to validate OpenSpec API YAML or JSON files with the built-in ruleset. You need to have OpenAPI JSON or YAML file to work with spectral or you can download from here as example.

Spectral CLI Setup

You can install spectral-cli by running following command:
Run this command in your terminal to initialize .spectral.yml file which is predefined ruleset.
copy
Validate your openapi.yaml file from Bruno collection by running following CLI command:
copy

Output Overview

After following the process outlined above, warning messages will be displayed on the CLI such as duplicates and empty tags. This is how you can validate your OpenSpec files using Spectral.