finatra-swagger
finatra-swagger copied to clipboard
generating list of object instead of list of strings
When modelling an API with a List
(found similar issues with a Map, eg:
.responseWith[List[String]](200, "Some list")
Generated swagger file misses the type of the elements:
responses:
'200':
description: Consumer list.
schema:
type: array
items:
type: object
It works fine if we use a case class instead:
case class ConsumersResponse(consumers: List[String])
...
.responseWith[ConsumersResponse](200, "Consumer list.")
Swagger generated file is correct:
'200':
description: Consumer list.
schema:
$ref: '#/definitions/ConsumersResponse'
...
ConsumersResponse:
type: object
required:
- consumers
properties:
consumers:
type: array
items:
type: string
Is there anything I can do to make it work without the workaround of the case class?
Thanks!
any comment here @jakehschwartz ? thanks
@sgomezvillamor Hey, I can take a look this week probably. I typically use case classes, which is why Ive never run into this before.
I also wonder if it could be a bug with the actual (swagger scala module)[https://github.com/swagger-api/swagger-scala-module]. You could try generating your swagger json using that to see if there is an issue with their code