Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

364
Views
Swagger-codegen: error: ignored arguments: 'Object'

I'm getting a weird error, and I can't seem to google the right things, as I'm finding no help online. I am writing a script that converts swagger files to typescript. The error message is the one in the title, and sadly that's all the information I have. I will post the code below, and the part where (I believe) the message is coming from:

async function getJson(){
    const agent = new https.Agent({  
        rejectUnauthorized: false
      });
      return axios.get('https://common-customer-bpms.dev.havida.net/v3/api-docs', { httpsAgent: agent })
        .then(response => generateSwagger(response))
}
getJson();

async function generateSwagger(response) {
    try {
        execSync(`java -jar ..\\swagger-codegen-cli.jar generate -l typescript-angular -o .\\projects\\common\\src -i ${response}`);
    } catch (error){
        console.log(error);
        console.log('You must have Java installed! You may have to change JAVA_HOME location & path (Ex: set JAVA_HOME=`C:\\Programme\\Java\\jre1.8.0_321`), (set PATH=${JAVA_HOME}/bin:$PATH)')
    }
}

I think the error is coming from the try block, the very last argument (-i ${response}). Am I able to use the parameter of the function in this way, or can I only use strings in cli commands? I'm at a loss

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

After multiple days of trying, here is the full code that works for anyone who may need it:

import axios from 'axios';
import https from 'node:https';
import {execSync} from 'child_process';
import fs from 'fs/promises';

async function getJson(){
    const agent = new https.Agent({  
        rejectUnauthorized: false
      });
      return axios.get('https://common-customer-bpms.dev.havida.net/v3/api-docs', { httpsAgent: agent })
        .then(response => fs.writeFile("temp.json", JSON.stringify(response.data), (error)=>{console.log(error)}))
        .then(() => generateSwagger())
}
getJson();

async function generateSwagger() {
    try {
        execSync(`java -jar ..\\swagger-codegen-cli.jar generate -l typescript-angular -i temp.json -o .\\projects\\common\\src\\lib`);
    } catch (error){
        console.log(error);
        console.log('You must have Java installed! You may have to change JAVA_HOME location & path (Ex: set JAVA_HOME=`C:\\Programme\\Java\\jre1.8.0_321`), (set PATH=${JAVA_HOME}/bin:$PATH)')
    } finally {
        fs.unlink("temp.json");
    }
}

This pulls the json from the desired url, and writes it to a file. This file is then used as the destination for -i, and once the conversion is complete, the json is deleted in the finally block.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!