-
-
Notifications
You must be signed in to change notification settings - Fork 543
fix: schema with properties
and oneOf
properties
#491
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
@gr2m This looks like it’s WIP? Happy to review whenever; just tag me! |
Yea it’s WIP, just added a failing test so far. I’ll let you know ones it’s ready |
814c96b
to
14b7de8
Compare
Codecov Report
@@ Coverage Diff @@
## main #491 +/- ##
==========================================
+ Coverage 78.52% 79.80% +1.28%
==========================================
Files 9 9
Lines 298 312 +14
Branches 92 98 +6
==========================================
+ Hits 234 249 +15
+ Misses 64 63 -1
Continue to review full report at Codecov.
|
@drwpow this is ready for review. In the first two commits I only update the OpenAPI spec from GitHub and our generated |
properties
and oneOf
propertiesproperties
and oneOf
properties
That works for me! I’d like for the |
src/transform/schema.ts
Outdated
@@ -105,9 +111,12 @@ export function transformSchemaObj(node: any): string { | |||
|
|||
output += tsIntersectionOf([ | |||
...(node.allOf ? (node.allOf as any[]).map(transformSchemaObj) : []), // append allOf first | |||
...(node.anyOf ? [transformAnyOf(node.anyOf)] : []), // append allOf first | |||
...(node.oneOf ? [transformOneOf(node.oneOf)] : []), // append allOf first |
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.
👍🏻
@@ -77,8 +77,14 @@ export function transformSchemaObj(node: any): string { | |||
break; | |||
} | |||
case "object": { | |||
const isAnyOfOrOneOfOrAllOf = "anyOf" in node || "oneOf" in node || "allOf" in node; |
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 logic has always broken my brain. This is clearer! Thanks
}>)) & ({ | ||
"a"?: string; | ||
|
||
})`); |
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.
Nice test 👍🏻
@drwpow could you cut a new release please? |
Sure! |
|
follow up to octokit/types.ts#274 and github/rest-api-description#220