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

special case empty object for jtd #2158

Merged

Conversation

erikbrinkman
Copy link
Collaborator

What issue does this pull request resolve?

fixes #2123

What changes did you make?

In short, this special cases empty objects since they have special meaning due to the way typescripts type system works. I'll leave more detail in the issue.

Is there anything that requires more attention while reviewing?

I did some various "clean up" to JTD Schema as well, but the substantiative change is special casing that type and adding tests. I think the test coverage is pretty solid (although clearly not perfect) so I wouldn't be too worries.

@epoberezkin
Copy link
Member

Great, thank you!

@epoberezkin
Copy link
Member

It failed when merging master in - will check later what happened…

@erikbrinkman
Copy link
Collaborator Author

The build failure is

Error: node_modules/re2/re2.d.ts(13,13): error TS24[30](https://github.com/ajv-validator/ajv/actions/runs/3507783326/jobs/5875718510#step:4:31): Interface 'RE2' incorrectly extends interface 'RegExp'.
  The types returned by 'exec(...)' are incompatible between these types.
    Type 'RE2ExecArray<string> | null' is not assignable to type 'RegExpExecArray | null'.
      Property '0' is missing in type 'RE2ExecArray<string>' but required in type 'RegExpExecArray'.

which seems unrelated to this merge. Seems like a versioning issue, but probably worth investigating :/

@epoberezkin epoberezkin merged commit dab8504 into ajv-validator:master Jan 2, 2023
@epoberezkin epoberezkin added this to the 8.12 milestone Jan 2, 2023
@erikbrinkman erikbrinkman deleted the jtd-empty-discriminant-unions branch January 3, 2023 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Can't create JTDSchemaType from tagged union with no additional properties
2 participants