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

query parameter name with "[]" not work on prism proxy #2443

Open
absszero opened this issue Dec 22, 2023 · 0 comments
Open

query parameter name with "[]" not work on prism proxy #2443

absszero opened this issue Dec 22, 2023 · 0 comments

Comments

@absszero
Copy link

It's allowed to send an array data via query name ends with [] on PHP.
Ex. http://127.0.0.1/foo.php?bar[]=1&bar[]=2

But prism proxy does not support query parameter name with "[]".

Steps to Reproduce

# openapi.yaml
openapi: 3.0.3
info:
  title: OpenAPI 3.0
  version: 0.1

paths:
  /pet:
    get:
      summary: Find pet by ID
      parameters:
        - name: petId[]
          in: query
          description: ID of pet to return
          required: true
          schema:
            type: array
            items:
              type: integer
      responses:
        '200':
          description: successful operation
prism proxy --errors openapi.yaml http://example
[11:06:16 AM] › [CLI] …  awaiting  Starting Prism…
[11:06:16 AM] › [CLI] ℹ  info      GET        http://127.0.0.1:4010/pet?petId%5B%5D=318
[11:06:16 AM] › [CLI] ▶  start     Prism is listening on http://127.0.0.1:4010
[11:06:20 AM] › [HTTP SERVER] get /pet ℹ  info      Request received
[11:06:20 AM] › [HTTP SERVER] get /pet ✖  error     Request terminated with error: https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY: Invalid request

I got a error message when open http://127.0.0.1:4010/pet?petId%5B%5D=318

{
   "type":"https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY",
   "title":"Invalid request",
   "status":422,
   "detail":"Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.",
   "validation":[
      {
         "location":[
            "query"
         ],
         "severity":"Error",
         "code":"required",
         "message":"Request query must have required property 'petid%5b%5d'"
      }
   ]
}

Environment

  • Version used: prism 5.5.2
  • Environment name and version: Firefox 121.0(64 bit)
  • Operating System and version (desktop or mobile): macOS 14.1 (23B74)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants