From 936abfb85d6c0b89a497662d67d74efd44e2b7c7 Mon Sep 17 00:00:00 2001 From: "jonas-lt@live.dk" Date: Wed, 27 Sep 2023 09:55:57 +0200 Subject: [PATCH] fix template config validation --- lib/templateConfigValidator.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/templateConfigValidator.js b/lib/templateConfigValidator.js index 0f6e5dc87..26219f0e2 100644 --- a/lib/templateConfigValidator.js +++ b/lib/templateConfigValidator.js @@ -30,13 +30,14 @@ module.exports.validateTemplateConfig = (templateConfig, templateParams, asyncap isRequiredParamProvided(parameters, templateParams); isProvidedTemplateRendererSupported(templateConfig); if (asyncapiDocument) { + let server; if (usesNewAPI(templateConfig)) { - + server = asyncapiDocument.servers().get(templateParams.server); } else { - const server = asyncapiDocument.servers().get(templateParams.server); - isServerProvidedInDocument(server, templateParams.server); - isServerProtocolSupported(server, supportedProtocols, templateParams.server); + server = asyncapiDocument.servers()[templateParams.server]; } + isServerProvidedInDocument(server, templateParams.server); + isServerProtocolSupported(server, supportedProtocols, templateParams.server); } isProvidedParameterSupported(parameters, templateParams);