guardrail-dev / guardrail-dev/guardrail
akka routes not matching input with default property
- Dominant language
- Scala
- Stars
- 541
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Description
I have an API where the Create operation consumes a resource without an ID field (the server generates it) and where every operation returns that same resource with an ID field.
```
definitions:
TheResource:
discriminator: type
type: "object"
required:
- "type"
properties:
id:
type: "string"
type:
type: "string"
...
```
Guardrail generates an `id` field of type `Option[String]`. If I change the `id` property in swagger to have a `default: ""` and/or add `id` to the list of required properties, Guardrail changes the case class accordingly (either as `id: Option[String] = Option("")` or `id: String = ""`), but the generated routes don't match requests without an ID.
I think this should be possible in swagger 2 and 3. Is there an extra hint I should be providing to the akka server routes generator?
Contributor guide
Assessment
This issue has not been assessed yet.