connexion icon indicating copy to clipboard operation
connexion copied to clipboard

query params of type object with `style: form` are not being deserialized

Open Halkcyon opened this issue 5 years ago • 3 comments

Description

When defining objects to take through a query string, they are not being deserialized in my app code. The function parameter is being passed an empty dict, but request.form definitely sees the proper values.

Expected behaviour

The params are deserialized into a dict and passed into my view.

Actual behaviour

The params show up on request.form, but are not being deserialized; I receive an empty dict for the key defined in my spec.

Steps to reproduce

openapi: 3.0.3
info:
  title: REST API
  version: 1.0.0
servers:
  - url: /api/v1
paths:
  /:
    get:
      parameters:
        - name: page
          in: query
          schema:
            type: object
            required:
              - pageNo
              - pageSize
            properties:
              pageNo:
                type: number
              pageSize:
                type: number
        - name: location
          in: query
          schema:
            type: object
            properties:
              street:
                type: string
              city:
                type: string

Additional info:

Output of the commands:

  • python --version

      Python 3.7.0
    
  • pip show connexion | grep "^Version\:"

      connexion 2.7.0
    

Halkcyon avatar Sep 08 '20 15:09 Halkcyon

Thanks for the report @Halkcyon.

Connexion currently doesn't deserialize query objects with style: form correctly, which is the default. If you control the client, you can work around this by using style: deepObject instead. More info on the style values in the openapi docs.

RobbeSneyders avatar Aug 16 '21 20:08 RobbeSneyders

Related to #963

RobbeSneyders avatar Aug 16 '21 20:08 RobbeSneyders