Socket
Socket
Sign inDemoInstall

@ibm-cloud/openapi-ruleset

Package Overview
Dependencies
151
Maintainers
21
Versions
118
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ibm-cloud/openapi-ruleset

Spectral ruleset for validating IBM Cloud services


Version published
Weekly downloads
117K
decreased by-19.65%
Maintainers
21
Install size
30.8 MB
Created
Weekly downloads
 

Readme

Source

OpenAPI Ruleset

This package contains a custom Spectral ruleset for validating OpenAPI documents. It extends the spectral:oas ruleset, for which it defines custom severity levels. It also contains a number of additional rules based on API design requirements and guidance from IBM Cloud. This is the default ruleset used in the ibm-openapi-validator package.

Installation

npm install @ibm-cloud/openapi-ruleset

Note that installation is only required if using this package programmatically or extending it in a Spectral config file written in JavaScript. It is not required if extending the ruleset in a Spectral config file written in YAML or JSON.

Usage

Spectral config file - YAML or JSON

  • Note - no installation required. Spectral handles the import internally.
# .spectral.yaml
extends: '@ibm-cloud/openapi-ruleset'
rules:
  content-entry-provided: off

Spectral config file - JavaScript

// .spectral.js
const ibmOpenapiRuleset = require('@ibm-cloud/openapi-ruleset');

module.exports = {
  extends: ibmOpenapiRuleset,
  rules: {
    'content-entry-provided': 'off'
  }
};

Programmatically running Spectral

// your-module.js
const ibmOpenapiRuleset = require('@ibm-cloud/openapi-ruleset');
const { Spectral } = require('@stoplight/spectral-core');

function async runSpectral(openapiDocument) {
  const spectral = new Spectral();
  spectral.setRuleset(ibmOpenapiRuleset);
  results = await spectral.run(openapiDocument);
  console.log(results);
}

FAQs

Last updated on 09 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc