Skip to content

output multiple files, in place? #2221

Open
@srsudar

Description

@srsudar

I'm working on a big project. It compiles using TSC to .d.ts files (see #2215).

However, when trying to run the ts-json-schema-generator on the .d.ts files, I am regularly getting errors that I seem to have hit the max string size:

<snip>/ts-json-schema-generator/ts-json-schema-generator.ts:82
    const schemaString = (config.minify ? stringify(schema) : stringify(schema, null, 2)) as string;
                                                              ^


RangeError: Invalid string length
    at stringify (<anonymous>)
    at stableStringify (<snip>/ts-json-schema-generator/ts-json-schema-generator.ts:82:63)
    at Object.<anonymous> (<snip>/ts-json-schema-generator/ts-json-schema-generator.ts:108:1)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Object.transformer (<snip>/ts-json-schema-generator/node_modules/tsx/dist/register-DCnOAxY2.cjs:2:1186)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)

Is there a way to instead of putting the schema in a single large file, instead have it generate smaller schema files? If I had Foo.d.ts and Bar.d.ts, eg, I'd be happy to have Foo.schema.json and Bar.schema.json, and have them reference each other using relative paths.

Apologies if this is already supported somehow in a way that I'm missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions