Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asyncapi/specs

Package Overview
Dependencies
Maintainers
3
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asyncapi/specs

AsyncAPI schema versions

  • 3.0.0-next-major.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
706K
decreased by-8.07%
Maintainers
3
Weekly downloads
 
Created
Source

npm npm

If you are currently using version 2, check out migration guideline to version 3. You might be able to update it without any change.

AsyncAPI

This is a mono repository, which provides all the JSON Schema documents for validating AsyncAPI documents.

Installation

NodeJS

npm install @asyncapi/specs

Go

go get github.com/asyncapi/spec-json-schemas/v2

Usage

NodeJS

Grab a specific AsyncAPI version:

const asyncapi = require('@asyncapi/specs/schemas/2.0.0');

// Do something with the schema.

Get a list of versions:

const versions = require('@asyncapi/specs');

console.log(versions);
// Outputs:
//
// {
//   '1.0.0': [Object],
//   '1.1.0': [Object]
// }

const asyncapi = versions['1.1.0'];

// Do something with the schema.

Go

Grab a specific AsyncAPI version:

import "github.com/asyncapi/spec_json_schemas/v2"

func Do() {
    schema, err := spec_json_schemas.Get("1.1.0")
    if err != nil {
        panic(err)
    }

    // Do something with the schema
}

Repository structure

This is the current project structure explained.

  • ./definitions - contain all the individual schemas that will automatically be bundled together to provide the schemas in ./schemas.
  • ./tools/bundler - is the tool that bundles all the individual schemas together.
  • ./schemas - contain all automatically bundled and complete schemas for each AsyncAPI version. These schemas should NOT be manually changed as they are automatically generated. Any changes should be done in ./definitions.

Schema Bundling

Changes should not be done manually to the schemas in ./schemas, but instead be done in their individual definitions located in ./definitions.

These definitions are automatically bundled together on new releases through the npm script prepublishOnly, which ensures the project is build. This is where the bundler is called.

For example, for 2.2.0, the bundler starts with the asyncapi.json file and recursively goes through all references ($ref) to create the appropriate bundled version.

Creating a new version

To create a new version, simply run the following command:

npm run startNewVersion --new-version=x.x.x

Where x.x.x is the new version you want to create.

The manual process of creating a new version is to:

  1. Duplicate the latest version (y.y.y) under definitions (so we have the correct base to make changes from).
  2. Rename the folder to the new version (x.x.x).
  3. Search and replace in the new duplicated folder for y.y.y and replace it with x.x.x.

FAQs

Package last updated on 16 May 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc