Skip to content
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

Allow to select the response content type #1597

Merged

Conversation

armandabric
Copy link
Contributor

@armandabric armandabric commented Mar 27, 2024

Changes

This is a simple change that for now only allow to select the content type of the response. Inspired by the @NikolaStojicic patch.

Fix #1291

This solution is not perfect but allow to fix the issue. Clearly a more robust solution could be to infer the MediaType by reading the Accept header. If multiple content and the Accept header not set, the lib could fallback to an unknown data.

Checklist

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

Copy link

changeset-bot bot commented Mar 27, 2024

🦋 Changeset detected

Latest commit: c4bd0bd

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 Patch

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 Mar 27, 2024

This is an elegant solution to allow a workaround while we come up with a better fix, thank you! While it is a core goal of this library to not have to use generics for anything, this does need a temporary workaround. Agree on not documenting it while a more automatic solution is explored.

@drwpow
Copy link
Contributor

drwpow commented Mar 27, 2024

This looks great! If you could just add a patch changeset (see comment), I’d be happy to merge

@armandabric armandabric force-pushed the allow-to-select-the-reponse-content-type branch from 3113748 to c4bd0bd Compare March 27, 2024 16:30
@armandabric
Copy link
Contributor Author

@drwpow I add the changeset as requested

@drwpow drwpow merged commit 1f7ad9d into openapi-ts:main Mar 27, 2024
6 checks passed
@armandabric armandabric deleted the allow-to-select-the-reponse-content-type branch March 28, 2024 07:55
@armandabric
Copy link
Contributor Author

armandabric commented Mar 28, 2024

@drwpow Thanks for the merge. Can you publish a new version or just update the next tag?

@drwpow
Copy link
Contributor

drwpow commented Apr 23, 2024

@drwpow Thanks for the merge. Can you publish a new version or just update the next tag?

Just published a new next version! Thanks again!

@drwpow
Copy link
Contributor

drwpow commented Apr 23, 2024

Er, sorry; got my PRs mixed up. Meant to say this is published at openapi-fetch latest. Went ahead and removed the next tag for now as it’s not needed at the moment (will use that later, perhaps when a 1.0 RC gets closer)

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