ts-json-schema-generator icon indicating copy to clipboard operation
ts-json-schema-generator copied to clipboard

support `title`

Open dejankatanic opened this issue 2 years ago • 4 comments

For example:

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "title": "Contact",  <------ title
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": "string"
    }
  },
  "required": [
    "name"
  ],
  "type": "object"
}

dejankatanic avatar Nov 30 '22 15:11 dejankatanic

Please ask your questions on stack overflow. We reserve the issue tracker for bugs and feature requests.

Regarding your specific question, check the supported formats. We only support what's supported in JSON schema.

domoritz avatar Nov 30 '22 21:11 domoritz

Please ask your questions on stack overflow. We reserve the issue tracker for bugs and feature requests.

Regarding your specific question, check the supported formats. We only support what's supported in JSON schema.

Not sure what you were getting at here, titles are a supported feature of JSON schemas, see the meta-schema: https://json-schema.org/draft/2020-12/json-schema-core.

It would be useful if there was a way for them to be generated in the output schema without writing a custom formatter, i.e. a cli option such as --use-type-names-as-titles. I don't see why adding this as a cli option would be fundamentally different to options such as --no-top-ref .

zachary-povey avatar Jan 14 '24 15:01 zachary-povey

I see. Let's change this to a feature request and reopen.

domoritz avatar Jan 14 '24 19:01 domoritz