Open phdoerfler opened 3 years ago
I found one way to actually get a schema out based on the circe example:
import com.github.andyglow.jsonschema.AsCirce._
import json.schema.Version._
import io.circe._
case class Foo(name: String)
val fooSchema: Json = json.Json.schema[Foo].asCirce(Draft04())
fooSchema.spaces2SortKeys
but even this required modifications because the original example does not compile:
main.scala:34:28: value schema is not a member of object io.circe.Json
val fooSchema: Json = Json.schema[Foo].asCirce(Draft04())
^
one error found
(Compile / compileIncremental) Compilation failed
Total time: 1 s, completed 29.01.2021, 12:43:05
If I may suggest: Consider using mdoc to create typechecked markdown. It will ensure that the examples in the README do actually compile and run when used in, e.g., your CI build.
You might also want to consider improving the expressiveness of your tests as they, too, can serve as source of up-to-date documentation. E.g., the specs2 User Guide is completely generated from the tests themselves.
This being said, I'm glad this library exists, thanks for pouring in the work! 👍
Hi, Philipp! Thanks for checking this. Yeah, read me is somewhat outdated, true.
As for mdoc - it's really a great idea. I have already started working on new documentation using mdoc. Hope it will be ready soon.
Sorry for the inconvenience with readme. That might be really annoying.
Awesome, I'm looking forward to the new and improved docs :)
Describe the bug None of the examples in the README that I tried to actually work as documented. Most don't even compile and the ones that do produce a different output.
To Reproduce build.sbt:
Expected behavior The examples in the README should be correct
Actual results Examples don't compile or produce different output.
For instance, the first, inlined example actually produces:
whereas the README says it produces:
Ditto for the regular example.
Moving on to the Definitions/References example the code doesn't even compile:
I also looked at the tests for help but to no avail.
This makes it very hard for someone to get started with this library which is unfortunate because there does not seem to be any alternative other than the ancient autoschema from Coursera.