diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c34ba51899c..4be8db417e1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -46,8 +46,6 @@ updates: prefix: "chore" include: "scope" open-pull-requests-limit: 3 - ignore: - - dependency-name: "@asyncapi/react-component" - package-ecosystem: "docker" # Look for a `Dockerfile` in the `root` directory diff --git a/README.md b/README.md index a0040645a3e..f79ea12af51 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,6 @@ Install dependencies needed for webpack@5 to properly build SwaggerEditor. ```sh $ npm i stream-browserify --save-dev - $ npm i process --save-dev $ npm i https-browserify --save-dev $ npm i stream-http --save-dev $ npm i util --save-dev @@ -120,6 +119,8 @@ module.exports = { alias: { // This alias make sure we don't pull two different versions of monaco-editor 'monaco-editor': '/node_modules/monaco-editor', + // This alias makes sure we're avoiding a runtime error related to this package + '@stoplight/ordered-object-literal$': '/node_modules/@stoplight/ordered-object-literal/src/index.mjs', }, }, plugins: [ @@ -154,14 +155,6 @@ module.exports = { loader: 'file-loader', type: 'javascript/auto', // this disables webpacks default handling of wasm }, - { - test: /@apidevtools\/json-schema-ref-parser\/lib\/util\/url.js$/, - loader: 'imports-loader', - options: { - type: 'commonjs', - imports: ['single process/browser process'], - }, - }, ] } }; @@ -179,7 +172,6 @@ Install `copy-webpack-plugin` and other needed dependencies. ```sh $ npm i copy-webpack-plugin --save-dev $ npm i stream-browserify --save-dev - $ npm i process --save-dev $ npm i https-browserify --save-dev $ npm i stream-http --save-dev $ npm i util --save-dev @@ -214,6 +206,8 @@ module.exports = { alias: { // This alias make sure we don't pull two different versions of monaco-editor 'monaco-editor': '/node_modules/monaco-editor', + // This alias makes sure we're avoiding a runtime error related to this package + '@stoplight/ordered-object-literal$': '/node_modules/@stoplight/ordered-object-literal/src/index.mjs', } }, plugins: [ @@ -239,14 +233,6 @@ module.exports = { test: /\.css$/, use: ['style-loader', 'css-loader'] }, - { - test: /@apidevtools\/json-schema-ref-parser\/lib\/util\/url.js$/, - loader: 'imports-loader', - options: { - type: 'commonjs', - imports: ['single process/browser process'], - }, - }, ] } }; diff --git a/create-react-app b/create-react-app index 284b3d22e08..6a3587082ea 160000 --- a/create-react-app +++ b/create-react-app @@ -1 +1 @@ -Subproject commit 284b3d22e085db8677bc88077b7a45a7a67def1a +Subproject commit 6a3587082eab7e1a035325f1e2e043c07ced240a diff --git a/package-lock.json b/package-lock.json index 3bd6f55d28a..f6fe9b2d7d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,13 +9,13 @@ "version": "5.0.0-alpha.90", "license": "Apache-2.0", "dependencies": { - "@asyncapi/avro-schema-parser": "^1.1.0", - "@asyncapi/openapi-schema-parser": "^2.0.3", - "@asyncapi/parser": "^1.18.1", - "@asyncapi/protobuf-schema-parser": "^1.0.0", - "@asyncapi/react-component": "=1.4.2", - "@babel/runtime": "^7.24.1", - "@braintree/sanitize-url": "^7.0.0", + "@asyncapi/avro-schema-parser": "^3.0.18", + "@asyncapi/openapi-schema-parser": "^3.0.18", + "@asyncapi/parser": "^3.0.10", + "@asyncapi/protobuf-schema-parser": "^3.2.8", + "@asyncapi/react-component": "^1.4.2", + "@babel/runtime": "^7.22.6", + "@braintree/sanitize-url": "^7.0.1", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.0", "@mui/material": "^5.15.14", @@ -120,7 +120,6 @@ "git-describe": "^4.1.1", "html-webpack-plugin": "^5.5.0", "identity-obj-proxy": "^3.0.0", - "imports-loader": "^5.0.0", "inspectpack": "^4.7.1", "jest": "^27.4.3", "jest-resolve": "^27.4.2", @@ -315,100 +314,7 @@ "node": ">=6.0.0" } }, - "node_modules/@apidevtools/json-schema-ref-parser": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.1.2.tgz", - "integrity": "sha512-r1w81DpR+KyRWd3f+rk6TNqMgedmAxZP5v5KWlXQWlgMUUtyEJch0DKEci1SorPMiSeM8XPl7MZ3miJ60JIpQg==", - "dependencies": { - "@jsdevtools/ono": "^7.1.3", - "@types/json-schema": "^7.0.6", - "call-me-maybe": "^1.0.1", - "js-yaml": "^4.1.0" - } - }, "node_modules/@asyncapi/avro-schema-parser": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@asyncapi/avro-schema-parser/-/avro-schema-parser-1.1.0.tgz", - "integrity": "sha512-7J7pzSw0/jF2bXy/Mf+80VKJfXRRfyLTJz413MkKLbLXbbz9rV4sVpYfp31ofqXgyZ9bhfmHJzunbi0Bt7Jcww==", - "dependencies": { - "avsc": "^5.7.3" - } - }, - "node_modules/@asyncapi/openapi-schema-parser": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-2.0.3.tgz", - "integrity": "sha512-o9fvibjx2n3L2SKNlWUQ59CxO2x2BKhbHxh81U39NMLgowN/avk1wfxkMvzL3G9pg4FlgCdcayDhu4+TzDX47A==", - "dependencies": { - "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", - "conventional-changelog-conventionalcommits": "^5.0.0" - } - }, - "node_modules/@asyncapi/parser": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-1.18.1.tgz", - "integrity": "sha512-7sU9DajLV+vA2vShTYmD5lbtbTY6TOcGxB4Z4IcpRp8x5pejOsN32iU05eIYCnuamsi5SMscFxoi6fIO2vPK3Q==", - "dependencies": { - "@apidevtools/json-schema-ref-parser": "^9.0.6", - "@asyncapi/specs": "^4.1.1", - "@fmvilas/pseudo-yaml-ast": "^0.3.1", - "ajv": "^6.10.1", - "js-yaml": "^3.13.1", - "json-to-ast": "^2.1.0", - "lodash.clonedeep": "^4.5.0", - "node-fetch": "^2.6.0", - "tiny-merge-patch": "^0.1.2" - } - }, - "node_modules/@asyncapi/parser/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@asyncapi/parser/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@asyncapi/protobuf-schema-parser": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-1.0.0.tgz", - "integrity": "sha512-eLfFhV6L+idW83LUspD6pzVwp2Zz0t3oW7kZD+USynmKZMkXnLmY7ON0q82Y5k0KZ34itoyyKu7YBYe4JxIZsw==", - "dependencies": { - "conventional-changelog-conventionalcommits": "^5.0.0", - "protocol-buffers-schema": "^3.6.0" - } - }, - "node_modules/@asyncapi/react-component": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@asyncapi/react-component/-/react-component-1.4.2.tgz", - "integrity": "sha512-N11TZJtfh8GHKpJIoYYw91inbSiMaxVRHV8SvzpJ3v71C+Ia2p8fHd5dwCrY0BpUuzboiJWWN3VaRv++tHX3PQ==", - "dependencies": { - "@asyncapi/avro-schema-parser": "^3.0.18", - "@asyncapi/openapi-schema-parser": "^3.0.18", - "@asyncapi/parser": "^3.0.10", - "@asyncapi/protobuf-schema-parser": "^3.2.8", - "highlight.js": "^10.7.2", - "isomorphic-dompurify": "^0.13.0", - "marked": "^4.0.14", - "openapi-sampler": "^1.2.1", - "use-resize-observer": "^8.0.0" - }, - "peerDependencies": { - "react": ">=16.8.0", - "react-dom": ">=16.8.0" - } - }, - "node_modules/@asyncapi/react-component/node_modules/@asyncapi/avro-schema-parser": { "version": "3.0.18", "resolved": "https://registry.npmjs.org/@asyncapi/avro-schema-parser/-/avro-schema-parser-3.0.18.tgz", "integrity": "sha512-2w8cq10apV7Kc+mBPIaIhmErj1oJF8cERpTZKjFti1uoQCXX3oZ9H0wQCajlYNOANuh/a0F4JMEd2R/lM0PFXw==", @@ -418,7 +324,7 @@ "avsc": "^5.7.6" } }, - "node_modules/@asyncapi/react-component/node_modules/@asyncapi/openapi-schema-parser": { + "node_modules/@asyncapi/openapi-schema-parser": { "version": "3.0.18", "resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-3.0.18.tgz", "integrity": "sha512-azKEwm9wel7QS/Fz0y1C9eCUIfUEZE/JrQlGybPmQKHS213RKyo5Rjpzo9nqGc4VT7o1URDIMaYTnYdgfMitew==", @@ -430,7 +336,35 @@ "ajv-formats": "^2.1.1" } }, - "node_modules/@asyncapi/react-component/node_modules/@asyncapi/parser": { + "node_modules/@asyncapi/openapi-schema-parser/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@asyncapi/openapi-schema-parser/node_modules/ajv-errors": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz", + "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==", + "peerDependencies": { + "ajv": "^8.0.1" + } + }, + "node_modules/@asyncapi/openapi-schema-parser/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/@asyncapi/parser": { "version": "3.0.10", "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.10.tgz", "integrity": "sha512-x9qo7SHGzPWbC1XCRyilcI+Z6UZsWZ9uRl05h9j4G/v+3IjNG3krwngiAbt59nbLlYZD/nBS7Hc03GayoocnQw==", @@ -456,25 +390,7 @@ "node-fetch": "2.6.7" } }, - "node_modules/@asyncapi/react-component/node_modules/@asyncapi/protobuf-schema-parser": { - "version": "3.2.8", - "resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-3.2.8.tgz", - "integrity": "sha512-qYKutNQTkMNrf8BB9d6o2JS/4LC+r6Fkugvg46gW66kN9dKMU2nguHWM+MdcG89nk5keM2Olz4IN8AvWqX9iew==", - "dependencies": { - "@asyncapi/parser": "^3.0.10", - "@types/protocol-buffers-schema": "^3.4.1", - "protobufjs": "^7.2.6" - } - }, - "node_modules/@asyncapi/react-component/node_modules/@asyncapi/specs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.5.3.tgz", - "integrity": "sha512-mZROlCOLkZEWy5tN4pPop3JEJflSKmLLMGO1TebF5wjnroqZ3yp/GuGUxVIl3jVNxFk1i5nZ2AtWzAD/HaUj3Q==", - "dependencies": { - "@types/json-schema": "^7.0.11" - } - }, - "node_modules/@asyncapi/react-component/node_modules/ajv": { + "node_modules/@asyncapi/parser/node_modules/ajv": { "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", @@ -489,7 +405,7 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/@asyncapi/react-component/node_modules/ajv-errors": { + "node_modules/@asyncapi/parser/node_modules/ajv-errors": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz", "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==", @@ -497,15 +413,45 @@ "ajv": "^8.0.1" } }, - "node_modules/@asyncapi/react-component/node_modules/json-schema-traverse": { + "node_modules/@asyncapi/parser/node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, + "node_modules/@asyncapi/protobuf-schema-parser": { + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-3.2.8.tgz", + "integrity": "sha512-qYKutNQTkMNrf8BB9d6o2JS/4LC+r6Fkugvg46gW66kN9dKMU2nguHWM+MdcG89nk5keM2Olz4IN8AvWqX9iew==", + "dependencies": { + "@asyncapi/parser": "^3.0.10", + "@types/protocol-buffers-schema": "^3.4.1", + "protobufjs": "^7.2.6" + } + }, + "node_modules/@asyncapi/react-component": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@asyncapi/react-component/-/react-component-1.4.2.tgz", + "integrity": "sha512-N11TZJtfh8GHKpJIoYYw91inbSiMaxVRHV8SvzpJ3v71C+Ia2p8fHd5dwCrY0BpUuzboiJWWN3VaRv++tHX3PQ==", + "dependencies": { + "@asyncapi/avro-schema-parser": "^3.0.18", + "@asyncapi/openapi-schema-parser": "^3.0.18", + "@asyncapi/parser": "^3.0.10", + "@asyncapi/protobuf-schema-parser": "^3.2.8", + "highlight.js": "^10.7.2", + "isomorphic-dompurify": "^0.13.0", + "marked": "^4.0.14", + "openapi-sampler": "^1.2.1", + "use-resize-observer": "^8.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, "node_modules/@asyncapi/specs": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-4.3.1.tgz", - "integrity": "sha512-EfexhJu/lwF8OdQDm28NKLJHFkx0Gb6O+rcezhZYLPIoNYKXJMh2J1vFGpwmfAcTTh+ffK44Oc2Hs1Q4sLBp+A==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.5.3.tgz", + "integrity": "sha512-mZROlCOLkZEWy5tN4pPop3JEJflSKmLLMGO1TebF5wjnroqZ3yp/GuGUxVIl3jVNxFk1i5nZ2AtWzAD/HaUj3Q==", "dependencies": { "@types/json-schema": "^7.0.11" } @@ -2620,9 +2566,9 @@ "dev": true }, "node_modules/@babel/runtime": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.1.tgz", - "integrity": "sha512-+BIznRzyqBf+2wCTxcKE3wDjfGeCoVE61KSHGpkzqrLi8qxqFwBeUFyId2cxkTmm55fzDGnm0+yCxaxygrLUnQ==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz", + "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -4226,14 +4172,6 @@ "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.1.tgz", "integrity": "sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==" }, - "node_modules/@fmvilas/pseudo-yaml-ast": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@fmvilas/pseudo-yaml-ast/-/pseudo-yaml-ast-0.3.1.tgz", - "integrity": "sha512-8OAB74W2a9M3k9bjYD8AjVXkX+qO8c0SqNT5HlgOqx7AxSw8xdksEcZp7gFtfi+4njSxT6+76ZR+1ubjAwQHOg==", - "dependencies": { - "yaml-ast-parser": "0.0.43" - } - }, "node_modules/@hapi/hoek": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", @@ -5329,11 +5267,6 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, - "node_modules/@jsdevtools/ono": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", - "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" - }, "node_modules/@jsep-plugin/regex": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@jsep-plugin/regex/-/regex-1.0.3.tgz", @@ -8312,6 +8245,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -8524,7 +8458,8 @@ "node_modules/array-ify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", - "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==" + "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "dev": true }, "node_modules/array-includes": { "version": "3.1.6", @@ -9593,11 +9528,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/call-me-maybe": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", - "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==" - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -10120,14 +10050,6 @@ "node": ">=4" } }, - "node_modules/code-error-fragment": { - "version": "0.0.230", - "resolved": "https://registry.npmjs.org/code-error-fragment/-/code-error-fragment-0.0.230.tgz", - "integrity": "sha512-cadkfKp6932H8UkhzE/gcUqhRMNf8jHzkAN7+5Myabswaghu4xABTgPHDCjW+dBAJxj/SpkTYokpzDqY4pCzQw==", - "engines": { - "node": ">= 4" - } - }, "node_modules/collect-v8-coverage": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", @@ -10216,6 +10138,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "dev": true, "dependencies": { "array-ify": "^1.0.0", "dot-prop": "^5.1.0" @@ -10322,19 +10245,6 @@ "node": ">=16" } }, - "node_modules/conventional-changelog-conventionalcommits": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-5.0.0.tgz", - "integrity": "sha512-lCDbA+ZqVFQGUj7h9QBKoIpLhl8iihkO0nCTyRNzuXtcd7ubODpYB04IFy31JloiJgG0Uovu8ot8oxRzn7Nwtw==", - "dependencies": { - "compare-func": "^2.0.0", - "lodash": "^4.17.15", - "q": "^1.5.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/conventional-commits-parser": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", @@ -12505,6 +12415,7 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, "dependencies": { "is-obj": "^2.0.0" }, @@ -14164,7 +14075,8 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -14746,9 +14658,9 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "optional": true, @@ -15148,11 +15060,6 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==" - }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -15774,26 +15681,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/imports-loader": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/imports-loader/-/imports-loader-5.0.0.tgz", - "integrity": "sha512-tXgL8xxZFjOjQLLiE7my00UUQfktg4G8fdpXcZphL0bJWbk9eCxKKFaCwmFRcwyRJQl95GXBL1DoE1rCS/tcPw==", - "dev": true, - "dependencies": { - "source-map-js": "^1.0.2", - "strip-comments": "^2.0.1" - }, - "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.0.0" - } - }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -16262,6 +16149,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, "engines": { "node": ">=8" } @@ -19719,7 +19607,8 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "node_modules/json-source-map": { "version": "0.6.1", @@ -19750,18 +19639,6 @@ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", "dev": true }, - "node_modules/json-to-ast": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/json-to-ast/-/json-to-ast-2.1.0.tgz", - "integrity": "sha512-W9Lq347r8tA1DfMvAGn9QNcgYm4Wm7Yc+k8e6vezpMnRT+NHbtlxgNBXRVjXe9YM6eTn6+p/MKOlV/aABJcSnQ==", - "dependencies": { - "code-error-fragment": "0.0.230", - "grapheme-splitter": "^1.0.4" - }, - "engines": { - "node": ">= 4" - } - }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -20528,11 +20405,6 @@ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", "dev": true }, - "node_modules/lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==" - }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -23694,11 +23566,6 @@ "node": ">=12.0.0" } }, - "node_modules/protocol-buffers-schema": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", - "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==" - }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -23782,6 +23649,7 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", + "dev": true, "engines": { "node": ">=0.6.0", "teleport": ">=0.2.0" @@ -27214,11 +27082,6 @@ "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", "dev": true }, - "node_modules/tiny-merge-patch": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/tiny-merge-patch/-/tiny-merge-patch-0.1.2.tgz", - "integrity": "sha512-NLoA//tTMBPTr0oGdq+fxnvVR0tDa8tOcG9ZGbuovGzROadZ404qOV4g01jeWa5S8MC9nAOvu5bQgCW7s8tlWQ==" - }, "node_modules/tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -29222,11 +29085,6 @@ "node": ">= 6" } }, - "node_modules/yaml-ast-parser": { - "version": "0.0.43", - "resolved": "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz", - "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==" - }, "node_modules/yaml-js": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/yaml-js/-/yaml-js-0.3.1.tgz", diff --git a/package.json b/package.json index 3cd0b4c7dab..48af8b06537 100644 --- a/package.json +++ b/package.json @@ -55,13 +55,13 @@ "link:apidom-ls": "npm link @swagger-api/apidom-ls" }, "dependencies": { - "@asyncapi/avro-schema-parser": "^1.1.0", - "@asyncapi/openapi-schema-parser": "^2.0.3", - "@asyncapi/parser": "^1.18.1", - "@asyncapi/protobuf-schema-parser": "^1.0.0", - "@asyncapi/react-component": "=1.4.2", - "@babel/runtime": "^7.24.1", - "@braintree/sanitize-url": "^7.0.0", + "@asyncapi/avro-schema-parser": "^3.0.18", + "@asyncapi/openapi-schema-parser": "^3.0.18", + "@asyncapi/parser": "^3.0.10", + "@asyncapi/protobuf-schema-parser": "^3.2.8", + "@asyncapi/react-component": "^1.4.2", + "@babel/runtime": "^7.22.6", + "@braintree/sanitize-url": "^7.0.1", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.0", "@mui/material": "^5.15.14", diff --git a/src/plugins/editor-monaco/components/ValidationTable/_validation-table.scss b/src/plugins/editor-monaco/components/ValidationTable/_validation-table.scss index 2104c71a076..b5105ae3f52 100644 --- a/src/plugins/editor-monaco/components/ValidationTable/_validation-table.scss +++ b/src/plugins/editor-monaco/components/ValidationTable/_validation-table.scss @@ -29,11 +29,16 @@ } - thead th:nth-of-type(1), thead th:nth-of-type(2) { + thead th:nth-of-type(1), thead th:nth-of-type(2){ text-align: center; width: 70px; } + thead th:nth-of-type(3) { + text-align: left; + width: 100px; + } + tbody { display: block; width: 100%; @@ -42,6 +47,10 @@ overflow: auto; } + tbody tr { + width: 100% !important; + } + tbody tr:hover { background-color: #e1e1e1; } @@ -60,7 +69,7 @@ } tbody td:nth-of-type(3) { - width: 90px; + width: 100px; } tbody td:nth-of-type(3) { diff --git a/src/plugins/editor-preview-asyncapi/actions.js b/src/plugins/editor-preview-asyncapi/actions.js index aa7fb8695b8..a50c26c1e88 100644 --- a/src/plugins/editor-preview-asyncapi/actions.js +++ b/src/plugins/editor-preview-asyncapi/actions.js @@ -1,15 +1,10 @@ import ShortUniqueId from 'short-unique-id'; -import { parse as parseAsyncAPIDefinition, registerSchemaParser } from '@asyncapi/parser'; -import * as openapiSchemaParser from '@asyncapi/openapi-schema-parser'; -import * as avroSchemaParser from '@asyncapi/avro-schema-parser'; -import * as protobufSchemaParser from '@asyncapi/protobuf-schema-parser'; +import { Parser } from '@asyncapi/parser'; +import { OpenAPISchemaParser } from '@asyncapi/openapi-schema-parser'; +import { AvroSchemaParser } from '@asyncapi/avro-schema-parser'; +import { ProtoBuffSchemaParser } from '@asyncapi/protobuf-schema-parser'; -import * as ramlSchemaParser from './util/raml-1-0-parser.js'; - -registerSchemaParser(openapiSchemaParser); -registerSchemaParser(avroSchemaParser); -registerSchemaParser(protobufSchemaParser); -registerSchemaParser(ramlSchemaParser); +import { Raml10SchemaParser } from './util/parsers/raml-1-0-parser.js'; /** * Action types. @@ -44,20 +39,27 @@ export const parseSuccess = ({ parseResult, content, requestId }) => ({ meta: { content, requestId }, }); -export const parseFailure = ({ error, content, requestId }) => ({ +export const parseFailure = ({ error, parseResult, content, requestId }) => ({ type: EDITOR_PREVIEW_ASYNCAPI_PARSE_FAILURE, payload: error, error: true, - meta: { content, requestId }, + meta: { content, requestId, parseResult }, }); /** * Async thunks. */ -export const parse = (content, parserOptions = {}) => { +export const parse = (content, options = {}) => { const uid = new ShortUniqueId({ length: 10 }); + const { parserOptions, parseOptions } = options; + const parser = new Parser(parserOptions); + parser.registerSchemaParser(OpenAPISchemaParser()); + parser.registerSchemaParser(AvroSchemaParser()); + parser.registerSchemaParser(Raml10SchemaParser()); + parser.registerSchemaParser(ProtoBuffSchemaParser()); + return async (system) => { /** * This code can easily be offloaded to a web worker and allow MRT @@ -69,8 +71,18 @@ export const parse = (content, parserOptions = {}) => { editorPreviewAsyncAPIActions.parseStarted({ content, requestId }); try { - const parseResult = await parseAsyncAPIDefinition(content, parserOptions); - editorPreviewAsyncAPIActions.parseSuccess({ parseResult, content, requestId }); + const parseResult = await parser.parse(content, parseOptions); + + if (parseResult.document) { + editorPreviewAsyncAPIActions.parseSuccess({ parseResult, content, requestId }); + } else { + editorPreviewAsyncAPIActions.parseFailure({ + error: new Error('Document is empty'), + parseResult, + content, + requestId, + }); + } } catch (error) { editorPreviewAsyncAPIActions.parseFailure({ error, content, requestId }); } diff --git a/src/plugins/editor-preview-asyncapi/reducers.js b/src/plugins/editor-preview-asyncapi/reducers.js index 7ae270066ef..b23919b4f3d 100644 --- a/src/plugins/editor-preview-asyncapi/reducers.js +++ b/src/plugins/editor-preview-asyncapi/reducers.js @@ -1,5 +1,3 @@ -import { AsyncAPIDocument } from '@asyncapi/parser'; -import uniqWith from 'lodash/uniqWith.js'; import { fromJS } from 'immutable'; import { @@ -15,49 +13,12 @@ export const SUCCESS_STATUS = 'success'; export const FAILURE_STATUS = 'failure'; export const initialState = { - parserMarkers: [], parseStatus: IDLE_STATUS, parseRequestId: null, parseResult: null, parseErrors: null, }; -/** - * Reducer utils. - */ - -const parseValidationErrorsReducer = (action) => { - const { payload: error } = action; - - if (!(Array.isArray(error.validationErrors) && error.validationErrors.length > 0)) return []; - - return error.validationErrors.map((validationError) => ({ - message: validationError.title, - startLineNumber: validationError.location.startLine, - endLineNumber: validationError.location.endLine, - startColumn: validationError.location.startColumn, - endColumn: validationError.location.endColumn, - })); -}; - -const parseRefErrorsReducer = (action) => { - const { payload: error } = action; - - if (!(Array.isArray(error.refs) && error.refs.length > 0)) return []; - - return error.refs.map((refError, index) => { - const message = index === 0 ? error.title : 'Invalid JSON Reference'; - - return { - message, - startLineNumber: refError.startLine, - endLineNumber: refError.endLine, - startColumn: refError.startColumn, - endColumn: refError.endColumn, - }; - }); -}; - /** * Case reducers modeled as finite state machine. */ @@ -84,11 +45,16 @@ const parseSuccessReducer = (state, action) => { const status = state.get('parseStatus') || IDLE_STATUS; const requestId = state.get('parseRequestId'); + /** + * @TODO(vladimir.gorej@gmail.com): parseResult should be stringified before storing in the state. + * + * stringify/unstringify isomorphism is broken. More info in https://github.com/asyncapi/asyncapi-react/issues/769. + */ if (status === PARSING_STATUS && requestId === action.meta.requestId) { return state.merge({ parseStatus: SUCCESS_STATUS, parseRequestId: null, - parseResult: AsyncAPIDocument.stringify(action.payload), + parseResult: action.payload.document, parseErrors: null, }); } @@ -101,21 +67,20 @@ const parseFailureReducer = (state, action) => { const requestId = state.get('parseRequestId'); if (status === PARSING_STATUS && requestId === action.meta.requestId) { - const validationErrors = parseValidationErrorsReducer(action); - const refErrors = parseRefErrorsReducer(action); - const parseErrors = uniqWith([...validationErrors, ...refErrors], (arrVal, othVal) => { - return ( - arrVal.message === othVal.message && - arrVal.startLineNumber === othVal.startLineNumber && - arrVal.startColumn === othVal.startColumn - ); - }); - + /** + * Spectral SeverityEnum + * - 0 (error) + * - 1 (warn) + * - 2 (info) + * - 3 (hint) + */ return state.merge({ parseStatus: FAILURE_STATUS, parseRequestId: null, parseResult: null, - parseErrors: fromJS(parseErrors), + parseErrors: fromJS( + action.meta.parseResult.diagnostics.filter((diagnostic) => diagnostic.severity === 0) + ), }); } diff --git a/src/plugins/editor-preview-asyncapi/selectors.js b/src/plugins/editor-preview-asyncapi/selectors.js index 530e6d5a7c0..2318ff2f87b 100644 --- a/src/plugins/editor-preview-asyncapi/selectors.js +++ b/src/plugins/editor-preview-asyncapi/selectors.js @@ -1,4 +1,3 @@ -import { AsyncAPIDocument } from '@asyncapi/parser'; import { createSelector } from 'reselect'; import { @@ -14,17 +13,11 @@ const selectState = (state) => state; export const selectParseStatus = (state) => state.get('parseStatus', IDLE_STATUS); export const selectParseResult = createSelector(selectState, (state) => { - const parseResult = state.get('parseResult', initialState.parseResult); - - if (typeof parseResult !== 'string') { - return null; - } - - return AsyncAPIDocument.parse(state.get('parseResult')); + return state.get('parseResult', initialState.parseResult); }); export const selectParseErrors = createSelector(selectState, (state) => { - const parseErrorsIm = state.get('parseErrors', initialState.parseResult); + const parseErrorsIm = state.get('parseErrors', initialState.parseErrors); if (parseErrorsIm === null) { return []; @@ -38,8 +31,12 @@ export const selectParseMarkers = createSelector( (state, { monaco }) => monaco, (state, { modelVersionId }) => modelVersionId, (parseErrors, monaco, modelVersionId) => { - return parseErrors.map((parseError) => ({ - ...parseError, + return parseErrors.map((diagnostic) => ({ + message: diagnostic.message, + startLineNumber: diagnostic.range.start.line, + endLineNumber: diagnostic.range.end.line, + startColumn: diagnostic.range.start.character, + endColumn: diagnostic.range.end.character, code: `ASNCPRSR`, severity: monaco.MarkerSeverity.Error, source: '@asyncapi/parser', diff --git a/src/plugins/editor-preview-asyncapi/util/parsers/raml-1-0-parser.js b/src/plugins/editor-preview-asyncapi/util/parsers/raml-1-0-parser.js new file mode 100644 index 00000000000..92e21e20400 --- /dev/null +++ b/src/plugins/editor-preview-asyncapi/util/parsers/raml-1-0-parser.js @@ -0,0 +1,31 @@ +import YAML from 'js-yaml'; + +/* eslint-disable no-param-reassign */ + +// eslint-disable-next-line import/prefer-default-export +export const Raml10SchemaParser = () => ({ + async validate() { + return []; + }, + + async parse({ message, defaultSchemaFormat }) { + try { + let { payload } = message; + if (typeof payload === 'object') { + payload = YAML.dump(payload); + } + + message['x-parser-original-schema-format'] = message.schemaFormat || defaultSchemaFormat; + message['x-parser-original-payload'] = payload; + message.payload = { description: `\`\`\`raml\n${payload}\n\`\`\`` }; + } catch (e) { + console.error(e); // eslint-disable-line no-console + } + }, + + getMimeTypes() { + return ['application/raml+yaml;version=1.0']; + }, +}); + +/* eslint-enable */ diff --git a/src/plugins/editor-preview-asyncapi/util/raml-1-0-parser.js b/src/plugins/editor-preview-asyncapi/util/raml-1-0-parser.js deleted file mode 100644 index 7c63641fe34..00000000000 --- a/src/plugins/editor-preview-asyncapi/util/raml-1-0-parser.js +++ /dev/null @@ -1,22 +0,0 @@ -import YAML from 'js-yaml'; - -/* eslint-disable no-param-reassign */ - -export async function parse({ message, defaultSchemaFormat }) { - try { - let { payload } = message; - if (typeof payload === 'object') { - payload = YAML.dump(payload); - } - - message['x-parser-original-schema-format'] = message.schemaFormat || defaultSchemaFormat; - message['x-parser-original-payload'] = payload; - message.payload = { description: `\`\`\`raml\n${payload}\n\`\`\`` }; - } catch (e) { - console.error(e); // eslint-disable-line no-console - } -} - -export function getMimeTypes() { - return ['application/raml+yaml;version=1.0']; -} diff --git a/test/cypress/e2e/plugin.validation-pane.cy.js b/test/cypress/e2e/plugin.validation-pane.cy.js index e4ff47a219d..ce2e4655dee 100644 --- a/test/cypress/e2e/plugin.validation-pane.cy.js +++ b/test/cypress/e2e/plugin.validation-pane.cy.js @@ -21,7 +21,7 @@ describe('Monaco Editor with Validation Pane', () => { * expect table body to always not exist if there are no errors * make appropriate changes if/when needed */ - it('should display visible Validation Pane table header and table body when error exists', () => { + it.only('should display visible Validation Pane table header and table body when error exists', () => { cy.get('.swagger-editor__validation-table') .should('exist') .get('.swagger-editor__validation-table > thead') @@ -47,7 +47,7 @@ describe('Monaco Editor with Validation Pane', () => { .should('be.visible'); // validation error message is parser specific cy.get('.swagger-editor__validation-table > tbody td:nth-child(4)') - .contains('should NOT have') + .contains('Object must have required property "info"') .should('be.visible'); });