-
-
Notifications
You must be signed in to change notification settings - Fork 528
Add questionToken option to transform #1417
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
Add questionToken option to transform #1417
Conversation
|
|
||
```diff | ||
- file: Blob; | ||
+ file?: Blob | null; |
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.
👍 The docs look great! Thank you.
@@ -467,6 +467,11 @@ export type SchemaObject = { | |||
| {} | |||
); | |||
|
|||
export interface TransformObject { |
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 great.
We can probably extend this pretty far before having to change this API.
}, | ||
], | ||
[ | ||
"options > transform with schema object", |
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.
💯 Fantastic tests!
@@ -51,14 +53,31 @@ export default function transformComponentsObject( | |||
const items: ts.TypeElement[] = []; | |||
if (componentsObject[key]) { | |||
for (const [name, item] of getEntries(componentsObject[key], ctx)) { | |||
const subType = transformers[key](item, { | |||
let subType = transformers[key](item, { |
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.
Yup I think this will work in all cases I can think of. Just handling keys on type: object
schema objects should be the main usecase here (we don’t ever want to have question tokens, for example, directly on the components["schemas"]
object as that doesn’t make sense)
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 am not 100% confident I covered all use cases of the transform function. Keep in mind that with the limited knowledge of this library, I might have missed some things.
All the tests pass, including the ones you added! So as far as I’m concerned, you handled all cases perfectly 🙂 (and if you missed something, then that’s the test suite’s fault and not yours)
Also the changeset can be ignored in this PR, as this will go into the v7 (beta) release (i.e. there’s no version to bump yet). But I’ll update the release notes for v7 and give you credit. |
Changes
This adds the possibility of appending a questionToken to a property using the transform function. Fixes #1411
How to Review
I am not 100% confident I covered all use cases of the transform function. Keep in mind that with the limited knowledge of this library, I might have missed some things.
Checklist
docs/
updated (if necessary)pnpm run update:examples
run (only applicable for openapi-typescript)