diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml new file mode 100644 index 000000000..72d01de47 --- /dev/null +++ b/.github/workflows/if-nodejs-release.yml @@ -0,0 +1,134 @@ +# This action is centrally managed in https://github.com/asyncapi/.github/ +# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo + +# It does magic only if there is package.json file in the root of the project +name: Release - if Node project + +on: + push: + branches: + - master + # below lines are not enough to have release supported for these branches + # make sure configuration of `semantic-release` package mentions these branches + - next-spec + - next-major + - next-major-spec + - beta + - alpha + - next + +jobs: + + test-nodejs: + # We just check the message of first commit as there is always just one commit because we squash into one before merging + # "commits" contains array of objects where one of the properties is commit "message" + # Release workflow will be skipped if release conventional commits are not used + if: | + startsWith( github.repository, 'asyncapi/' ) && + (startsWith( github.event.commits[0].message , 'fix:' ) || + startsWith( github.event.commits[0].message, 'fix!:' ) || + startsWith( github.event.commits[0].message, 'feat:' ) || + startsWith( github.event.commits[0].message, 'feat!:' )) + name: Test NodeJS release on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + # Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner. + # See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001 + os: [ubuntu-latest, macos-13, windows-latest] + steps: + - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows + run: | + git config --global core.autocrlf false + git config --global core.eol lf + shell: bash + - name: Checkout repository + uses: actions/checkout@v4 + - name: Check if Node.js project and has package.json + id: packagejson + run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT + shell: bash + - if: steps.packagejson.outputs.exists == 'true' + name: Check package-lock version + uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master + id: lockversion + - if: steps.packagejson.outputs.exists == 'true' + name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "${{ steps.lockversion.outputs.version }}" + - if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest' + name: Install npm cli 8 + shell: bash + #npm cli 10 is buggy because of some cache issues + run: npm install -g npm@8.19.4 + - if: steps.packagejson.outputs.exists == 'true' + name: Install dependencies + shell: bash + run: npm ci + - if: steps.packagejson.outputs.exists == 'true' + name: Run test + run: npm test --if-present + - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel + name: Report workflow run status to Slack + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,action,workflow + text: 'Release workflow failed in testing job' + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} + + release: + needs: [test-nodejs] + name: Publish to any of NPM, Github, or Docker Hub + runs-on: ubuntu-latest + steps: + - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Checkout repository + uses: actions/checkout@v4 + - name: Check if Node.js project and has package.json + id: packagejson + run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT + shell: bash + - if: steps.packagejson.outputs.exists == 'true' + name: Check package-lock version + uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master + id: lockversion + - if: steps.packagejson.outputs.exists == 'true' + name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "${{ steps.lockversion.outputs.version }}" + - if: steps.packagejson.outputs.exists == 'true' + name: Install dependencies + shell: bash + run: npm ci + - if: steps.packagejson.outputs.exists == 'true' + name: Add plugin for conventional commits for semantic-release + run: npm install --save-dev conventional-changelog-conventionalcommits@5.0.0 + - if: steps.packagejson.outputs.exists == 'true' + name: Publish to any of NPM, Github, and Docker Hub + id: release + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + GIT_AUTHOR_NAME: asyncapi-bot + GIT_AUTHOR_EMAIL: info@asyncapi.io + GIT_COMMITTER_NAME: asyncapi-bot + GIT_COMMITTER_EMAIL: info@asyncapi.io + run: npx semantic-release@19.0.4 + - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel + name: Report workflow run status to Slack + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,action,workflow + text: 'Release workflow failed in release job' + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} diff --git a/.github/workflows/update-maintainers-trigger.yaml b/.github/workflows/update-maintainers-trigger.yaml new file mode 100644 index 000000000..12fc4abe4 --- /dev/null +++ b/.github/workflows/update-maintainers-trigger.yaml @@ -0,0 +1,28 @@ +# This action is centrally managed in https://github.com/asyncapi/.github/ +# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo + +name: Trigger MAINTAINERS.yaml file update + +on: + push: + branches: [ master ] + paths: + # Check all valid CODEOWNERS locations: + # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-file-location + - 'CODEOWNERS' + - '.github/CODEOWNERS' + - '.docs/CODEOWNERS' + +jobs: + trigger-maintainers-update: + name: Trigger updating MAINTAINERS.yaml because of CODEOWNERS change + runs-on: ubuntu-latest + + steps: + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # https://github.com/peter-evans/repository-dispatch/releases/tag/v3.0.0 + with: + # The PAT with the 'public_repo' scope is required + token: ${{ secrets.GH_TOKEN }} + repository: ${{ github.repository_owner }}/community + event-type: trigger-maintainers-update diff --git a/.releaserc b/.releaserc new file mode 100644 index 000000000..1ac05cb15 --- /dev/null +++ b/.releaserc @@ -0,0 +1,24 @@ +--- +branches: +- master +# by default release workflow reacts on push not only to master. +#This is why out of the box sematic release is configured for all these branches +- name: next-spec + prerelease: true +- name: next-major + prerelease: true +- name: next-major-spec + prerelease: true +- name: beta + prerelease: true +- name: alpha + prerelease: true +- name: next + prerelease: true +plugins: +- - "@semantic-release/commit-analyzer" + - preset: conventionalcommits +- - "@semantic-release/release-notes-generator" + - preset: conventionalcommits +- "@semantic-release/npm" +- "@semantic-release/github" diff --git a/README.md b/README.md index cf2608934..ad537a4a6 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ The package exposes the main class `Parser`, which has two main functions: - `validate()` - function that validates the passed AsyncAPI document. Returns array of all possible errors against the validation conditions. - `parse()` - function that validates the passed AsyncAPI document, and then if it's valid, parses the input. It returns an object that contains: - - `document` object, which is an parsed AsyncAPI document with [`AsyncAPIDocumentInterface`](./src/models/asyncapi.ts) API. If the schema is invalid against the validation conditions, the field has `undefined` value. + - `document` object, which is an parsed AsyncAPI document with [`AsyncAPIDocumentInterface`](./packages/parser/src/models/asyncapi.ts) API. If the schema is invalid against the validation conditions, the field has `undefined` value. - `diagnostics` array that contains all possible errors against the validation conditions. - `registerSchemaParser()` - function that registers custom schema parsers. For more info, please check [Custom schema parsers](#custom-schema-parsers) section. @@ -414,7 +414,7 @@ In addition, the [`convertToOldAPI()` function](#convert-to-the-old-api) which c Parser dereferences all circular references by default. In addition, to simplify interactions with the parser, the following is added: - `x-parser-circular` property is added to the root of the AsyncAPI document to indicate that the document contains circular references. In old API the Parser exposes `hasCircular()` function to check if given AsyncAPI document has circular references. -- `isCircular()` function is added to the [Schema Model](./src/models/schema.ts) to determine if a given schema is circular with respect to previously occurring schemas in the JSON tree. +- `isCircular()` function is added to the [Schema Model](./packages/parser/src/models/schema.ts) to determine if a given schema is circular with respect to previously occurring schemas in the JSON tree. ## Stringify diff --git a/package-lock.json b/package-lock.json index 1ab6f665e..18999f4f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,13 +60,17 @@ "link": true }, "node_modules/@asyncapi/protobuf-schema-parser": { - "version": "3.2.14", - "resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-3.2.14.tgz", - "integrity": "sha512-7v64Jxhz2IBfaQECUhfwuLRMFQTysvmqtvT+Esgd9NooIPRnkEzgCbBnC25oGjzSB6Sju28G406lQpO15HHaEw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-3.3.0.tgz", + "integrity": "sha512-KQYt/FQQxHj6s6clObl1zzWqsZSH1McK9xw9egoELCY1knN/mzDR++A5cKXQAf8FqKVuw410Gbvkw51e1N8m3w==", + "license": "Apache-2.0", "dependencies": { - "@asyncapi/parser": "^3.1.0", - "@types/protocol-buffers-schema": "^3.4.1", - "protobufjs": "^7.2.6" + "@asyncapi/parser": "^3.4.0", + "@types/protocol-buffers-schema": "^3.4.3", + "protobufjs": "^7.4.0" + }, + "engines": { + "node": ">=18" } }, "node_modules/@asyncapi/raml-dt-schema-parser": { @@ -1369,27 +1373,32 @@ "node_modules/@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/base64": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/codegen": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/eventemitter": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/fetch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.1", "@protobufjs/inquire": "^1.1.0" @@ -1398,27 +1407,32 @@ "node_modules/@protobufjs/float": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/inquire": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/path": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/pool": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/utf8": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" }, "node_modules/@sinclair/typebox": { "version": "0.27.8", @@ -8258,11 +8272,20 @@ ] }, "node_modules/jsonpath-plus": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-7.2.0.tgz", - "integrity": "sha512-zBfiUPM5nD0YZSBT/o/fbCUlCcepMIdP0CJZxM1+KgA4f2T206f6VAg9e7mX35+KlMaIc5qXW34f3BnwJ3w+RA==", + "version": "10.0.7", + "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-10.0.7.tgz", + "integrity": "sha512-GDA8d8fu9+s4QzAzo5LMGiLL/9YjecAX+ytlnqdeXYpU55qME57StDgaHt9R2pA7Dr8U31nwzxNJMJiHkrkRgw==", + "dependencies": { + "@jsep-plugin/assignment": "^1.2.1", + "@jsep-plugin/regex": "^1.0.3", + "jsep": "^1.3.9" + }, + "bin": { + "jsonpath": "bin/jsonpath-cli.js", + "jsonpath-plus": "bin/jsonpath-cli.js" + }, "engines": { - "node": ">=12.0.0" + "node": ">=18.0.0" } }, "node_modules/jsonpointer": { @@ -8514,7 +8537,8 @@ "node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "license": "Apache-2.0" }, "node_modules/lru-cache": { "version": "5.1.1", @@ -9220,6 +9244,14 @@ "@types/json-schema": "^7.0.11" } }, + "node_modules/parserapiv1/node_modules/jsonpath-plus": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-7.2.0.tgz", + "integrity": "sha512-zBfiUPM5nD0YZSBT/o/fbCUlCcepMIdP0CJZxM1+KgA4f2T206f6VAg9e7mX35+KlMaIc5qXW34f3BnwJ3w+RA==", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/parserapiv2": { "name": "@asyncapi/parser", "version": "3.0.0-next-major-spec.8", @@ -9245,6 +9277,14 @@ "webapi-parser": "^0.5.0" } }, + "node_modules/parserapiv2/node_modules/jsonpath-plus": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-7.2.0.tgz", + "integrity": "sha512-zBfiUPM5nD0YZSBT/o/fbCUlCcepMIdP0CJZxM1+KgA4f2T206f6VAg9e7mX35+KlMaIc5qXW34f3BnwJ3w+RA==", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/patch-text": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/patch-text/-/patch-text-1.0.2.tgz", @@ -9540,10 +9580,11 @@ } }, "node_modules/protobufjs": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.3.2.tgz", - "integrity": "sha512-RXyHaACeqXeqAKGLDl68rQKbmObRsTIn4TYVUUug1KfS47YWCo5MacGITEryugIgZqORCvJWEk4l449POg5Txg==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", + "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", "hasInstallScript": true, + "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -12199,13 +12240,13 @@ }, "packages/multi-parser": { "name": "@asyncapi/multi-parser", - "version": "2.1.1", + "version": "2.2.0", "license": "Apache-2.0", "dependencies": { "@asyncapi/avro-schema-parser": "^3.0.3", "@asyncapi/openapi-schema-parser": "^3.0.4", "@asyncapi/parser": "*", - "@asyncapi/protobuf-schema-parser": "^3.0.0", + "@asyncapi/protobuf-schema-parser": "^3.3.0", "@asyncapi/raml-dt-schema-parser": "^4.0.4", "parserapiv1": "npm:@asyncapi/parser@^2.1.0", "parserapiv2": "npm:@asyncapi/parser@3.0.0-next-major-spec.8" @@ -12231,7 +12272,7 @@ }, "packages/parser": { "name": "@asyncapi/parser", - "version": "3.3.0", + "version": "3.4.0", "license": "Apache-2.0", "dependencies": { "@asyncapi/specs": "^6.8.0", @@ -12251,7 +12292,7 @@ "ajv-formats": "^2.1.1", "avsc": "^5.7.5", "js-yaml": "^4.1.0", - "jsonpath-plus": "^10.0.0", + "jsonpath-plus": "^10.0.7", "node-fetch": "2.6.7" }, "devDependencies": { @@ -12293,24 +12334,6 @@ "undici-types": "~5.26.4" } }, - "packages/parser/node_modules/jsonpath-plus": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-10.0.0.tgz", - "integrity": "sha512-v7j76HGp/ibKlXYeZ7UrfCLSNDaBWuJMA0GaMjA4sZJtCtY89qgPyToDDcl2zdeHh4B5q/B3g2pQdW76fOg/dA==", - "license": "MIT", - "dependencies": { - "@jsep-plugin/assignment": "^1.2.1", - "@jsep-plugin/regex": "^1.0.3", - "jsep": "^1.3.9" - }, - "bin": { - "jsonpath": "bin/jsonpath-cli.js", - "jsonpath-plus": "bin/jsonpath-cli.js" - }, - "engines": { - "node": ">=18.0.0" - } - }, "packages/parser/node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", diff --git a/packages/multi-parser/package.json b/packages/multi-parser/package.json index 2aeb3371f..4755b5087 100644 --- a/packages/multi-parser/package.json +++ b/packages/multi-parser/package.json @@ -41,11 +41,11 @@ "dependencies": { "@asyncapi/avro-schema-parser": "^3.0.3", "@asyncapi/openapi-schema-parser": "^3.0.4", - "@asyncapi/protobuf-schema-parser": "^3.0.0", + "@asyncapi/parser": "*", + "@asyncapi/protobuf-schema-parser": "^3.3.0", "@asyncapi/raml-dt-schema-parser": "^4.0.4", "parserapiv1": "npm:@asyncapi/parser@^2.1.0", - "parserapiv2": "npm:@asyncapi/parser@3.0.0-next-major-spec.8", - "@asyncapi/parser": "*" + "parserapiv2": "npm:@asyncapi/parser@3.0.0-next-major-spec.8" }, "devDependencies": { "@jest/types": "^29.0.2", diff --git a/packages/parser/package.json b/packages/parser/package.json index 48e5d33fd..cc7006f62 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -59,7 +59,7 @@ "ajv-formats": "^2.1.1", "avsc": "^5.7.5", "js-yaml": "^4.1.0", - "jsonpath-plus": "^10.0.0", + "jsonpath-plus": "^10.0.7", "node-fetch": "2.6.7" }, "devDependencies": { diff --git a/packages/parser/src/ruleset/v3/functions/operationMessagesUnambiguity.ts b/packages/parser/src/ruleset/v3/functions/operationMessagesUnambiguity.ts index 75c1d5206..6f09aec92 100644 --- a/packages/parser/src/ruleset/v3/functions/operationMessagesUnambiguity.ts +++ b/packages/parser/src/ruleset/v3/functions/operationMessagesUnambiguity.ts @@ -31,7 +31,7 @@ export const operationMessagesUnambiguity = createRulesetFunction<{ channel?: {' const channelPointer = targetVal.channel?.$ref as string; // required targetVal.messages?.forEach((message, index) => { - if (!message.$ref.startsWith(`${channelPointer}/messages`)) { + if (message.$ref && !message.$ref.startsWith(`${channelPointer}/messages`)) { results.push({ message: 'Operation message does not belong to the specified channel.', path: [...ctx.path, 'messages', index],