-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1333 from hey-api/feat/client-fetch-build-url
feat: add buildUrl() method to fetch client
- Loading branch information
Showing
160 changed files
with
8,111 additions
and
3,131 deletions.
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,7 @@ | ||
--- | ||
'@hey-api/client-axios': patch | ||
'@hey-api/client-fetch': patch | ||
'@hey-api/openapi-ts': patch | ||
--- | ||
|
||
fix: experimental parser generates url inside data types |
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,34 @@ | ||
--- | ||
'@hey-api/client-fetch': minor | ||
--- | ||
|
||
## Build URL | ||
|
||
::: warning | ||
To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser). | ||
::: | ||
|
||
If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. | ||
|
||
```ts | ||
type FooData = { | ||
path: { | ||
fooId: number; | ||
}; | ||
query?: { | ||
bar?: string; | ||
}; | ||
url: '/foo/{fooId}'; | ||
}; | ||
|
||
const url = client.buildUrl<FooData>({ | ||
path: { | ||
fooId: 1, | ||
}, | ||
query: { | ||
bar: 'baz', | ||
}, | ||
url: '/foo/{fooId}', | ||
}); | ||
console.log(url) // prints '/foo/1?bar=baz' | ||
``` |
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
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
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
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
Oops, something went wrong.