-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix and improve Spray JSON docs #330
Conversation
Can one of the repo owners verify this patch? |
|
||
// format: OFF | ||
val route = | ||
get { | ||
pathSingleSlash { | ||
complete { | ||
// should complete with spray.json.JsValue = {"name":"akka","id":42} | ||
CompactPrintedItem("akka", 42) // will render as JSON | ||
// should complete with spray.json.JsValue = { "name": "akka", "id": 42 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, I didn't actually test this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR pretty is:
{
"name": "akka",
"id": 42
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add
Get("/") ~> route ~> check {
responseAs[String] shouldEqual """..."""
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, added a test to the example.
OK TO TEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good changes overall, thanks. LGTM
```sbt | ||
"com.typesafe.akka" %% "akka-http-spray-json-experimental" % "$project.version$"` | ||
``` | ||
@@@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
```scala | ||
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._ | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good
|
||
// format: OFF | ||
val route = | ||
get { | ||
pathSingleSlash { | ||
complete { | ||
// should complete with spray.json.JsValue = {"name":"akka","id":42} | ||
CompactPrintedItem("akka", 42) // will render as JSON | ||
// should complete with spray.json.JsValue = { "name": "akka", "id": 42 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR pretty is:
{
"name": "akka",
"id": 42
}
@akka/akka-http-team, @jrudolph please feel free to LGTM and merge once PR hits 2 LGTMs (anyone within http-team is welcome to do so) :-) |
Test PASSed. |
Test FAILed. |
The failure looks unrelated:
|
Mmm, we just had the exact same test failure over at #323. Coincidence? I think NOT! :) |
Is there a way to ask @akka-ci to rebuild? |
PLS BUILD |
Test FAILed. |
Thanks. Now it is failing with the error mentioned in #298:
and
|
That's too tight timeouts IMO, |
By default the CompactPrinter is used, so change the example to show how to use the PrettyPrinter.
…kka#318) This allows to use `@@vars` to replace the project version in the SBT snippet.
Paradox currently honours new lines which breaks formatting.
ed8b046
to
360229f
Compare
Rebased to see if this will trigger a rebuild now that jenkins.akka.io seems more quiet. |
Test PASSed. |
🎱 |
LGTM, thanks! |
* =doc Use reference-style links for linking to the spray-json site * =doc Create section on changing the JSON format and reflect reality By default the CompactPrinter is used, so change the example to show how to use the PrettyPrinter. * =doc Rewrite the spray-json section to spell out the list of steps (akka#318) This allows to use `@@vars` to replace the project version in the SBT snippet. * =doc Format spray JSON docs on single lines Paradox currently honours new lines which breaks formatting. * =doc Bring back "automatic support for ..." * Verify the pretty printed JSON output
NOTE: the last point is something we might want to raise upstream in Paradox, to see if we can make it optional whether line breaks are honours in the Markdown rendering. Alternatively, we can reformat all docs to not use new lines inside paragraphs.