Any ideas/chances to run it with Arrays/Objects properly?
Closed this issue · 3 comments
Hi! I'm loving so far this package.
However, I'm still not sure if it is possible to generate the file I need from terminal 100% automated, because parts of it might include JSON objects and array, like this (example only):
response: { 200: { type: "object", properties: { status: { type: "string" }, statusCode: { type: "integer" }, data: { type: "array", items: { type: "object", properties: { // name: { type: "string" } // prompt in terminal for this json object // could be an array here as well... } } } } },
Are there any recommendations to automate this?
Thanks in advance, best regards!
I'm not 100% following what you are trying to do but you should build up the structure before sending it to generateTemplateFilesCommandLine
.
(async () => {
const response = await axios.get('https://api.something.com');
const items = someFunctionThatTakesTheResponseAndCreatesTheStructureForTheLibrary(response);
generateTemplateFilesCommandLine(items);
})();
Actually the problem is that I need to use replacers that are objects/arrays, so I'm not sure exactly how to prompt continuously for them in console. One way of doing it I thought would be defining how many items in array before asking properties, but this is very limited solution... I will try to think of a better one...