Skip to content

Add patterns to object property names #1740

Open
@gsuess

Description

@gsuess

Constraints on object keys should be validated:

/**
 * @minLength 2
 * @maxLength 256
 * @pattern ^\w+$
 */
type ObjectKey = string;

export type MyObject = {
  readonly [key: ObjectKey]: string;
}

This should generate a propertyNames annotation:

{
  "type": "object",
  "propertyNames": {
      "pattern": "^\w+$"
      "minLength": 2,
      "maxLength": 256
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions