Skip to content

fix: add missing Always and Never values to DatastarRetry#4027

Merged
987Nabil merged 1 commit intozio:mainfrom
987Nabil:fix/datastar-retry-missing-enums
Mar 14, 2026
Merged

fix: add missing Always and Never values to DatastarRetry#4027
987Nabil merged 1 commit intozio:mainfrom
987Nabil:fix/datastar-retry-missing-enums

Conversation

@987Nabil
Copy link
Copy Markdown
Contributor

Fixes #4021

The Datastar JS SDK supports retry: 'auto' | 'error' | 'always' | 'never', but the Scala SDK was missing the Always and Never enum values.

Changes

  • Added Always case object to DatastarRetry
  • Added Never case object to DatastarRetry
  • Updated schema transformation to handle "always" and "never" strings
  • Updated error message to list all 4 valid values

Copilot AI review requested due to automatic review settings March 13, 2026 15:22
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 13, 2026

Deploy Preview for zio-http ready!

Name Link
🔨 Latest commit e84a007
🔍 Latest deploy log https://app.netlify.com/projects/zio-http/deploys/69b53c13ce662f00084e1768
😎 Deploy Preview https://deploy-preview-4027--zio-http.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the missing DatastarRetry enum values to the Scala Datastar SDK so it matches the Datastar protocol/JS SDK ('auto' | 'error' | 'always' | 'never') and updates schema string decoding/encoding accordingly.

Changes:

  • Added DatastarRetry.Always and DatastarRetry.Never case objects.
  • Updated Schema[String].transformOrFail mapping to support "always" and "never".
  • Expanded the invalid-value error message to list all four allowed values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 226 to 233
implicit val schema: Schema[DatastarRetry] = Schema[String].transformOrFail[DatastarRetry](
{
case "auto" => Right(Auto)
case "error" => Right(Error)
case other => Left(s"Invalid DatastarRetry value: '$other'. Expected 'auto' or 'error'.")
case "auto" => Right(Auto)
case "error" => Right(Error)
case "always" => Right(Always)
case "never" => Right(Never)
case other => Left(s"Invalid DatastarRetry value: '$other'. Expected 'auto', 'error', 'always', or 'never'.")
},
Comment on lines 219 to +224
sealed trait DatastarRetry
object DatastarRetry {
case object Auto extends DatastarRetry
case object Error extends DatastarRetry
case object Auto extends DatastarRetry
case object Error extends DatastarRetry
case object Always extends DatastarRetry
case object Never extends DatastarRetry
@987Nabil 987Nabil force-pushed the fix/datastar-retry-missing-enums branch from de9f843 to e84a007 Compare March 14, 2026 10:44
@987Nabil 987Nabil merged commit 4b5b5d4 into zio:main Mar 14, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(datastar): DatastarRetry missing Always and Never enum values

2 participants