bcherny/json-schema-to-typescript

Drop the `@minItems` / `@maxItems` JSDoc / TSDoc comments on tuple types

danvk opened this issue · 0 comments

danvk commented

This JSON Schema:

{
  "title": "MyObject",
  "type": "object",
  "properties": {
    "ingest": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": [
        { "type": "string" },
        { "type": "number" }
      ]
    }
  }
}

results in this TS:

export interface MyObject {
  /**
   * @minItems 2
   * @maxItems 2
   */
  ingest?: [string, number];
  [k: string]: unknown;
}

This is fine, but I think the @minItems and @maxItems annotations are silly since the number of items is already quite clear from the tuple type.

I didn't see an option to disable outputting of this JSDoc, so this is a request to either 1) add such an option or 2) never generate JSDoc like this for a tuple type.