openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

React-Query: Add getKey method

Open onionhammer opened this issue 1 year ago • 3 comments

Changes

Adds support for getting a react query key in the same format this library generates the keys

Fixes #1898

How to Review

How can a reviewer review your changes? What should be kept in mind for this review?

Checklist

  • [x] Unit tests updated
  • [x] docs/ updated (if necessary)
  • [ ] pnpm run update:examples run (only applicable for openapi-typescript)

onionhammer avatar Sep 03 '24 17:09 onionhammer

⚠️ No Changeset found

Latest commit: a0b55a43df051b05b6023c1a4591dc1a78bdd981

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Sep 03 '24 17:09 changeset-bot[bot]

Hi @onionhammer and thanks for willing to contribute!

Unfortunately, it seems that your PR as the same goal as the already opened https://github.com/openapi-ts/openapi-typescript/pull/1858/files wich as already been discussed in previous issues.

If it is the case, feel free to leave a thumbs up on the PR so we know that it is a requested feature and close this one.

kerwanp avatar Sep 17 '24 12:09 kerwanp

@kerwanp unless I'm missing it, I dont see a mechanism for getting a key from the PR you've referenced

onionhammer avatar Sep 17 '24 16:09 onionhammer

@kerwanp unless I'm missing it, I dont see a mechanism for getting a key from the PR you've referenced

The queryOptions method allows you to generate the queryOptions. So you can use it to generate the queryKey: $query.queryOptions('get', '/api/posts').queryKey

kerwanp avatar Sep 20 '24 10:09 kerwanp

Oh ok, that works

onionhammer avatar Sep 20 '24 13:09 onionhammer