Skip to content

feat(openapi-fetch): add global querySerializer option (#1182) #1183

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

Conversation

psychedelicious
Copy link
Contributor

Changes

  • add a global querySerializer option to createClient()
  • add tests for the global serializer, and to ensure serializers provided to individual fetch methods override the global serializer
  • update readme

Resolves #1182

How to Review

I don't know how to correctly type the added global querySerializer option - set it to QuerySerializer<unknown>.

Checklist

  • Unit tests updated
  • README updated
  • examples/ directory updated (only applicable for openapi-typescript)

@changeset-bot
Copy link

changeset-bot bot commented Jun 24, 2023

🦋 Changeset detected

Latest commit: ea695cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openapi-fetch Minor

Not sure what this means? Click here to learn what changesets are.

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

@drwpow
Copy link
Contributor

drwpow commented Jun 24, 2023

I don't know how to correctly type the added global querySerializer option - set it to QuerySerializer<unknown>.

That works just fine! There’s no way to type the global one, really. For most schemas, even trying to glob all the possible params together at best would be utter noise; at worst would be incorrect (due to conflicting unions too complicated for TS to resolve). unknown is probably the best solution.

@drwpow
Copy link
Contributor

drwpow commented Jun 24, 2023

This looks great! But would you mind adding a changeset file to update the changelog? Info is in that comment. Thanks!

@psychedelicious psychedelicious force-pushed the feat/openapi-fetch/global-query-serializer branch from e44b638 to ea695cd Compare June 25, 2023 03:02
@psychedelicious
Copy link
Contributor Author

Oh, whoops - sure thing, added a changeset. Thanks for your work on this library!

@drwpow drwpow merged commit 431a98f into openapi-ts:main Jun 25, 2023
@github-actions github-actions bot mentioned this pull request Jun 25, 2023
@drwpow
Copy link
Contributor

drwpow commented Jun 26, 2023

Released in 0.5.0! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

createClient() accepts a querySerializer option to set a default serializer
2 participants