Skip to content

[BUG]: quicktype-core silently ignores unknown rendererOptions keys #2933

Description

@schani

Issue Type

quicktype-core API (developer experience).

Context (Environment, Version, Language)

Input Format: JSON
Output Language: any

CLI, npm, or app.quicktype.io: npm (quicktype-core)
Version: 25.0.0-pre1 (also reproduces on 24.0.2)

Description

Passing an unrecognized key in rendererOptions is silently ignored — no error, no warning. A typo (or an option name that exists for a different language) produces default output with no signal that the option had no effect:

const { quicktype, InputData, jsonInputForTargetLanguage } = require("quicktype-core");

const jsonInput = jsonInputForTargetLanguage("typescript");
await jsonInput.addSource({ name: "X", samples: ['{"a": 1}'] });
const inputData = new InputData();
inputData.addInput(jsonInput);

// "totally-bogus-option" is accepted without complaint
const result = await quicktype({
    inputData,
    lang: "typescript",
    rendererOptions: { "totally-bogus-option": "yes" },
});

The CLI does the right thing here (Error: Option parsing failed: Unknown option: --just-typs.), so the core API is strictly less safe than the CLI for the same mistake. This bit me for real while testing: I passed C#'s just-types spelling to a language that names it differently and got silently un-customized output.

Expected Behavior

quicktype() should throw (or at minimum warn via debugPrintTimes-style logging) when a rendererOptions key doesn't match any option of the target language. Since RendererOptions is already typed per-language in newer versions, a runtime check would also catch untyped/dynamic callers (plain JS, options loaded from config files).

🤖 Filed with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions