Skip to content

Schema doesn't include Dictionary-Interface #319

Open
@evilstiefel

Description

@evilstiefel

I'm using the generator to create a schema for serialized state that I want to later load into my application and check if it still matches the specification.

My state contains properties that look like this

export interface EntityState<T> {
    ids: string[] | number[];
    entities: Dictionary<T>;
}

However, the generated schemas then only contain a generic object-property, even when I declare the property with an interface, like so:

"definitions": {
    "EntityState<IPersonalInterface>": {
      "type": "object",
      "properties": {
        "ids": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          ]
        },
        "entities": {
          "$ref": "#/definitions/Dictionary<IPersonalInterface>"
        }
      },
      "additionalProperties": false,
      "required": [
        "entities",
        "ids"
      ]
    },
    "Dictionary<IPersonalInterface>": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/T"
      }
    },
    "T": {
      "type": "object",
      "additionalProperties": false
    },

I'd expect "Dictionary<IPersonalInterface>" so be extended to IPersonalInterface, and not just T in the result. Right now, schema validation fails because all the properties of IPersonalInterface are counted as additional properties. Is there any way I can get the full schema to be generated?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions