-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid collisions in typed node namespaces, add missing uppercase in a…
…lt nodes (#1602)
- Loading branch information
Showing
22 changed files
with
177 additions
and
42 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
22 changes: 0 additions & 22 deletions
22
modules/bootstrapped/src/generated/smithy4s/example/HasConstrainedNewtype.scala
This file was deleted.
Oops, something went wrong.
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
18 changes: 18 additions & 0 deletions
18
modules/bootstrapped/src/generated/smithy4s/example/_package/MyPackageStringTrait.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,18 @@ | ||
package smithy4s.example._package | ||
|
||
import smithy4s.Hints | ||
import smithy4s.Newtype | ||
import smithy4s.Schema | ||
import smithy4s.ShapeId | ||
import smithy4s.schema.Schema.bijection | ||
import smithy4s.schema.Schema.recursive | ||
import smithy4s.schema.Schema.string | ||
|
||
object MyPackageStringTrait extends Newtype[String] { | ||
val id: ShapeId = ShapeId("smithy4s.example.package", "MyPackageStringTrait") | ||
val hints: Hints = Hints( | ||
smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None), | ||
).lazily | ||
val underlyingSchema: Schema[String] = string.withId(id).addHints(hints) | ||
implicit val schema: Schema[MyPackageStringTrait] = recursive(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
65 changes: 65 additions & 0 deletions
65
modules/bootstrapped/src/generated/smithy4s/example/collision/Class.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,65 @@ | ||
package smithy4s.example.collision | ||
|
||
import smithy4s.Hints | ||
import smithy4s.Schema | ||
import smithy4s.ShapeId | ||
import smithy4s.ShapeTag | ||
import smithy4s.schema.Schema.constant | ||
import smithy4s.schema.Schema.recursive | ||
import smithy4s.schema.Schema.union | ||
|
||
sealed trait Class extends scala.Product with scala.Serializable { self => | ||
@inline final def widen: Class = this | ||
def $ordinal: Int | ||
|
||
object project { | ||
def _package: Option[Class.AdtStruct] = Class.AdtStruct.alt.project.lift(self) | ||
} | ||
|
||
def accept[A](visitor: Class.Visitor[A]): A = this match { | ||
case value: Class.AdtStruct => visitor._package(value) | ||
} | ||
} | ||
object Class extends ShapeTag.Companion[Class] { | ||
|
||
def adtStruct():AdtStruct = AdtStruct() | ||
|
||
val id: ShapeId = ShapeId("smithy4s.example.collision", "class") | ||
|
||
val hints: Hints = Hints( | ||
smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None), | ||
).lazily | ||
|
||
final case class AdtStruct() extends Class { | ||
def $ordinal: Int = 0 | ||
} | ||
|
||
object AdtStruct { | ||
val id: ShapeId = ShapeId("smithy4s.example.collision", "AdtStruct") | ||
|
||
val hints: Hints = Hints.empty | ||
|
||
|
||
val schema: Schema[AdtStruct] = constant(AdtStruct()).withId(id).addHints(hints) | ||
|
||
val alt = schema.oneOf[Class]("package") | ||
} | ||
|
||
|
||
trait Visitor[A] { | ||
def _package(value: Class.AdtStruct): A | ||
} | ||
|
||
object Visitor { | ||
trait Default[A] extends Visitor[A] { | ||
def default: A | ||
def _package(value: Class.AdtStruct): A = default | ||
} | ||
} | ||
|
||
implicit val schema: Schema[Class] = recursive(union( | ||
Class.AdtStruct.alt, | ||
){ | ||
_.$ordinal | ||
}.withId(id).addHints(hints)) | ||
} |
17 changes: 17 additions & 0 deletions
17
modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedNameUnionTrait.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.collision | ||
|
||
import smithy4s.Hints | ||
import smithy4s.Newtype | ||
import smithy4s.Schema | ||
import smithy4s.ShapeId | ||
import smithy4s.schema.Schema.bijection | ||
import smithy4s.schema.Schema.string | ||
|
||
object ReservedNameUnionTrait extends Newtype[java.lang.String] { | ||
val id: ShapeId = ShapeId("smithy4s.example.collision", "ReservedNameUnionTrait") | ||
val hints: Hints = Hints( | ||
smithy4s.example.collision.Class.AdtStruct().widen, | ||
).lazily | ||
val underlyingSchema: Schema[java.lang.String] = string.withId(id).addHints(hints) | ||
implicit val schema: Schema[ReservedNameUnionTrait] = bijection(underlyingSchema, asBijection) | ||
} |
17 changes: 17 additions & 0 deletions
17
...es/bootstrapped/src/generated/smithy4s/example/collision/TestReservedNamespaceTrait.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.collision | ||
|
||
import smithy4s.Hints | ||
import smithy4s.Newtype | ||
import smithy4s.Schema | ||
import smithy4s.ShapeId | ||
import smithy4s.schema.Schema.bijection | ||
import smithy4s.schema.Schema.string | ||
|
||
object TestReservedNamespaceTrait extends Newtype[java.lang.String] { | ||
val id: ShapeId = ShapeId("smithy4s.example.collision", "TestReservedNamespaceTrait") | ||
val hints: Hints = Hints( | ||
smithy4s.example._package.MyPackageStringTrait("test"), | ||
).lazily | ||
val underlyingSchema: Schema[java.lang.String] = string.withId(id).addHints(hints) | ||
implicit val schema: Schema[TestReservedNamespaceTrait] = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ $version: "2.0" | |
namespace smithy4s.example.package | ||
|
||
string MyPackageString | ||
|
||
@trait | ||
string MyPackageStringTrait |
Oops, something went wrong.