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

Fix/2005 handle exploded form query params #2288

Merged
merged 8 commits into from
May 12, 2023

Conversation

chohmann
Copy link
Contributor

Addresses #2005

Summary

Handle exploded form query params for types:

  • string
  • array
  • object

Had to update the colorizer code to not attempt to add the prefix and postfix for objects, since that was what was breaking this in the first place.

Also updated the default for form query params to be exploded true to match the spec in the createQueryUriTemplate function.

Matches what the spec says: https://spec.openapis.org/oas/v3.0.3#style-examples

Checklist

  • The basics
    • I tested these changes manually in my local or dev environment
  • Tests
    • Added or updated
    • N/A
  • Event Tracking
    • I added event tracking and followed the event tracking guidelines
    • N/A
  • Error Reporting
    • I reported errors and followed the error reporting guidelines
    • N/A

Screenshots

Non-Exploded form object param:

        - name: pagination
          in: query
          required: true
          style: form
          explode: false
          schema:
            type: object
            properties:
              offset:
                type: integer
                example: 0
              limit:
                type: integer
                example: 25

image

Exploded form object param:

parameters:
        - name: pagination
          in: query
          required: true
          style: form
          explode: true
          schema:
            type: object
            properties:
              offset:
                type: integer
                example: 0
              limit:
                type: integer
                example: 25

image

Non-Exploded form array param:

parameters:
        - name: pagination
          in: query
          required: true
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string

image

Exploded form array param:

parameters:
        - name: pagination
          in: query
          required: true
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string

image

Non-Exploded form string param:

parameters:
        - name: pagination
          in: query
          required: true
          style: form
          explode: false
          schema:
            type: string

image

Exploded form string param:

parameters:
        - name: pagination
          in: query
          required: true
          style: form
          explode: true
          schema:
            type: string

image

@chohmann chohmann requested a review from a team as a code owner May 12, 2023 15:18
@chohmann chohmann requested review from daniel-white and removed request for a team May 12, 2023 15:18
Copy link
Member

@daniel-white daniel-white left a comment

Choose a reason for hiding this comment

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

just a question about shell excaping

====server====
mock -p 4010 ${document}
====command====
curl -i -X GET http://127.0.0.1:4010/recipes\?limit\=string\&offset\=string
Copy link
Member

Choose a reason for hiding this comment

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

why escaping here and not other places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not entirely sure... without the escaping, I wasn't getting both parameter validations, I was only getting offset. And this is how my terminal handled it when I pasted the url in there, and so I copied the escaping over and it got both validations to come across in the test 🤷‍♀️

@chohmann
Copy link
Contributor Author

I'm going to spend like 30 minutes trying to get the color around the object param values successfully. If it takes longer than that, I'm going to let it be.

@chohmann
Copy link
Contributor Author

well that was easy c746bd2 😂

@chohmann
Copy link
Contributor Author

so now the cyan color is returned for the generated param values:
image

image

@chohmann chohmann merged commit 69f200d into master May 12, 2023
4 checks passed
@chohmann chohmann deleted the fix/2005-handle-exploded-form-query-params branch May 12, 2023 15:37
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.

None yet

2 participants