-
Notifications
You must be signed in to change notification settings - Fork 15
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
Docs #1
Conversation
build.sbt
Outdated
@@ -115,11 +115,11 @@ lazy val releaseSettings = { | |||
releasePublishArtifactsAction := PgpKeys.publishSigned.value, | |||
scmInfo := Some( |
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.
I think you might not need this setting, it's being set up by sbt-freestyle (sbt-org-policies).
build.sbt
Outdated
) | ||
), | ||
homepage := Some(url("https://github.com/pepegar/skeuomorph")), | ||
homepage := Some(url("https://github.com/frees-io/skeuomorph")), |
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.
Same here
build.sbt
Outdated
@@ -85,7 +86,6 @@ lazy val releaseSettings = { | |||
setReleaseVersion, | |||
commitReleaseVersion, | |||
tagRelease, | |||
// For non cross-build projects, use releaseStepCommand("publishSigned") |
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.
releaseSettings
are also being set up by sbt-freestyle (sbt-org-policies).
@@ -32,44 +51,26 @@ onLoad in Global := { s => | |||
|
|||
// General Settings | |||
lazy val commonSettings = Seq( | |||
organization := "com.pepegar", | |||
organization := "io.frees", |
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.
I'd add startYear := Some(2018)
src/test/scala/instances.scala
Outdated
namespace <- nonEmptyString | ||
fieldNames <- Gen.nonEmptyContainerOf[Set, String](nonEmptyString).map(_.toList) | ||
fields <- fieldNames.traverse(field) | ||
} yield AvroSchema.createRecord(name, doc, namespace, false, fields.asJava) |
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 could use applicative
and mapN
here to generate all the class fields values in parallel.
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'd need this https://github.com/ChristopherDavenport/cats-scalacheck or create an instance of Applicative
of Gen
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.
Yap, I already have it in the project
README.md
Outdated
.transCata[Mu[freestyle.Schema]](freestyle.utils.transformAvro) // skeuomorph.avro.Schema => skeuomorph.freestyle.Schema | ||
.cata(freestyle.utils.render) // skeuomorph.freestyle.Schema => String | ||
val definition = """ | ||
{"namespace": "example.avro", |
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.
Can we improve the formatting? I'd use some online json formatter. For the documentation is better.
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.
Sure!
README.md
Outdated
|
||
schema.ana[Mu[avro.Schema]](avro.util.fromAvro). // org.apache.avro.Schema => skeuomorph.avro.Schema | ||
transCata[Mu[freestyle.Schema]](freestyle.util.transformAvro). // skeuomorph.avro.Schema => skeuomorph.freestyle.Schema | ||
cata(freestyle.util.render) // skeuomorph.freestyle.Schema => String |
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.
Same here, what about something like:
schema
.ana[Mu[avro.Schema]](avro.util.fromAvro) // org.apache.avro.Schema => skeuomorph.avro.Schema
.transCata[Mu[freestyle.Schema]](freestyle.util.transformAvro) // skeuomorph.avro.Schema => skeuomorph.freestyle.Schema
.cata(freestyle.util.render) // skeuomorph.freestyle.Schema => String
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.
I wanted to format it this way too, but Tut complains about it, probably because it reads the block line by line. That's why I added dots at the end, to tell tut to read next line as part of the expression too.
src/test/scala/instances.scala
Outdated
namespace <- nonEmptyString | ||
fieldNames <- Gen.nonEmptyContainerOf[Set, String](nonEmptyString).map(_.toList) | ||
fields <- fieldNames.traverse(field) | ||
} yield AvroSchema.createRecord(name, doc, namespace, false, fields.asJava) |
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'd need this https://github.com/ChristopherDavenport/cats-scalacheck or create an instance of Applicative
of Gen
build.sbt
Outdated
</developers> | ||
} | ||
%%("cats-core"), | ||
%%("specs2-core"), |
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.
Does this line need % 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.
Right, good cathc!
src/test/scala/instances.scala
Outdated
def createGen(tpe: AvroType): Gen[AvroSchema] = | ||
Gen.const(AvroSchema.create(tpe)) | ||
|
||
val primitives: Gen[AvroSchema] = Gen.oneOf( |
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 use Gen.oneOf
on a Seq[A]
, without using Gen.const
. Also, you can use .map(AvroSchema.create)
.
src/test/scala/instances.scala
Outdated
createGen(AvroType.NULL) | ||
) | ||
|
||
val nonEmptyString: Gen[String] = Gen.nonEmptyListOf(Gen.alphaChar).map(_.mkString) |
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.
Perhaps Gen.alphaStr.filterNot(_.isEmpty)
?
@pepegar There are some elements I would add to the README:
|
This PR:
Note that this is not the final version of docs, since a migration from turtles to droste is undergoing, and that will potentially affect external APIs.