You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and i use this programmatically code to generate the types:
import{compileFromFile}from'json-schema-to-typescript';import{dereference}from'@apidevtools/json-schema-ref-parser';importfsfrom'fs';// List of schema filesconstfilteredNames=['cardDataResponse.schema.json'];// Function to dereference and compile the schemafilteredNames.forEach((filePath)=>{// Dereference the schema to resolve all $refdereference(filePath).then((schema)=>{fs.writeFileSync("test.schema.json",JSON.stringify(schema,null,2));// Compile the dereferenced schema into TypeScript typesreturncompileFromFile("test.schema.json",{unreachableDefinitions: true,// Ensure unreachable definitions are includedbannerComment: ""});}).then((ts)=>{// Append the TypeScript definition to a filefs.appendFileSync("schema-types.ts",`${ts}\n`);console.log(`Generated types for: ${filePath}`);}).catch((error)=>console.error(`${filePath} => \n`+error));});
even if i dont use deference and compile directly from file or even if i use const filteredNames = ['cardDataResponse.schema.json', 'definitions.schema.json']; the output i take is [k:string]: unknown. Like the library cannot resolve the type. Every help will be more than welcome, point out or workaround.
Thanks
The text was updated successfully, but these errors were encountered:
Hello everyone, i have the below schema:
and i use this programmatically code to generate the types:
even if i dont use deference and compile directly from file or even if i use
const filteredNames = ['cardDataResponse.schema.json', 'definitions.schema.json'];
the output i take is[k:string]: unknown
. Like the library cannot resolve the type. Every help will be more than welcome, point out or workaround.Thanks
The text was updated successfully, but these errors were encountered: