Skip to content

[BUG]: combineClasses option does not work #2724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
TPNils opened this issue May 2, 2025 · 0 comments
Open

[BUG]: combineClasses option does not work #2724

TPNils opened this issue May 2, 2025 · 0 comments
Labels

Comments

@TPNils
Copy link

TPNils commented May 2, 2025

Issue Type

issue with quicktype output

Context (Environment, Version, Language)

Input Format: json
Output Language: typescript

Version: [email protected]

Description

I want to convert a bulk amount of json data into typescript interfaces. Apparently some of them appear identical to each other and get merged together, even with the combineClasses: false or omission of the option.

Input Data

see Steps to Reproduce

Expected Behaviour / Output

With the combineClasses: false or combineClasses ommited, i expect to find 2 interfaces

export interface Obj1 {
    definition: string;
}
export interface Obj2 {
    definition: string;
}

Current Behaviour / Output

export interface Obj2 {
    definition: string;
}

Steps to Reproduce

With NodeJS 18.19.1 on windows 10

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

async function main() {
  const inputData = new InputData();
  await inputData.addSource('json', {name: 'Obj1', samples: [JSON.stringify({definition: 'Obj1'})]}, () => jsonInputForTargetLanguage('typescript'));
  await inputData.addSource('json', {name: 'Obj2', samples: [JSON.stringify({definition: 'Obj2'})]}, () => jsonInputForTargetLanguage('typescript'));

  // same result without combineClasses
  const tsResult = await quicktype({inputData: inputData, combineClasses: false, lang: 'typescript', rendererOptions: {'just-types': 'true'}});
  console.log('typescript\n' + tsResult.lines.join('\n'))
}

main()

With your website

(i dont know how to share setup to your site so i will fall back to a screenshot)
Image

Possible Solution

@TPNils TPNils added the bug label May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant