guardrail-dev / guardrail-dev/guardrail

Support for base64 encoded files

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

Description

OpenAPI v3 supports following formats of binary data:
```yaml
type: string
format: binary # binary file contents
```
and
```yaml
type: string
format: byte # base64-encoded file contents
```

Swagger 2 supports:
```yaml
type: file
```

Swagger 2 `type:file` is internally mapped to `format:binary` mentioned above.

We do have a support for `format: binary` but we lack support for `format: byte`. We should add it.

The easy approach is to generate type of `java.io.File` for both formats but some information is lost if we do it that way and we force users to their own base64 encoding/decoding. If we changed to type generated for files from `java.io.File` to perhaps `{Input/Output}Stream` or even `fs2.Stream`, it would perhaps allow us to do the conversion for them in the right places.

Thoughts?

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.