Skip to content

Commit f890c48

Browse files
Satya900derberg
andauthored
refactor: remove unnecessary object spread in conditionalGeneration.js (#1999)
Co-authored-by: Satyabrata Mohanty <mohantysatyabrata900@gmail.com> Co-authored-by: Lukasz Gornicki <lpgornicki@gmail.com>
1 parent ec0b5ae commit f890c48

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

apps/generator/lib/conditionalGeneration.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ async function isGenerationConditionMet (
4242
return conditionalSubjectGeneration(
4343
asyncapiDocument,
4444
templateConfig,
45-
matchedConditionPath
45+
matchedConditionPath,
46+
templateParams
4647
);
4748
}
4849
return conditionalParameterGeneration(templateConfig,matchedConditionPath,templateParams);
@@ -111,9 +112,7 @@ async function conditionalSubjectGeneration (
111112
const server = templateParams.server && asyncapiDocument.servers().get(templateParams.server);
112113
const source = jmespath.search({
113114
...asyncapiDocument.json(),
114-
...{
115-
server: server ? server.json() : undefined,
116-
},
115+
server: server ? server.json() : undefined,
117116
}, subject);
118117

119118
if (!source) {
@@ -140,7 +139,6 @@ async function validateStatus(
140139
if (!validation) {
141140
return false;
142141
}
143-
144142
const isValid = validation(argument);
145143

146144
if (!isValid) {
@@ -151,7 +149,6 @@ async function validateStatus(
151149
// TODO: https://github.com/asyncapi/generator/issues/1553
152150
log.debug(logMessage.conditionalFilesMatched(matchedConditionPath));
153151
}
154-
155152
return false;
156153
}
157154
return true;

0 commit comments

Comments
 (0)