Skip to content

Commit

Permalink
feat: add x-origin property
Browse files Browse the repository at this point in the history
  • Loading branch information
aeworxet committed Feb 16, 2024
1 parent 30a0f3c commit db76cf3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function addXOrigins(asyncapiDocument: AsyncAPIObject) {
// VALUE from 'asyncapiDocument' becomes KEY for the
// underlying and recursive functions
Object.values(asyncapiDocument).forEach(async (key: any) => {

Check warning on line 110 in src/util.ts

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed
if (typeof key === 'object' && key !== '$ref') {
if (key && typeof key === 'object' && key !== '$ref') {
if (Object.keys(key).indexOf('$ref') !== -1) {
if (isExternalReference(key['$ref'])) {
key['x-origin'] = key['$ref'];
Expand Down
1 change: 1 addition & 0 deletions src/v3/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export async function parse(JSONSchema: any) {
!!/#\/operations\/[a-zA-Z0-9]*\/messages/.exec(path) ||
!!/#\/operations\/[a-zA-Z0-9]*\/reply\/channel/.exec(path) ||
!!/#\/operations\/[a-zA-Z0-9]*\/reply\/messages/.exec(path) ||
!!/#\/components\/channels\/[a-zA-Z0-9]*\/servers/.exec(path) ||
!!/#\/components\/operations\/[a-zA-Z0-9]*\/channel/.exec(path) ||
!!/#\/components\/operations\/[a-zA-Z0-9]*\/messages/.exec(path) ||
!!/#\/components\/operations\/[a-zA-Z0-9]*\/reply\/channel/.exec(
Expand Down

0 comments on commit db76cf3

Please sign in to comment.