guardrail-dev / guardrail-dev/guardrail

Unsupported JSON structures in formData fields

Open
#154 1 comment 0 reactions 0 assignees View on GitHub
enhancement help wanted scala scala-akka-http scala-http4s
Dominant language
Scala
Stars
541
Forks
138
PR merge metrics
No merged PRs in 30d

Description

While working on #148/#150, I discovered that `type: object` is not supported for `formData` parameters. I've not needed this feature, but opening it here in case someone else needs it.

Minimal example:
```yaml
swagger: '2.0'
paths:
/test:
put:
operationId: updateFoo
consumes:
- multipart/form-data
parameters:
- in: formData
name: structure
type: object
schema:
$ref: '#/definitions/Foo'
responses:
202:
schema:
$ref: '#/definitions/Foo'
definitions:
Foo:
type: object
required:
- name
properties:
name:
type: string
```

Errors:
```
[error] .../guardrail/modules/sample/src/main/scala/issues/issue148/client/akkaHttp/Client.scala:60:224: could not find implicit value for parameter ev: issues.issue148.client.akkaHttp.Implicits.Show[io.circe.Json]
[error] () => List(Some(Multipart.FormData.BodyPart("foo", Formatter.show(foo))), bar.map(v => Multipart.FormData.BodyPart("bar", Formatter.show(v))), structure.map(v => Multipart.FormData.BodyPart("structure", Formatter.show(v)))).flatten.iterator
[error] ^
[error] .../guardrail/modules/sample/src/main/scala/issues/issue148/client/http4s/Client.scala:59:210: could not find implicit value for parameter ev: issues.issue148.client.http4s.Implicits.Show[io.circe.Json]
[error] Error occurred in an application involving default arguments.
[error] val _multipart = Multipart(List(Some(Part.formData[F]("foo", Formatter.show(foo))), bar.map(v => Part.formData[F]("bar", Formatter.show(v))), structure.map(v => Part.formData[F]("structure", Formatter.show(v)))).flatten.toVector)
[error] ^
[error] two errors found
[error] (sample / Compile / compileIncremental) Compilation failed
[error] Total time: 18 s, completed Jan 6, 2019 7:10:46 PM
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.