typescript-json-schema
typescript-json-schema copied to clipboard
How to generate title in human readable format?
Code
export interface Abc {
firstName: string
}
Expected
freephoenix888@freephoenix888:~/Programming/deep/firebase-push-notification$ typescript-json-schema ./src/push-notification.ts "Abc" --titles
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"firstName": {
"title": "First name",
"type": "string"
}
},
"type": "object"
}
Actual
freephoenix888@freephoenix888:~/Programming/deep/firebase-push-notification$ typescript-json-schema ./src/push-notification.ts "Abc" --titles
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"firstName": {
"title": "firstName",
"type": "string"
}
},
"type": "object"
}
Additional Info
Why do I need this: I want to use this generated JSON-Schema for form generation using react-jsonschema-form
@YousefED
@domoritz
We can use capitalCase from https://www.npmjs.com/package/case-anything
Add JSDoc comment
export interface Abc {
/**
* First name
*/
firstName: string;
}
Remove --titles parameter from command and add @title JSDoc comment.
export interface Abc {
/**
* @title First name
*/
firstName: string;
}