Skip to content
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

Types with only optional values may be wrong in Elm #195

Open
nikitaDanilenko opened this issue Aug 29, 2022 · 0 comments
Open

Types with only optional values may be wrong in Elm #195

nikitaDanilenko opened this issue Aug 29, 2022 · 0 comments

Comments

@nikitaDanilenko
Copy link
Contributor

A Scala type satisfying the properties:

  1. All fields are optional
  2. The generated Elm file is in its own file

yields an incorrect Elm file, because an import is missing.

Reconstruction

import bridges.core.syntax._
import bridges.elm.Elm

object Issue {

  case class OptionOnly(
      number: Option[Int]
  )

  def main(args: Array[String]): Unit = {
    val (_, content) = Elm.buildFile(
      module = "TestModule",
      decls = List(
        decl[OptionOnly]
      ),
      customTypeReplacements = Map.empty
    )
    println(content)
  }

}

The distinction, whether or not the decoders contain required needs to be removed in ElmFileBuilder.scala.

nikitaDanilenko added a commit to nikitaDanilenko/bridges that referenced this issue Aug 29, 2022
nikitaDanilenko added a commit to nikitaDanilenko/bridges that referenced this issue Aug 29, 2022
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

No branches or pull requests

1 participant