-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dave - reintroduced DescriptionRenderer to default implementations. R…
…epackage
- Loading branch information
1 parent
91574bd
commit 9f5e8fb
Showing
8 changed files
with
56 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...ospect/util/ArgoJsonResponseBuilder.scala → ...t/renderers/ArgoJsonResponseBuilder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
...ntrospect/util/TypedResponseBuilder.scala → ...pect/renderers/TypedResponseBuilder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
package io.github.daviddenton.fintrospect.util | ||
package io.github.daviddenton.fintrospect.renderers | ||
|
||
import com.twitter.finagle.http.path.Path | ||
import io.github.daviddenton.fintrospect.Route | ||
import io.github.daviddenton.fintrospect.parameters.RequestParameter | ||
import io.github.daviddenton.fintrospect.util.ResponseBuilder | ||
import io.github.daviddenton.fintrospect.{DescriptionRenderer, Route} | ||
import org.jboss.netty.handler.codec.http.HttpResponse | ||
import org.jboss.netty.handler.codec.http.HttpResponseStatus._ | ||
|
||
import scala.language.implicitConversions | ||
|
||
class TypedResponseBuilder[T](newBuilder: () => ResponseBuilder[T], | ||
descBuilder: (Path, Seq[Route]) => T, | ||
descriptionRenderer: DescriptionRenderer[T] , | ||
bpToError: List[RequestParameter[_]] => T) { | ||
|
||
def apply(): ResponseBuilder[T] = newBuilder() | ||
|
||
def BadRequest(badParameters: List[RequestParameter[_]]): HttpResponse = apply().withCode(BAD_REQUEST).withContent(bpToError(badParameters)).build | ||
|
||
def Description(basePath: Path, routes: Seq[Route]) = apply().withCode(OK).withContent(descBuilder(basePath, routes)).build | ||
def Description(basePath: Path, routes: Seq[Route]) = apply().withCode(OK).withContent(descriptionRenderer(basePath, routes)).build | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters