Description
Quicktype CLI renames types randomly, making it really unreliable. E.g. The json schema below results in a typescript interface named Light
instead of LightParams
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"LightParams": {
"properties": {
"outlet_id": {
"type": "string"
},
"app_id": {
"type": "string"
},
"rgba": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"outlet_id",
"app_id",
"rgba"
]
}
},
"properties": {
"LightParams": {
"$ref": "#/$defs/LightParams"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"LightParams"
]
}
Issue Type
The issue is the unpredictable renaming of types at runtime.
Context (Environment, Version, Language)
CLI v23.1.4
Input Format: JSON Schema
Output Language: Typescript
I'm using the CLI
CLI, npm, or app.quicktype.io:
Version: v23.1.4
Description
I'm trying to generate types that have predictable names. I want to have control over the name of a type by just naming it that way.
Input Data
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"LightParams": {
"properties": {
"outlet_id": {
"type": "string"
},
"app_id": {
"type": "string"
},
"rgba": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"outlet_id",
"app_id",
"rgba"
]
}
},
"properties": {
"LightParams": {
"$ref": "#/$defs/LightParams"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"LightParams"
]
}
Expected Behaviour / Output
I want to receive an interface named LightParams
not Light
since I named it that way and I never said to cut off random parts of my type name.
Current Behaviour / Output
Quicktype removes the "Params" suffix. The same happens with other words like Value or Parameter.
Steps to Reproduce
quicktype --src-lang schema --lang ts -o $output_file --just-types --no-date-times --alphabetize-properties $input_file
Possible Solution
Add an option to deactivate the arbitrary renaming of types.