Skip to content

Commit

Permalink
Merge pull request #36 from snyk-tech-services/develop
Browse files Browse the repository at this point in the history
release changes
  • Loading branch information
aarlaud authored Sep 17, 2021
2 parents cc47289 + 957c90b commit d1ce217
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/generators/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const generateClass = (
abstractionImportsArray.push(
generateImportsForAbstractionMethods(classToGenerate),
);
abstractionImportsArray = [...new Set(abstractionImportsArray)];

if (classToGenerate) {
if (isRootClass) {
Expand Down Expand Up @@ -777,7 +778,7 @@ const generatePaginationMethods = (
method.argsList = method.argsList
.filter((x) => !x.startsWith('perPage'))
.filter((x) => !x.startsWith('page'));
method.argsList.unshift('noLimitMode: boolean = false');
method.argsList.push('noLimitMode: boolean = false');

let qsIfStatements = '';
qsParametersNamesList.forEach((qsParameterName) => {
Expand Down Expand Up @@ -1004,6 +1005,6 @@ parsedJSON.forEach((classItem) => {
const classCode = generateClass(classItem);
fs.writeFileSync(
path.join('./src/lib/client/generated/' + classItem.name + '.ts'),
initLines + abstractionImportsArray.join(`\n`) + classCode,
initLines + abstractionImportsArray.join(`\n`) + '\n' + classCode,
);
});
5 changes: 4 additions & 1 deletion src/lib/preprocessors/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ const main = (jsonPath: string) => {
paths = consolidateReferences(paths);
Object.keys(paths).forEach((path) => {
const verbs = Object.keys(paths[path]);
const splitEndpoint = path.split('/').filter((x) => x);
const splitEndpoint = path
.split('?')[0]
.split('/')
.filter((x) => x);
classMap = registerEndpoint(
classMap,
extractClassAndParamFromEndpoint(splitEndpoint, verbs, path),
Expand Down

0 comments on commit d1ce217

Please sign in to comment.