hey-api / openapi-ts

🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more. Support: @mrlubos
https://heyapi.dev
Other
1.39k stars 107 forks source link

Inspect URL object with `openapi-fetch` #1174

Closed musjj closed 1 month ago

musjj commented 1 month ago

Description

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`

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 },
});
mrlubos commented 1 month ago

Hey @musjj, just want to make sure this request is in the correct repository? openapi-fetch does not belong to Hey API

musjj commented 1 month ago

WHOOPS, sorry about that.