-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
play-swagger version: 0.10.2-PLAY2.8
Given a routes file like:
###
# summary: send a payload
# parameters:
# - name: body
# schema:
# $ref: '#/components/schemas/model.CustomResource[model.MySpec]'
###
POST /myroute The generated swagger.json does not properly replace the parameterized CustomResource[model.MySpec] in the body parameter. The generated schema definition does have the parameterized definition rendered properly. The output looks like:
"definitions" : {
"model.CustomResource-domain.MySpec" : {
...
}
},
...
"/myroute": {
"post": {
"parameters" : [ {
"in" : "body",
"name" : "body",
"schema" : {
"$ref" : "#/components/schemas/model.CustomResource[model.MySpec]"
}
} ],
}
}I've looked into the code for ParametricTypeNamesTransformer the tf function is defined as:
private def tf(obj: JsObject): JsObject = JsObject {
obj.fields.map {
case (key, value: JsObject) ⇒ (normalize(key), tf(value))
case (key, JsString(value)) ⇒ (normalize(key), JsString(normalize(value)))
case (key, other) ⇒ (normalize(key), other)
case e ⇒ e
}
}
Because the parameters section is defined as an array, they will never get normalizeed by the tf function as defined above. This seems to be the desired behavior as specified in ParametricTypeNamesTransformerSpec.
The result is swagger that cannot be rendered by the swagger ui and, I suspect, won't be useable by code generators as well.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels