-
-
Notifications
You must be signed in to change notification settings - Fork 533
If no type is specified, type as unknown #1049
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
Conversation
Thanks so much for doing the work on this, but I believe this conflicts with #1032 and the |
It doesn't conflict with that PR, since this is specifically when |
My mistake. I agree this is a good change. Sorry for the misunderstanding on my part! If the merge conflicts are fixed I’m happy to merge this and agree this is a bugfix and not a breaking change. |
Awesome, thank you! Will do once I get a chance |
849c52b
to
b2ddfe7
Compare
@@ -18,4 +19,26 @@ describe("utils", () => { | |||
return expect(tsUnionOf(...[0, true, "string", '"hello"'])).toBe('0 | true | string | "hello"'); | |||
}); | |||
}); | |||
|
|||
describe("tsIntersectionOf", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I happened to also add a utils.test.ts before this one made it into main :D but our test cases use different approaches. Would you like me to convert my cases into the pre-existing ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the opposite—we can move the ones there into this one. Thanks for adding these!
@@ -3483,7 +3483,7 @@ export interface external { | |||
* @example Sammy Shark | |||
*/ | |||
user_name?: string; | |||
user_billing_address?: Record<string, never> & external["resources/billing/models/billing_address.yml"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an intentional change - since unknown & AnyType === AnyType
is a tautology, I've added code to tsIntersectionOf to remove these redundant bits of the intersection.
These extraneous unknowns are caused by the definitions in the schema:
user_billing_address:
allOf:
- description: some description
- $ref: 'billing_address.yml'
We (correctly) interpret this as two schemas, the first registers to be a schema with no type defined and therefore unknown
. Why they did this escapes me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you!
Changes
Fixes #1039.
How to Review
Related docs: https://swagger.io/docs/specification/data-models/data-types/#any
I wish I could just update the snapshots without updating the specs.
Checklist
examples/
directory updated (if applicable)