guardrail-dev / guardrail-dev/guardrail
Guardrail generates invalid Scala method when operation has two parameters from different sources but with the same name
- Dominant language
- Scala
- Stars
- 541
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I have an existing server that for a certain path, receives a query parameter and a multi-part form parameter both with the same name (let's call it "foo"), plus other parameters. The relevant part in the swagger spec for that would be:
```yaml
/some/path:
post:
operationId: "theOperation"
produces:
- "application/json"
parameters:
- name: "foo"
in: "formData"
required: false
type: "string"
- name: "foo"
in: "query"
required: false
type: "string"
enum:
- "FIRST"
- "SECOND"
- "THIRD"
```
I believe that's valid swagger 2.0.
Guardrail generates the following definition for it:
```scala
def theOperation(respond: Resource.theOperationResponse.type)(foo: Option[String] = None, foo: Option[String] = None, ...): scala.concurrent.Future[Resource.theOperationResponse]
```
This fails to compile because Scala methods can't have two parameters with the same name.
Contributor guide
Assessment
This issue has not been assessed yet.