-
-
Notifications
You must be signed in to change notification settings - Fork 531
feat(openapi-typescript): Optional Export Root Type Aliases #1876
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
Changes from 4 commits
136e1f8
4dd0aaf
fb5baea
11cddd0
d40a7fd
7edf333
f64e0e6
f313c64
29b39e4
a59a89f
f8694f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -464,6 +464,37 @@ describe("transformComponentsObject", () => { | |
options: { ...DEFAULT_OPTIONS, excludeDeprecated: true }, | ||
}, | ||
], | ||
[ | ||
"options > rootTypes: true", | ||
{ | ||
given: { | ||
schemas: { | ||
SomeType: { | ||
type: "object", | ||
properties: { | ||
name: { type: "string" }, | ||
url: { type: "string" }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
want: `{ | ||
schemas: { | ||
SomeType: { | ||
name?: string; | ||
url?: string; | ||
}; | ||
}; | ||
responses: never; | ||
parameters: never; | ||
requestBodies: never; | ||
headers: never; | ||
pathItems: never; | ||
} | ||
export type SomeTypeSchema = components['schemas']['SomeType'];`, | ||
options: { ...DEFAULT_OPTIONS, rootTypes: true }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this is a great start to testing this, and this is exactly what we need! But we will need a lot more tests to handle all of the scenarios from my original requirements:
We will need all of this to happen in the same PR, because it’s very likely that supporting all this could lead to refactoring and churn based on the implementation (see the last point of #2—conflicts are very likely between all the collections). As-is I like the path you’re on and don’t see any problems in your implementation! But we need to have all of these present and tested before we merge this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed point 1 with d40a7fd. All conflicting names are suffixed by a Filled out the test to cover the other components properties in 7edf333 and tested for conflicts across them in f64e0e6 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
+1
Yeah I’m open to that, but don’t feel strongly. I think developers will realize if they’re importing the wrong things quickly. The main thing to handle was types silently missing from |
||
}, | ||
], | ||
[ | ||
"transform > with transform object", | ||
{ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
❤️ Thanks for fixing little things like this! It means a lot
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.
Your welcome! Gotta keep things consistent 🙂