Open Jean-Baptiste-Lasselle opened 11 months ago
ok, done with six.ts
: i could successfully find how to configure the --no-enums option, the equivalent is inferEnums: false
:
async function quicktypeJSON(targetLanguage: string, typeName: string, jsonString: any) {
const jsonInput = jsonInputForTargetLanguage(targetLanguage);
// We could add multiple samples for the same desired
// type, or many sources for other types. Here we're
// just making one type from one piece of sample JSON.
await jsonInput.addSource({
name: typeName,
samples: [jsonString]
});
const inputData = new InputData();
inputData.addInput(jsonInput);
return await quicktype({
inputData,
lang: targetLanguage,
outputFilename: `src/examples/.quicktype.generated/quicktype.generated.ts`,
inferEnums: false // that's how to force gnerate Arrayof string instead of an enum
});
}
--no-enums
options forces to generate Array of strings instead of enums (and that is very good)--no-enums
option equivalent in code (not with CLI)I need to try that one