비록 당신이 말하지 않더라도, 나는 귀하의 게시물 인 플레이 프레임 워크를 사용하고있는 https://github.com/swagger-api/swagger-play/pull/76#issuecomment-224287765에 기반을 두었습니다. 나는 현재 무용담으로 "무효"한 결과가 나왔다고 믿는다 (ref : https://github.com/swagger-api/swagger-play/issues/89).
package controllers
import controllers.SwaggerBaseApiController
import io.swagger.models.auth.{ApiKeyAuthDefinition, BasicAuthDefinition, In}
import io.swagger.models.properties.RefProperty
import io.swagger.models.{Info, Response}
import play.api.mvc.Action
import scala.collection.JavaConversions._
object Swagger extends SwaggerBaseApiController {
def json = Action { implicit request =>
val swagger = getResourceListing(request.host)
// We need to modify this if it doesn't contain our security definitions yet, but we have to do it atomically
// This should be fast enough that this synchronization is not too bad
swagger.synchronized {
if (!somethingThreadSafeToShowYouveChangedItAlready) fixSwagger(swagger)
}
// We trust that the above code only changes a swagger instance once therefore we don't need to
// synchronize the json marshalling because it should not change beneath it
returnValue(request, toJsonString(swagger))
}
private[this] def fixSwagger(swagger: io.swagger.models.Swagger): Unit = {
// Omitted some of my other changes...
swagger.getPaths.values.foreach { value =>
value.getOperations.foreach { oper =>
// Omitted some of my other chabnges
// Any responses that are void need to be simple void
oper.getResponses.values.foreach { resp =>
resp.getSchema() match {
case schema: RefProperty if schema.get$ref() == "#/definitions/void" => resp.setSchema(null)
case _ =>()
}
}
}
}
}
}
은 당신이 지금까지 시도 않았다 : 한 가지 방법 내가 (스칼라)를했다가
@ApiOperation
에서responseReference = "void"
를 제공하고 내 변화를 재정의 할 자신감 사양을 보여 내 스칼라 컨트롤러로 다음 작업을 수행 할 수 있었다? 문제가 무엇입니까? SO가 어떻게 작동하는지 더 잘 이해하려면 둘러보기 : http://stackoverflow.com/tour를 방문하십시오. – Pilatus잘 모르겠습니다. 코드 나 스크린 샷에 '응답'속성이 표시되지 않습니다. 콘텐츠가 어떻게 보이길 기대합니까? – kenske