From 981c80d2209d674f901dc1f4843ea0cbfe700f0b Mon Sep 17 00:00:00 2001 From: Pavel Bodiachevskii Date: Tue, 12 Mar 2024 17:21:13 +0400 Subject: [PATCH] fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when referencing a json schema Add clarification comment for fix https://github.com/asyncapi/spec-json-schemas/issues/494 https://github.com/asyncapi/jasyncapi-idea-plugin/issues/49 --- tools/bundler/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/bundler/index.js b/tools/bundler/index.js index b9b9d9e0..3596c8b3 100644 --- a/tools/bundler/index.js +++ b/tools/bundler/index.js @@ -166,6 +166,16 @@ function getDefinitionName(def) { if (def.startsWith('http://asyncapi.com/bindings')) { const result = bindingsRegex.exec(def); if (result) { + /* + 4th element is for internal definitions like http://asyncapi.com/bindings/jms/0.0.1/server.json#/definitions/property + + When is empty, we can ignore it: + convert this: http://asyncapi.com/bindings/jms/0.0.1/server.json + to this: bindings-jms-0.0.1-server + Otherwise we MUST add it to not broke Json Schema validation: + convert this: http://asyncapi.com/bindings/jms/0.0.1/server.json#/definitions/property + to this: bindings-jms-0.0.1-server/definitions/property + */ if (result[4] === '') { return `${result[1].replace('/', '-')}-${result[2]}-${result[3]}`; }