Closed
Description
Description
Sometimes it can be useful to inspect the constructed URL object from openapi-fetch
. For example, when you want to create an <a>
element that links to a GET
route.
In Hono, you can inspect an API url like this:
let url = client.api.posts.$url()
console.log(url.pathname) // `/api/posts`
url = client.api.posts[':id'].$url({
param: {
id: '123',
},
})
console.log(url.pathname) // `/api/posts/123`
Proposal
It would be nice if you can do this with openapi-fetch
. Maybe the syntax can look like:
client.URL("/blogposts/{post_id}", {
params: { post_id: "my-post" },
query: { version: 2 },
});
Checklist
- I’m willing to open a PR for this (see CONTRIBUTING.md)
Metadata
Metadata
Assignees
Type
Projects
Status
Done