Connexion 3.0.5 path parameter serialization
Description
Based on OpenAPI 3 standard path parameters can be serialized in different ways. Personally I have never seen use cases where an object was passed as a parameter in the path, but according to the standard there is this possibility. I wrote a small OpenAPI 3 test spec and tried passing an object, but I get 400 Bad Request as response.
This is my specification:
openapi: 3.0.0
info:
title: Simple API
description: This is a simple API spec
version: 1.0.0
paths:
/echo/{msg}:
get:
operationId: get_echo
parameters:
- in: path
name: msg
schema:
type: object
required: true
style: simple
explode: false
description: echo msg parameters
responses:
"200":
description: ok
"500":
description: Server error
x-openapi-router-controller: swagger_server.controllers.default_controller
Expected behaviour
Calling http://<serverip>:<serverport>/echo/msg,hello,num,1 connexion should be able to parse path parameter as an object like {msg: "hello", num: "1"}.
Actual behaviour
Got a 400 Bad Request from the server. Response details:
{
"type": "about:blank",
"title": "Bad Request",
"detail": "'msg,hello,num,1' is not of type 'object'\n\nFailed validating 'type' in schema:\n {'type': 'object'}\n\nOn instance:\n 'msg,hello,num,1'",
"status": 400
}
Additional info:
I've tried to change the type of parameter from object to list and all works as expected.
Thanks @DendoD96,
I haven't tried to reproduce, but I indeed wouldn't expect this to currently be supported by Connexion.
Personally I have never seen use cases where an object was passed as a parameter in the path
Same here, so I don't consider this high priority, but would accept a PR adding support for this.