-
Notifications
You must be signed in to change notification settings - Fork 431
Open
Labels
Description
Hello, @bcherny, thank you for package 🙂 i use it and stumbled a mirror bug with title inside property. Currently title in property means name of property but in json schema draft it should means a short description. And also when i try add none english title i get a NoName alias for primitive.
this is a little snippet for reproduce behavior
const json2ts = require('json-schema-to-typescript');
const fs = require('fs');
const inputData = {
"title": "Example Schema",
"type": "object",
"properties": {
"lastName": {
"title": "Бла-бла-бла",
"type": "string"
},
},
"additionalProperties": false,
"required": ["firstName", "lastName"]
};
(async function example() {
const compiledModels = await json2ts.compile(inputData, '');
fs.writeFileSync(`output.ts`, compiledModels);
})();and after invoked i got this:
export type NoName = string;
export interface ExampleSchema {
lastName: NoName;
}but expect output like this:
export interface ExampleSchema {
/**
* Бла-бла-бла
*/
lastName: string;
}yeah, i know that i can use description to add description of property and it works how i want, but i need properly title behavior because i use it for transform Swagger.
if you agree with me i can try to fix it myself, thank you 🙂
spoike, Nightapes, hongha912, rxliuli, hakatashi and 1 more