-
Notifications
You must be signed in to change notification settings - Fork 18
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
Introduce Newtype instead of AnyVal #14
Conversation
9dd4f66
to
ec24204
Compare
modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/HttpElasticExecutor.scala
Outdated
Show resolved
Hide resolved
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 would expose all errors. Not fail on the first of them. We can combine those errors with ++
.
"com.softwaremill.sttp.client3" %% "zio" % "3.8.3", | ||
"com.softwaremill.sttp.client3" %% "zio-json" % "3.8.3" | ||
"com.softwaremill.sttp.client3" %% "zio-json" % "3.8.3", | ||
"org.apache.commons" % "commons-lang3" % "3.12.0" |
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 prefer sorting those by alphabet. So, you can order all of those that way.
modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala
Outdated
Show resolved
Hide resolved
|
||
package object elasticsearch { | ||
object Routing extends Newtype[String] { | ||
override def assertion = assert { // scalafix:ok |
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 it make sense to use assert(!isEmptyString)
?
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.
Yes.
| - Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters will count towards the 255 limit faster). | ||
| - Names starting with . are deprecated, except for hidden indices and internal indices managed by plugins. | ||
|""".stripMargin | ||
} |
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 it make sense to add a new line?
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.
Yes.
override def assertion = assertCustom { (name: String) => // scalafix:ok | ||
if (validateIndexName(name)) Left(failure(IndexNameRequirements)) else Right(()) | ||
} | ||
private def validateIndexName(name: String): Boolean = |
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 it make sense to add a new line before?
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.
Also, I would rename it to validate
. It should be clear that is IndexName
.
f9a65ed
to
b62728f
Compare
No description provided.