Skip to content

Ignored validationKeywords for $ref types #624

@darren-demicoli-tma

Description

@darren-demicoli-tma

I have the following typescript definitions file test.ts:

interface AddressInfo {
  /**
   * @default xxx
   */
  address: string;
}

interface UserInfo {
  /**
   * @default xxx
   * @label xxx
   */
  name: string;
  /**
   * some desc ...
   *
   * @label xxx
   */
  extra: AddressInfo
}

I generated the schema using
typescript-json-schema test.ts UserInfo --out schema.json --validationKeywords label

and the generated schema is the following:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
        "AddressInfo": {
            "properties": {
                "address": {
                    "default": "xxx",
                    "type": "string"
                }
            },
            "type": "object"
        }
    },
    "properties": {
        "extra": {
            "$ref": "#/definitions/AddressInfo",
            "description": "some desc ..."
        },
        "name": {
            "default": "xxx",
            "label": "xxx",
            "type": "string"
        }
    },
    "type": "object"
}

As can be seen, the extra property contains the $ref and the description but is missing the label annotation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions