Skip to content

[Schema Inaccuracy] bad definition for pushed_at property in many webhooks schemas #1872

Open
@wolfy1339

Description

@wolfy1339

Schema Inaccuracy

In many webhooks schemas that contain the pushed_at property, it is not defined correctly.

"pushed_at": {
  "oneOf": [
    { "type": "integer" },
    { "type": "string", "format": "date-time" }
  ],
  "type": ["null", "integer", "string"]
},

When you transform that into typescript, it generates the following

pushed_at: (number | string) &
  (
    | (null & (number | string))
    | (number & (number | string))
    | ((number | string) & string)
  );

Expected

This format results in no duplication, and is much more concise as to what the actual types of the values are

"pushed_at": {
  "oneOf": [
    { "type": "integer" },
    { "type": "string", "format": "date-time" },
    { "type": "null" }
  ],
},

That would result in this generated typescript code:

pushed_at: number | string | null;

Reproduction Steps

n/a

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