Skip to content

Commit

Permalink
feat(rulesets): support AsyncAPI 2.4 (#2146)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni authored and P0lip committed May 2, 2022
1 parent 06c52b4 commit eb17502
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
6 changes: 3 additions & 3 deletions packages/rulesets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"release": "semantic-release -e semantic-release-monorepo"
},
"dependencies": {
"@asyncapi/specs": "^2.13.0",
"@asyncapi/specs": "^2.14.0",
"@stoplight/better-ajv-errors": "1.0.1",
"@stoplight/json": "^3.17.0",
"@stoplight/spectral-core": "^1.8.1",
"@stoplight/spectral-formats": "^1.1.0",
"@stoplight/spectral-formats": "^1.2.0",
"@stoplight/spectral-functions": "^1.5.1",
"@stoplight/spectral-runtime": "^1.1.1",
"@stoplight/types": "^12.3.0",
"@stoplight/types": "^13.0.0",
"@types/json-schema": "^7.0.7",
"ajv": "^8.8.2",
"ajv-formats": "~2.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createRulesetFunction } from '@stoplight/spectral-core';
import { schema as schemaFn } from '@stoplight/spectral-functions';
import { aas2_0, aas2_1, aas2_2, aas2_3 } from '@stoplight/spectral-formats';
import { aas2_0, aas2_1, aas2_2, aas2_3, aas2_4 } from '@stoplight/spectral-formats';

import type { ErrorObject } from 'ajv';
import type { IFunctionResult, Format } from '@stoplight/spectral-core';
Expand All @@ -10,6 +10,7 @@ import * as asyncAPI2_0_0Schema from '@asyncapi/specs/schemas/2.0.0.json';
import * as asyncAPI2_1_0Schema from '@asyncapi/specs/schemas/2.1.0.json';
import * as asyncAPI2_2_0Schema from '@asyncapi/specs/schemas/2.2.0.json';
import * as asyncAPI2_3_0Schema from '@asyncapi/specs/schemas/2.3.0.json';
import * as asyncAPI2_4_0Schema from '@asyncapi/specs/schemas/2.4.0.json';

function shouldIgnoreError(error: ErrorObject): boolean {
return (
Expand Down Expand Up @@ -81,6 +82,8 @@ function getSchema(formats: Set<Format>): Record<string, unknown> | void {
return asyncAPI2_2_0Schema;
case formats.has(aas2_3):
return asyncAPI2_3_0Schema;
case formats.has(aas2_4):
return asyncAPI2_4_0Schema;
default:
return;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/rulesets/src/asyncapi/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { aas2_0, aas2_1, aas2_2, aas2_3 } from '@stoplight/spectral-formats';
import { aas2_0, aas2_1, aas2_2, aas2_3, aas2_4 } from '@stoplight/spectral-formats';
import {
truthy,
pattern,
Expand All @@ -14,7 +14,7 @@ import asyncApi2PayloadValidation from './functions/asyncApi2PayloadValidation';

export default {
documentationUrl: 'https://meta.stoplight.io/docs/spectral/docs/reference/asyncapi-rules.md',
formats: [aas2_0, aas2_1, aas2_2, aas2_3],
formats: [aas2_0, aas2_1, aas2_2, aas2_3, aas2_4],
rules: {
'asyncapi-channel-no-empty-parameter': {
description: 'Channel path must not have empty parameter substitution pattern.',
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ __metadata:
languageName: node
linkType: hard

"@asyncapi/specs@npm:^2.13.0":
version: 2.13.0
resolution: "@asyncapi/specs@npm:2.13.0"
checksum: 94355c96ac2562bfd9118a3e33dd36359196d070684da952f6b0f800b588b426d012fbf96f85b7341ec74f401e3487934b92e43f48e086fa956eab29b90ab694
"@asyncapi/specs@npm:^2.14.0":
version: 2.14.0
resolution: "@asyncapi/specs@npm:2.14.0"
checksum: 066c23c493df54c44c319433bdcf8482a3acd584e32c0073e6a9f5b167d61bde23a252621be2b28bbaf1466636f6cafaab570795de403f0c671358784d4b12ed
languageName: node
linkType: hard

Expand Down Expand Up @@ -2411,7 +2411,7 @@ __metadata:
languageName: unknown
linkType: soft

"@stoplight/spectral-formats@*, @stoplight/spectral-formats@>=1, @stoplight/spectral-formats@^1.0.0, @stoplight/spectral-formats@^1.1.0, @stoplight/spectral-formats@workspace:packages/formats":
"@stoplight/spectral-formats@*, @stoplight/spectral-formats@>=1, @stoplight/spectral-formats@^1.0.0, @stoplight/spectral-formats@^1.2.0, @stoplight/spectral-formats@workspace:packages/formats":
version: 0.0.0-use.local
resolution: "@stoplight/spectral-formats@workspace:packages/formats"
dependencies:
Expand Down Expand Up @@ -2523,17 +2523,17 @@ __metadata:
version: 0.0.0-use.local
resolution: "@stoplight/spectral-rulesets@workspace:packages/rulesets"
dependencies:
"@asyncapi/specs": ^2.13.0
"@asyncapi/specs": ^2.14.0
"@stoplight/better-ajv-errors": 1.0.1
"@stoplight/json": ^3.17.0
"@stoplight/path": ^1.3.2
"@stoplight/spectral-core": ^1.8.1
"@stoplight/spectral-formats": ^1.1.0
"@stoplight/spectral-formats": ^1.2.0
"@stoplight/spectral-functions": ^1.5.1
"@stoplight/spectral-parsers": "*"
"@stoplight/spectral-ref-resolver": "*"
"@stoplight/spectral-runtime": ^1.1.1
"@stoplight/types": ^12.3.0
"@stoplight/types": ^13.0.0
"@types/json-schema": ^7.0.7
ajv: ^8.8.2
ajv-formats: ~2.1.0
Expand Down Expand Up @@ -2568,7 +2568,7 @@ __metadata:
languageName: node
linkType: hard

"@stoplight/types@npm:13.0.0":
"@stoplight/types@npm:13.0.0, @stoplight/types@npm:^13.0.0":
version: 13.0.0
resolution: "@stoplight/types@npm:13.0.0"
dependencies:
Expand Down

0 comments on commit eb17502

Please sign in to comment.