-
Notifications
You must be signed in to change notification settings - Fork 146
Description
Hi,
first of all I really like the updated version of the Swift OpenAPI tools (0.2.0). However I strongly believe that I discovered a runtime issue. Let me explain this through an example:
Imagine a basic GET endpoint with two optional query parameters, foo & bar, the type of those really doesn't matter to reproduce this issue. When you provide none of the query parameters (or all of them), the server responds just fine, but otherwise it'll throw the following error: "Cannot parse a value from a node with multiple values"
e.g.:
- curl -i http://localhost:8080/ - ok
- curl -i http://localhost:8080/?foo=value&bar=value - ok
- curl -i http://localhost:8080/?foo=value - error
- curl -i http://localhost:8080/?bar=value - error
I suppose the problematic code is inside the Converter+Server.swift file (line 115). The getOptionalQueryItemAsURI
function should return an optional value if the key does not exists in the query string, but right now the convert block will always throw an error. Maybe the decode call should be try? decoder.decode(...)
, I'm not 100% sure if this is the right way to solve this, but I'm happy to submit a PR with the fix if you need help solving the issue.
Many thanks in advance.