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

Expand support for parameter serialization #1078

Merged
merged 11 commits into from
Feb 7, 2025
Merged

Conversation

blindaa121
Copy link
Collaborator

Description

This PR consists of adding support for explode and correct example generation for array query parameters.

Motivation and Context

See #1024 for context

How Has This Been Tested?

Tested with OpenAPI example spec provided in #1024.

Screenshots (if appropriate)

Screenshot 2025-01-30 at 1 57 21 PM

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@blindaa121 blindaa121 requested a review from sserrata January 30, 2025 21:58
@blindaa121 blindaa121 self-assigned this Jan 30, 2025
Copy link

github-actions bot commented Jan 30, 2025

Size Change: +12.1 kB (+0.58%)

Total Size: 2.08 MB

Filename Size Change
demo/.docusaurus/globalData.json 40.7 kB +1.67 kB (+4.29%)
demo/.docusaurus/registry.js 59.9 kB +2.38 kB (+4.14%)
demo/.docusaurus/routes.js 55.4 kB +2.27 kB (+4.27%)
demo/.docusaurus/routesChunkNames.json 23 kB +958 B (+4.35%)
demo/build/assets/js/main.********.js 739 kB +4.36 kB (+0.59%)
demo/build/assets/js/runtime~main.********.js 15.8 kB +436 B (+2.84%)
ℹ️ View Unchanged
Filename Size
demo/.docusaurus/codeTranslations.json 2 B
demo/.docusaurus/docusaurus.config.mjs 13.9 kB
demo/.docusaurus/i18n.json 267 B
demo/.docusaurus/site-metadata.json 1.35 kB
demo/build/assets/css/styles.********.css 146 kB
demo/build/index.html 91.1 kB
demo/build/petstore/add-pet/index.html 27.5 kB
demo/build/petstore/create-user/index.html 21.6 kB
demo/build/petstore/create-users-with-array-input/index.html 21.6 kB
demo/build/petstore/create-users-with-list-input/index.html 21.6 kB
demo/build/petstore/delete-order/index.html 21.6 kB
demo/build/petstore/delete-pet/index.html 21.7 kB
demo/build/petstore/delete-user/index.html 21.9 kB
demo/build/petstore/find-pets-by-status/index.html 22.3 kB
demo/build/petstore/find-pets-by-tags/index.html 23 kB
demo/build/petstore/get-inventory/index.html 20.9 kB
demo/build/petstore/get-order-by-id/index.html 21.9 kB
demo/build/petstore/get-pet-by-id/index.html 22.5 kB
demo/build/petstore/get-user-by-name/index.html 22 kB
demo/build/petstore/login-user/index.html 22.5 kB
demo/build/petstore/logout-user/index.html 21.3 kB
demo/build/petstore/new-pet/index.html 21.9 kB
demo/build/petstore/pet/index.html 23.6 kB
demo/build/petstore/place-order/index.html 21.1 kB
demo/build/petstore/schemas/apiresponse/index.html 22.9 kB
demo/build/petstore/schemas/cat/index.html 36.8 kB
demo/build/petstore/schemas/category/index.html 24 kB
demo/build/petstore/schemas/dog/index.html 37.2 kB
demo/build/petstore/schemas/honeybee/index.html 37.3 kB
demo/build/petstore/schemas/id/index.html 21 kB
demo/build/petstore/schemas/order/index.html 25.1 kB
demo/build/petstore/schemas/pet/index.html 36.7 kB
demo/build/petstore/schemas/tag/index.html 22.4 kB
demo/build/petstore/schemas/user/index.html 44.9 kB
demo/build/petstore/store/index.html 21.6 kB
demo/build/petstore/subscribe-to-the-store-events/index.html 27.9 kB
demo/build/petstore/swagger-petstore-yaml/index.html 28 kB
demo/build/petstore/update-pet-with-form/index.html 21.8 kB
demo/build/petstore/update-pet/index.html 22.3 kB
demo/build/petstore/update-user/index.html 21.9 kB
demo/build/petstore/upload-file/index.html 21.7 kB
demo/build/petstore/user/index.html 22.5 kB

compressed-size-action

Copy link

github-actions bot commented Jan 30, 2025

Visit the preview URL for this PR (updated for commit 93f8794):

https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app

(expires Sat, 08 Mar 2025 18:49:47 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@sserrata
Copy link
Member

Thanks Bryan, is the plan to, eventually, add support for the other style/parameters as defined here?

@blindaa121
Copy link
Collaborator Author

blindaa121 commented Feb 1, 2025

Hi @sserrata, we should definitely aim to cover all parameter types and serializing combinations. We can look further into supporting all combinations in a separate PR?

@sserrata
Copy link
Member

sserrata commented Feb 6, 2025

Path params test results (cURL):

q = "openapi"

curl -L 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?q=openapi'

tags = ["api", "docs"]
style: form
explode: true

curl -L 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?tags=api&tags=docs'

filters = {"minPrice": 10, "maxPrice": 100}
style: deepObject
explode: true

curl -L -g 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?filters[minPrice]=10&filters[maxPrice]=100'

sort = ["name", "price"]
style: spaceDelimited
explode: false

curl -L 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?sort=name%20price'

fields = ["id", "name", "description"]
style: pipeDelimited
explode: false

curl -L 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?fields=id%7Cname%7Cdescription'

@sserrata sserrata self-assigned this Feb 6, 2025
@sserrata sserrata changed the title Add support for explode query params and example generation Expand support for parameter serialization Feb 6, 2025
@blindaa121
Copy link
Collaborator Author

Path params test results (cURL):

q = "openapi"

curl -L 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?q=openapi'

tags = ["api", "docs"] style: form explode: true

curl -L 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?tags=api&tags=docs'

filters = {"minPrice": 10, "maxPrice": 100} style: deepObject explode: true

curl -L -g 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?filters[minPrice]=10&filters[maxPrice]=100'

sort = ["name", "price"] style: spaceDelimited explode: false

curl -L 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?sort=name%20price'

fields = ["id", "name", "description"] style: pipeDelimited explode: false

curl -L 'https://docusaurus-openapi-36b86--pr1078-tm9k8x09.web.app/search?fields=id%7Cname%7Cdescription'

Thanks for covering the rest of the params! Everything looks good on my end 👍

@sserrata sserrata merged commit 110ce53 into main Feb 7, 2025
10 checks passed
@sserrata sserrata deleted the add-explode-support branch February 7, 2025 15:21
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