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 - npm Package Compare versions

Comparing version 4.1.0 to 5.0.0-next-major-spec.1

bindings/amqp/0.2.0/channel.json

1

index.d.ts

@@ -10,4 +10,3 @@ import type { JSONSchema7 } from 'json-schema';

'2.5.0': JSONSchema7;
'2.6.0': JSONSchema7;
};
export = _exports;

@@ -8,3 +8,3 @@ module.exports = {

'2.5.0': require('./schemas/2.5.0.json'),
'2.6.0': require('./schemas/2.6.0.json'),
'3.0.0': require('./schemas/3.0.0.json')
};
{
"name": "@asyncapi/specs",
"version": "4.1.0",
"version": "5.0.0-next-major-spec.1",
"description": "AsyncAPI schema versions",

@@ -41,4 +41,2 @@ "main": "index.js",

"devDependencies": {
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"@semantic-release/commit-analyzer": "^8.0.1",

@@ -48,3 +46,6 @@ "@semantic-release/github": "7.2.3",

"@semantic-release/release-notes-generator": "^9.0.1",
"ajv": "^8.11.2",
"conventional-changelog-conventionalcommits": "^4.2.3",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"semantic-release": "19.0.3"

@@ -51,0 +52,0 @@ },

@@ -161,18 +161,4 @@ {

]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "2.6.0"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/2.6.0.json"
}
]
}
]
}
const path = require('path');
const fs = require('fs');
const definitionsDirectory = path.resolve(__dirname, '../../definitions');
const bindingsDirectory = path.resolve(__dirname, '../../bindings');
const outputDirectory = path.resolve(__dirname, '../../schemas');
console.log(`Looking for separate definitions in the following directory: ${definitionsDirectory}`);
console.log(`Looking for binding version schemas in the following directory: ${bindingsDirectory}`);
console.log(`Using the following output directory: ${outputDirectory}`);
/**
* Function to load all the core AsyncAPI spec definition (except the root asyncapi schema, as that will be loaded later) into the bundler.
*/
async function loadDefinitions(bundler, versionDir) {
const definitions = await fs.promises.readdir(versionDir);
const definitionFiles = definitions.filter((value) => {return !value.includes('asyncapi')}).map((file) => fs.readFileSync(path.resolve(versionDir, file)));
const definitionJson = definitionFiles.map((file) => JSON.parse(file));
for (const jsonFile of definitionJson) {
bundler.add(jsonFile);
}
}
/**
* Function to load all the binding version schemas into the bundler
*/
async function loadBindings(bundler) {
const bindingDirectories = await fs.promises.readdir(bindingsDirectory);
for (const bindingDirectory of bindingDirectories) {
const bindingVersionDirectories = await fs.promises.readdir(path.resolve(bindingsDirectory, bindingDirectory));
const bindingVersionDirectoriesFiltered = bindingVersionDirectories.filter((file) => fs.lstatSync(path.resolve(bindingsDirectory, bindingDirectory, file)).isDirectory());
for (const bindingVersionDirectory of bindingVersionDirectoriesFiltered) {
const bindingFiles = await fs.promises.readdir(path.resolve(bindingsDirectory, bindingDirectory, bindingVersionDirectory));
const bindingFilesFiltered = bindingFiles.filter((bindingFile) => path.extname(bindingFile) === '.json').map((bindingFile) => path.resolve(bindingsDirectory, bindingDirectory, bindingVersionDirectory, bindingFile));
for (const bindingFile of bindingFilesFiltered) {
const bindingFileContent = require(bindingFile);
bundler.add(bindingFileContent);
}
}
}
}
/**
* When run, go through all versions that have split definitions and bundles them together.

@@ -23,8 +54,4 @@ */

const versionDir = path.resolve(definitionsDirectory, version);
const definitions = await fs.promises.readdir(versionDir);
const definitionFiles = definitions.filter((value) => {return !value.includes('asyncapi')}).map((file) => fs.readFileSync(path.resolve(versionDir, file)));
const definitionJson = definitionFiles.map((file) => JSON.parse(file));
for (const jsonFile of definitionJson) {
Bundler.add(jsonFile);
}
await loadDefinitions(Bundler, versionDir);
await loadBindings(Bundler);
const filePathToBundle = `file://${versionDir}/asyncapi.json`;

@@ -37,3 +64,3 @@ const fileToBundle = await Bundler.get(filePathToBundle);

await fs.promises.writeFile(outputFile, JSON.stringify(bundledSchema, null, 4));
}catch(e) {
}catch(e) {
console.log(e);

@@ -40,0 +67,0 @@ }

Sorry, the diff of this file is not supported yet

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