Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Use dataTypeClass to help support type safety in scala #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ protected io.swagger.models.parameters.Parameter readImplicitParam(ApiImplicitPa
type = typeFromString(param.dataType(), cls);

}
if(param.dataTypeClass() != Void.class) {
type = param.dataTypeClass();
}
Parameter result = ParameterProcessor.applyAnnotations(getSwagger(), p, type == null ? String.class : type, Collections.singletonList(param));

if (result instanceof AbstractSerializableParameter && type != null) {
Expand Down
2 changes: 1 addition & 1 deletion play-2.6/swagger-play2/test/testdata/CatController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CatController extends Controller {
consumes = "",
protocols = "")
@ApiImplicitParams(Array(
new ApiImplicitParam(name = "cat", value = "Cat object to add", required = true, dataType = "testdata.Cat", paramType = "body")))
new ApiImplicitParam(name = "cat", value = "Cat object to add", required = true, dataTypeClass = classOf[testdata.Cat], paramType = "body")))
def add1 = Action {
request => Ok("test case")
}
Expand Down