Skip to content
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

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

Open
wolfy1339 opened this issue Nov 18, 2022 · 0 comments

Comments

@wolfy1339
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants