play-swagger
play-swagger copied to clipboard
Generic case class reflection
play swagger stuck when it encounters a generic case class
any workaround for this?
Chka you can use custom type mapper to work around this. You will have to write your own mapping though. https://github.com/iheartradio/play-swagger#how-to-override-type-mappings
I don't quite get how to use the override type feature for generic case class.
package com.model
case class Response[Err, Data](err: Err, data: Option[Data])
in routes
:
# responses:
# 200:
# schema:
# $ref: '#/definitions/com.model.Response[String, Int]'
How would swagger-custom-mappings.yml
and routes
look like?
I know this is old, but is it possible to get an example for this? In my situation, I have a case class that is a generic 'response' case class with common fields like 'version', 'response_code' and I want to nest a model inside of it without duplicating these common fields on every response object.