Skip to content

Fix querySerializer example #1517

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

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

kaechele
Copy link
Contributor

Changes

The example function for the querySerializer doesn't actually do what it says it does.
The comment next to the return statement suggests the output would be ?tags[]=food&tags[]=california&tags[]=healthy, however the output of the current snippet is actually: tags[]=food,california,healthy.

Furthermore, the snippet also does not place any & characters between query parameters.

This PR fixes that, so that the output is actually ?tags[]=food&tags[]=california&tags[]=healthy (strictly, the output is actually tags[]=food&tags[]=california&tags[]=healthy but I just assumed the ? is to demonstrate how it would look like in an URL)

How to Review

Try the new snippet.

Checklist

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

Signed-off-by: Felix Kaechele <[email protected]>
Copy link

changeset-bot bot commented Jan 26, 2024

⚠️ No Changeset found

Latest commit: a1085df

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

Copy link
Contributor

@drwpow drwpow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Dangers of pseudocode 😄

@drwpow
Copy link
Contributor

drwpow commented Jan 26, 2024

but I just assumed the ? is to demonstrate how it would look like in an URL)

Right the intent was just to make the example more clear to people who may not instantly understand what “query” refers to in OpenAPI terminology—the search params in the URL. Not important; just meant to be sort of a hint

@drwpow drwpow merged commit d2592a0 into openapi-ts:main Jan 26, 2024
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.

2 participants