0

I am trying to write config for OpenAPI with intention to resolve request like this: http://127.0.0.1:5000/api/v1/statistics?stratifications=color,blue,bodytype,normal or http://127.0.0.1:5000/api/v1/statistics?stratifications=color,blue,bodytype,normal,height,170 or just http://127.0.0.1:5000/api/v1/statistics?stratifications=color,grey

into object that will get passed to my function. This is what I am writing in the config:

    get:
      tags: [statistics]
      operationId: api.v1.statistics.endpoints.get_statistics
      {% if not disable_security %}
      security:
        - jwt: [statistics]
        {% endif %}

      parameters:
        - in: query
          name: stratifications
          description: Stratifications of statistic
          schema:
            type: object
          style: form
          explode: false

but this results in

is not of type 'object'

error in jsonschema since jsonschema expect dictionary and getting string color,blue,bodytype,normal,height,170 instead. Are there way to add encoder there? I though style define encoder but it seems to be not the case.

Akim Akimov
  • 41
  • 1
  • 7
  • Your parameter definition is correct. This seems to be an issue with the server-side framework that deserializes the parameter from the query string. – Helen Jun 10 '20 at 15:55
  • I am using connexion==2.5.1 – Akim Akimov Jun 10 '20 at 16:55
  • Open an issue with connexion then – Helen Jun 10 '20 at 17:14
  • Have you tried define your object properties (in your case stratifications) and use explode: true ? Maybe this question can help you https://stackoverflow.com/questions/38187187/use-object-type-query-param-in-swagger-documentation/38188832#51277233 – Kevin Martins Jun 12 '20 at 17:50

0 Answers0