-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'series/0.18' into fix-1594
- Loading branch information
Showing
41 changed files
with
153 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
modules/bootstrapped/src/generated/smithy4s/example/HasUnionUnitCaseTrait.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package smithy4s.example | ||
|
||
import smithy4s.Hints | ||
import smithy4s.Newtype | ||
import smithy4s.Schema | ||
import smithy4s.ShapeId | ||
import smithy4s.schema.Schema.bijection | ||
import smithy4s.schema.Schema.string | ||
|
||
object HasUnionUnitCaseTrait extends Newtype[String] { | ||
val id: ShapeId = ShapeId("smithy4s.example", "HasUnionUnitCaseTrait") | ||
val hints: Hints = Hints( | ||
smithy4s.example.UnionTraitWithUnitCase.UCase.widen, | ||
).lazily | ||
val underlyingSchema: Schema[String] = string.withId(id).addHints(hints) | ||
implicit val schema: Schema[HasUnionUnitCaseTrait] = bijection(underlyingSchema, asBijection) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
modules/bootstrapped/src/generated/smithy4s/example/UnionTraitWithUnitCase.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package smithy4s.example | ||
|
||
import UnionTraitWithUnitCase.UCaseAlt | ||
import smithy4s.Hints | ||
import smithy4s.Schema | ||
import smithy4s.ShapeId | ||
import smithy4s.ShapeTag | ||
import smithy4s.schema.Schema.bijection | ||
import smithy4s.schema.Schema.recursive | ||
import smithy4s.schema.Schema.string | ||
import smithy4s.schema.Schema.union | ||
|
||
sealed trait UnionTraitWithUnitCase extends scala.Product with scala.Serializable { self => | ||
@inline final def widen: UnionTraitWithUnitCase = this | ||
def $ordinal: Int | ||
|
||
object project { | ||
def u: Option[UnionTraitWithUnitCase.UCase.type] = UCaseAlt.project.lift(self) | ||
def s: Option[String] = UnionTraitWithUnitCase.SCase.alt.project.lift(self).map(_.s) | ||
} | ||
|
||
def accept[A](visitor: UnionTraitWithUnitCase.Visitor[A]): A = this match { | ||
case value: UnionTraitWithUnitCase.UCase.type => visitor.u(value) | ||
case value: UnionTraitWithUnitCase.SCase => visitor.s(value.s) | ||
} | ||
} | ||
object UnionTraitWithUnitCase extends ShapeTag.Companion[UnionTraitWithUnitCase] { | ||
|
||
def u(): UnionTraitWithUnitCase = UnionTraitWithUnitCase.UCase | ||
def s(s: String): UnionTraitWithUnitCase = SCase(s) | ||
|
||
val id: ShapeId = ShapeId("smithy4s.example", "unionTraitWithUnitCase") | ||
|
||
val hints: Hints = Hints( | ||
smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None), | ||
).lazily | ||
|
||
case object UCase extends UnionTraitWithUnitCase { final def $ordinal: Int = 0 } | ||
private val UCaseAlt = Schema.constant(UnionTraitWithUnitCase.UCase).oneOf[UnionTraitWithUnitCase]("u").addHints(hints) | ||
final case class SCase(s: String) extends UnionTraitWithUnitCase { final def $ordinal: Int = 1 } | ||
|
||
object SCase { | ||
val hints: Hints = Hints.empty | ||
val schema: Schema[UnionTraitWithUnitCase.SCase] = bijection(string.addHints(hints), UnionTraitWithUnitCase.SCase(_), _.s) | ||
val alt = schema.oneOf[UnionTraitWithUnitCase]("s") | ||
} | ||
|
||
trait Visitor[A] { | ||
def u(value: UnionTraitWithUnitCase.UCase.type): A | ||
def s(value: String): A | ||
} | ||
|
||
object Visitor { | ||
trait Default[A] extends Visitor[A] { | ||
def default: A | ||
def u(value: UnionTraitWithUnitCase.UCase.type): A = default | ||
def s(value: String): A = default | ||
} | ||
} | ||
|
||
implicit val schema: Schema[UnionTraitWithUnitCase] = recursive(union( | ||
UCaseAlt, | ||
UnionTraitWithUnitCase.SCase.alt, | ||
){ | ||
_.$ordinal | ||
}.withId(id).addHints(hints)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.