Skip to content

Commit

Permalink
feat: add schema listing all Schema-Store JSON Schema docs (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya authored Jul 13, 2022
1 parent 68302ad commit 482cbfd
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 1 deletion.
149 changes: 149 additions & 0 deletions schemas/all.schema-store.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"$id": "http://asyncapi.com/schema-store/all.schema-store.json",
"$schema": "http://json-schema.org/draft-07/schema",
"title": "JSON Schema documents for all AsyncAPI spec versions",
"description": "All AsyncAPI JSON Schema documents listed in one file. Needed for serving all documents through schemastore.org",
"type": "object",
"oneOf": [
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "1.0.0"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/1.0.0.json"
}
]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "1.1.0"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/1.1.0.json"
}
]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "1.2.0"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/1.2.0.json"
}
]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "2.0.0-rc1"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/2.0.0-rc1.json"
}
]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "2.0.0-rc2"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/2.0.0-rc2.json"
}
]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "2.0.0"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/2.0.0.json"
}
]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "2.1.0"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/2.1.0.json"
}
]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "2.2.0"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/2.2.0.json"
}
]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "2.3.0"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/2.3.0.json"
}
]
},
{
"allOf": [
{
"properties": {
"asyncapi": {
"const": "2.4.0"
}
}
},
{
"$ref": "http://asyncapi.com/schema-store/2.4.0.json"
}
]
}
]
}
3 changes: 2 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ describe('AsyncAPI', () => {
});

it('should check if json schema is exported and if it matches the original file', () => {
const skipFiles = ["README", "all.schema-store"];
const files = fs.readdirSync('schemas');
files.forEach(file => {
const fileName = path.parse(file).name;
if (fileName == "README") return;
if (skipFiles.includes(fileName)) return;

const asyncapi = require('..');
assert(typeof asyncapi[fileName] === 'object', `Returned object does not contain ${fileName}.`);
Expand Down

0 comments on commit 482cbfd

Please sign in to comment.