How Scalatra-Swagger 2.2.0RC1 migrate to 2.2.1(tutorial or document)

11 views
Skip to first unread message

廖师虎

unread,
May 12, 2013, 11:24:55 PM5/12/13
to scalat...@googlegroups.com
Hello!
I'm a newbie to scalatra, and learning the ddd-cqrs project https://github.com/kciesielski/ddd-cqrs-leaven-scala, the project use scalatra 2.2.0.RC1, I find some Swagger api or  method was deprecated, Has some tutorial or document for this?
The follow line I don't know how to migrate scalatra2.2.1:
  get("/",
    summary("Gets products for criteria"),
    nickname("products"),
    responseClass("List[ProductListItemDto]"),
    notes("Additional notes")) {

    // Is there any way to extract this automatically to a case class?

    val containsText = params get "containsText"
    val maxPrice = params get "maxPrice" map (_.toDouble)
    val orderBy = (params get "orderBy" map (mapSearchOrder(_))).getOrElse(ProductSearchOrder.Name)
    val ascending = params get "ascending" map (_.toBoolean) getOrElse true
    val pageNumber = params get "pageNumber" map (_.toInt) getOrElse 1
    val itemsPerPage = params get "itemsPerPage" map (_.toInt) getOrElse (10)

    val criteria = ProductSearchCriteria(containsText, maxPrice, orderBy, ascending, pageNumber, itemsPerPage)
    env.productFinder.findProducts(criteria)
  }

  private def mapSearchOrder(value: String): ProductSearchOrder.Value = {
    ProductSearchOrder.values.find(value2 => value2.toString == value)
      .getOrElse(ProductSearchOrder.Name)
  }
~~~~~~~~~~~
How to do?
Thanks 

Reply all
Reply to author
Forward
0 new messages