-
-
Notifications
You must be signed in to change notification settings - Fork 525
fix: allow use of PathBasedClient
with generated paths
#1842
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"openapi-fetch": patch | ||
--- | ||
|
||
fix: allow use of `PathBasedClient` with generated `paths` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These tests are great, thank you. I’d like to have more of these in general. And since these can run inside a
test-d.ts
test, I’ve been thinking it would be good to separate the type vs runtime tests (and have more of these granular type assertions).What are your thoughts on splitting runtime vs type tests? And could these be good additions to get that rolling?
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 excellent question.
Libraries I've been working on so far (notably Scala.js) had to split runtime / type tests because of infrastructure restrictions (or more specifically test cases that should compile and test cases that shouldn't compile).
Personally, I often found that annoying. Because you end up with test cases like (pseudocode):
And somewhere completely different:
What we can do with TS is much nicer IMO:
That all being said: IMO it does make sense to split tests by some axis (e.g. the functionality offered, independent of whether the functionality is offered by the type system or the runtime system or a combination thereof).
So in this case, it is true we are testing the
Client
type function and its inference (w/o inference issues, this test would not be necessary, one could simply read the return type ofcreateClient
). So this could / should indeed go into a different "describe" (and/or even a different file).Now, along which axes to split tests (exported elements, "features", ...) is not easy. However, it is also something that can be done very ad-hoc, so there is no need to "get it right" the first time.
Splitting what is in
index.test.js
into multiple files is IMO definitely a good idea (merely based on the LOC count ofindex.test.js
).In summary:
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.
You’ve convinced me 🙂. Let’s split up the tests into more meaningful divisions then. I think the test suite “feels” complete currently because it’s just too big a file. But in reality is missing several cases still.
Can be a followup obviously! Thanks for weighing in.