Skip to content

JSDoc annotations ignored when using an arrayified type (e.g. Demo[]) #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ssc-hrep3 opened this issue Jun 17, 2021 · 0 comments
Open

Comments

@ssc-hrep3
Copy link

When adding an arrayed type (e.g. Demo[]) to an object and then generating the schema from the resulting type, it omits all JSDoc annotations.

Here is an example with @pattern, but it also does not work with other annotations:

/**
 * @pattern ^\d+$
 */
type NumericString = string;

export type Test = { numericStringValues: NumericString[] };

The generated schema looks like this:

{
  "type": "object",
  "properties": {
    "numericStringValues": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "title": "numericStringValues"
    }
  },
  "additionalProperties": false,
  "required": [
    "numericStringValues"
  ]
}

It should however look like this (see the pattern property):

{
  "type": "object",
  "properties": {
    "numericStringValues": {
      "type": "array",
      "items": {
        "pattern": "^\d+$"
        "type": "string"
      },
      "title": "numericStringValues"
    }
  },
  "additionalProperties": false,
  "required": [
    "numericStringValues"
  ]
}

Version: 0.50.1
Schema Generation Settings:

{
  ref: false,
  required: true,
  noExtraProps: true,
  validationKeywords: ['errorMessage'],
  titles: true,
  uniqueNames: true,
  rejectDateType: true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant