We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json.valueFormat
If class is defined like this:
case class TaskId(value: UUID) extends AnyVal object TaskId { implicit val jsonFormat = Json.valueFormat[TaskId] }
And play is used for serialization:
Json.toJson(TaskId(UUID.randomUUID()))
It will serialize to:
"482a4c0a-dc04-4c67-8821-b93096978a3d"
It would be nice if play-swagger handled this automatically. Currently i'm writing mappings like this:
- type:models\.ids\.taskid specAsParameter: - type: string format: uuid
The text was updated successfully, but these errors were encountered:
Hello. I'm writing (only one) mappings for UUID like this:
- type: uuid specAsParameter: - type: string format: uuid
in file conf/swagger-custom-mappings.yml
Sorry, something went wrong.
@vnt-83 This issue is about value classes.
For example, if you have following definition:
case class Foo(bar: String) object Foo { implicit val jsonFormat = Json.valueFormat[Foo] }
You can do this:
scala> Json.parse("\"foo\"").as[Foo] val res1: Foo = Foo(foo)
However play-swagger plugin will generate api definition like this:
components: schemas: Foo: properties: bar: type: string
@lalnuo We are currently reviewing it. It may take some time, but we plan to address it.
No branches or pull requests
If class is defined like this:
And play is used for serialization:
It will serialize to:
It would be nice if play-swagger handled this automatically. Currently i'm writing mappings like this:
The text was updated successfully, but these errors were encountered: