@asyncapi/specs
Advanced tools
Comparing version 4.1.0 to 5.0.0-next-major-spec.1
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
14300647
961
120377
9
1
6