-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Sketching what open-enum support looks like * rendering of open enums * update metadata codecs and document codecs * update alloy version * more schema visitor updates for open enums * [skip ci] add docs and changelog * handle collisions * update docs, handle warnings * make scala 2.12 happy * fix test compile errors * update bootstrapped examples * back to single dollar sign * support openEnum trait on String with @enum --------- Co-authored-by: Olivier Mélois <[email protected]>
- Loading branch information
Showing
88 changed files
with
1,295 additions
and
230 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
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
49 changes: 49 additions & 0 deletions
49
modules/bootstrapped/src/generated/smithy4s/example/OpenEnumCollisionTest.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,49 @@ | ||
package smithy4s.example | ||
|
||
import smithy4s.Enumeration | ||
import smithy4s.Hints | ||
import smithy4s.Schema | ||
import smithy4s.ShapeId | ||
import smithy4s.ShapeTag | ||
import smithy4s.optics.Prism | ||
import smithy4s.schema.EnumTag | ||
import smithy4s.schema.Schema.enumeration | ||
|
||
sealed abstract class OpenEnumCollisionTest(_value: String, _name: String, _intValue: Int, _hints: Hints) extends Enumeration.Value { | ||
override type EnumType = OpenEnumCollisionTest | ||
override val value: String = _value | ||
override val name: String = _name | ||
override val intValue: Int = _intValue | ||
override val hints: Hints = _hints | ||
override def enumeration: Enumeration[EnumType] = OpenEnumCollisionTest | ||
@inline final def widen: OpenEnumCollisionTest = this | ||
} | ||
object OpenEnumCollisionTest extends Enumeration[OpenEnumCollisionTest] with ShapeTag.Companion[OpenEnumCollisionTest] { | ||
val id: ShapeId = ShapeId("smithy4s.example", "OpenEnumCollisionTest") | ||
|
||
val hints: Hints = Hints( | ||
alloy.OpenEnum(), | ||
) | ||
|
||
object optics { | ||
val ONE: Prism[OpenEnumCollisionTest, OpenEnumCollisionTest.ONE.type] = Prism.partial[OpenEnumCollisionTest, OpenEnumCollisionTest.ONE.type]{ case OpenEnumCollisionTest.ONE => OpenEnumCollisionTest.ONE }(identity) | ||
val TWO: Prism[OpenEnumCollisionTest, OpenEnumCollisionTest.TWO.type] = Prism.partial[OpenEnumCollisionTest, OpenEnumCollisionTest.TWO.type]{ case OpenEnumCollisionTest.TWO => OpenEnumCollisionTest.TWO }(identity) | ||
val Unknown: Prism[OpenEnumCollisionTest, OpenEnumCollisionTest.Unknown.type] = Prism.partial[OpenEnumCollisionTest, OpenEnumCollisionTest.Unknown.type]{ case OpenEnumCollisionTest.Unknown => OpenEnumCollisionTest.Unknown }(identity) | ||
val $unknown: Prism[OpenEnumCollisionTest, OpenEnumCollisionTest.$Unknown] = Prism.partial[OpenEnumCollisionTest, OpenEnumCollisionTest.$Unknown]{ case u: OpenEnumCollisionTest.$Unknown => u }(identity) | ||
} | ||
|
||
case object ONE extends OpenEnumCollisionTest("ONE", "ONE", 0, Hints()) | ||
case object TWO extends OpenEnumCollisionTest("TWO", "TWO", 1, Hints()) | ||
case object Unknown extends OpenEnumCollisionTest("Unknown", "Unknown", 2, Hints()) | ||
final case class $Unknown(str: String) extends OpenEnumCollisionTest(str, "$Unknown", -1, Hints.empty) | ||
|
||
val $unknown: String => OpenEnumCollisionTest = $Unknown(_) | ||
|
||
val values: List[OpenEnumCollisionTest] = List( | ||
ONE, | ||
TWO, | ||
Unknown, | ||
) | ||
val tag: EnumTag[OpenEnumCollisionTest] = EnumTag.OpenStringEnum($unknown) | ||
implicit val schema: Schema[OpenEnumCollisionTest] = enumeration(tag, values).withId(id).addHints(hints) | ||
} |
49 changes: 49 additions & 0 deletions
49
modules/bootstrapped/src/generated/smithy4s/example/OpenEnumCollisionTest2.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,49 @@ | ||
package smithy4s.example | ||
|
||
import smithy4s.Enumeration | ||
import smithy4s.Hints | ||
import smithy4s.Schema | ||
import smithy4s.ShapeId | ||
import smithy4s.ShapeTag | ||
import smithy4s.optics.Prism | ||
import smithy4s.schema.EnumTag | ||
import smithy4s.schema.Schema.enumeration | ||
|
||
sealed abstract class OpenEnumCollisionTest2(_value: String, _name: String, _intValue: Int, _hints: Hints) extends Enumeration.Value { | ||
override type EnumType = OpenEnumCollisionTest2 | ||
override val value: String = _value | ||
override val name: String = _name | ||
override val intValue: Int = _intValue | ||
override val hints: Hints = _hints | ||
override def enumeration: Enumeration[EnumType] = OpenEnumCollisionTest2 | ||
@inline final def widen: OpenEnumCollisionTest2 = this | ||
} | ||
object OpenEnumCollisionTest2 extends Enumeration[OpenEnumCollisionTest2] with ShapeTag.Companion[OpenEnumCollisionTest2] { | ||
val id: ShapeId = ShapeId("smithy4s.example", "OpenEnumCollisionTest2") | ||
|
||
val hints: Hints = Hints( | ||
alloy.OpenEnum(), | ||
) | ||
|
||
object optics { | ||
val ONE: Prism[OpenEnumCollisionTest2, OpenEnumCollisionTest2.ONE.type] = Prism.partial[OpenEnumCollisionTest2, OpenEnumCollisionTest2.ONE.type]{ case OpenEnumCollisionTest2.ONE => OpenEnumCollisionTest2.ONE }(identity) | ||
val TWO: Prism[OpenEnumCollisionTest2, OpenEnumCollisionTest2.TWO.type] = Prism.partial[OpenEnumCollisionTest2, OpenEnumCollisionTest2.TWO.type]{ case OpenEnumCollisionTest2.TWO => OpenEnumCollisionTest2.TWO }(identity) | ||
val THREE: Prism[OpenEnumCollisionTest2, OpenEnumCollisionTest2.THREE.type] = Prism.partial[OpenEnumCollisionTest2, OpenEnumCollisionTest2.THREE.type]{ case OpenEnumCollisionTest2.THREE => OpenEnumCollisionTest2.THREE }(identity) | ||
val $unknown: Prism[OpenEnumCollisionTest2, OpenEnumCollisionTest2.$Unknown] = Prism.partial[OpenEnumCollisionTest2, OpenEnumCollisionTest2.$Unknown]{ case u: OpenEnumCollisionTest2.$Unknown => u }(identity) | ||
} | ||
|
||
case object ONE extends OpenEnumCollisionTest2("ONE", "ONE", 0, Hints()) | ||
case object TWO extends OpenEnumCollisionTest2("TWO", "TWO", 1, Hints()) | ||
case object THREE extends OpenEnumCollisionTest2("unknown", "THREE", 2, Hints()) | ||
final case class $Unknown(str: String) extends OpenEnumCollisionTest2(str, "$Unknown", -1, Hints.empty) | ||
|
||
val $unknown: String => OpenEnumCollisionTest2 = $Unknown(_) | ||
|
||
val values: List[OpenEnumCollisionTest2] = List( | ||
ONE, | ||
TWO, | ||
THREE, | ||
) | ||
val tag: EnumTag[OpenEnumCollisionTest2] = EnumTag.OpenStringEnum($unknown) | ||
implicit val schema: Schema[OpenEnumCollisionTest2] = enumeration(tag, values).withId(id).addHints(hints) | ||
} |
49 changes: 49 additions & 0 deletions
49
modules/bootstrapped/src/generated/smithy4s/example/OpenEnumCollisionTest3.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,49 @@ | ||
package smithy4s.example | ||
|
||
import smithy4s.Enumeration | ||
import smithy4s.Hints | ||
import smithy4s.Schema | ||
import smithy4s.ShapeId | ||
import smithy4s.ShapeTag | ||
import smithy4s.optics.Prism | ||
import smithy4s.schema.EnumTag | ||
import smithy4s.schema.Schema.enumeration | ||
|
||
sealed abstract class OpenEnumCollisionTest3(_value: String, _name: String, _intValue: Int, _hints: Hints) extends Enumeration.Value { | ||
override type EnumType = OpenEnumCollisionTest3 | ||
override val value: String = _value | ||
override val name: String = _name | ||
override val intValue: Int = _intValue | ||
override val hints: Hints = _hints | ||
override def enumeration: Enumeration[EnumType] = OpenEnumCollisionTest3 | ||
@inline final def widen: OpenEnumCollisionTest3 = this | ||
} | ||
object OpenEnumCollisionTest3 extends Enumeration[OpenEnumCollisionTest3] with ShapeTag.Companion[OpenEnumCollisionTest3] { | ||
val id: ShapeId = ShapeId("smithy4s.example", "OpenEnumCollisionTest3") | ||
|
||
val hints: Hints = Hints( | ||
alloy.OpenEnum(), | ||
) | ||
|
||
object optics { | ||
val ONE: Prism[OpenEnumCollisionTest3, OpenEnumCollisionTest3.ONE.type] = Prism.partial[OpenEnumCollisionTest3, OpenEnumCollisionTest3.ONE.type]{ case OpenEnumCollisionTest3.ONE => OpenEnumCollisionTest3.ONE }(identity) | ||
val TWO: Prism[OpenEnumCollisionTest3, OpenEnumCollisionTest3.TWO.type] = Prism.partial[OpenEnumCollisionTest3, OpenEnumCollisionTest3.TWO.type]{ case OpenEnumCollisionTest3.TWO => OpenEnumCollisionTest3.TWO }(identity) | ||
val unknown: Prism[OpenEnumCollisionTest3, OpenEnumCollisionTest3.unknown.type] = Prism.partial[OpenEnumCollisionTest3, OpenEnumCollisionTest3.unknown.type]{ case OpenEnumCollisionTest3.unknown => OpenEnumCollisionTest3.unknown }(identity) | ||
val $unknown: Prism[OpenEnumCollisionTest3, OpenEnumCollisionTest3.$Unknown] = Prism.partial[OpenEnumCollisionTest3, OpenEnumCollisionTest3.$Unknown]{ case u: OpenEnumCollisionTest3.$Unknown => u }(identity) | ||
} | ||
|
||
case object ONE extends OpenEnumCollisionTest3("ONE", "ONE", 0, Hints()) | ||
case object TWO extends OpenEnumCollisionTest3("TWO", "TWO", 1, Hints()) | ||
case object unknown extends OpenEnumCollisionTest3("unknown", "unknown", 2, Hints()) | ||
final case class $Unknown(str: String) extends OpenEnumCollisionTest3(str, "$Unknown", -1, Hints.empty) | ||
|
||
val $unknown: String => OpenEnumCollisionTest3 = $Unknown(_) | ||
|
||
val values: List[OpenEnumCollisionTest3] = List( | ||
ONE, | ||
TWO, | ||
unknown, | ||
) | ||
val tag: EnumTag[OpenEnumCollisionTest3] = EnumTag.OpenStringEnum($unknown) | ||
implicit val schema: Schema[OpenEnumCollisionTest3] = enumeration(tag, values).withId(id).addHints(hints) | ||
} |
Oops, something went wrong.