Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add schema listing all Schema-Store JSON Schema docs #237

Merged
merged 2 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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