diff --git a/CHANGELOG.md b/CHANGELOG.md index a9cbed6b4..040d50860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 0.18.11 +* smithy4s Structure schemas are now retaining the original order of fields, as per the specification. * Added a utility method, `Schema.transformTransitivelyK`, to help in recursively transforming schemas. In addition, the semantics of `transformHintsTransitively` have been changed: the transformation no longer modifies the hints on the result of the `total` function. diff --git a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DescribeEndpointsRequest.scala b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DescribeEndpointsRequest.scala index 077c9500d..5f7fa09f8 100644 --- a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DescribeEndpointsRequest.scala +++ b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DescribeEndpointsRequest.scala @@ -13,5 +13,6 @@ object DescribeEndpointsRequest extends ShapeTag.Companion[DescribeEndpointsRequ val hints: Hints = Hints.empty + implicit val schema: Schema[DescribeEndpointsRequest] = constant(DescribeEndpointsRequest()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DescribeEndpointsResponse.scala b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DescribeEndpointsResponse.scala index 55a255936..8ddcfc752 100644 --- a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DescribeEndpointsResponse.scala +++ b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/DescribeEndpointsResponse.scala @@ -16,9 +16,10 @@ object DescribeEndpointsResponse extends ShapeTag.Companion[DescribeEndpointsRes val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(endpoints: List[Endpoint]): DescribeEndpointsResponse = DescribeEndpointsResponse(endpoints) + implicit val schema: Schema[DescribeEndpointsResponse] = struct( Endpoints.underlyingSchema.required[DescribeEndpointsResponse]("Endpoints", _.endpoints).addHints(smithy.api.Documentation("

List of endpoints.

")), - ){ - DescribeEndpointsResponse.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/Endpoint.scala b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/Endpoint.scala index 42b407cfe..61b6c6461 100644 --- a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/Endpoint.scala +++ b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/Endpoint.scala @@ -23,10 +23,11 @@ object Endpoint extends ShapeTag.Companion[Endpoint] { smithy.api.Documentation("

An endpoint information details.

"), ).lazily + // constructor using the original order from the spec + private def make(address: String, cachePeriodInMinutes: Long): Endpoint = Endpoint(address, cachePeriodInMinutes) + implicit val schema: Schema[Endpoint] = struct( string.required[Endpoint]("Address", _.address).addHints(smithy.api.Documentation("

IP address of the endpoint.

")), long.required[Endpoint]("CachePeriodInMinutes", _.cachePeriodInMinutes).addHints(smithy.api.Default(smithy4s.Document.fromDouble(0.0d)), smithy.api.Documentation("

Endpoint cache time to live (TTL) value.

")), - ){ - Endpoint.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/InternalServerError.scala b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/InternalServerError.scala index 86a233328..623198cbf 100644 --- a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/InternalServerError.scala +++ b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/InternalServerError.scala @@ -23,9 +23,10 @@ object InternalServerError extends ShapeTag.Companion[InternalServerError] { smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Option[ErrorMessage]): InternalServerError = InternalServerError(message) + implicit val schema: Schema[InternalServerError] = struct( ErrorMessage.schema.optional[InternalServerError]("message", _.message).addHints(smithy.api.Documentation("

The server encountered an internal error trying to fulfill the request.

")), - ){ - InternalServerError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/InvalidEndpointException.scala b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/InvalidEndpointException.scala index dfc430f31..51a63193d 100644 --- a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/InvalidEndpointException.scala +++ b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/InvalidEndpointException.scala @@ -20,9 +20,10 @@ object InvalidEndpointException extends ShapeTag.Companion[InvalidEndpointExcept smithy.api.HttpError(421), ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): InvalidEndpointException = InvalidEndpointException(message) + implicit val schema: Schema[InvalidEndpointException] = struct( string.optional[InvalidEndpointException]("Message", _.message), - ){ - InvalidEndpointException.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/ListTablesInput.scala b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/ListTablesInput.scala index 1c9e6578d..037d4fcb3 100644 --- a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/ListTablesInput.scala +++ b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/ListTablesInput.scala @@ -23,10 +23,11 @@ object ListTablesInput extends ShapeTag.Companion[ListTablesInput] { smithy.api.Documentation("

Represents the input of a ListTables operation.

"), ).lazily + // constructor using the original order from the spec + private def make(exclusiveStartTableName: Option[TableName], limit: Option[ListTablesInputLimit]): ListTablesInput = ListTablesInput(exclusiveStartTableName, limit) + implicit val schema: Schema[ListTablesInput] = struct( TableName.schema.optional[ListTablesInput]("ExclusiveStartTableName", _.exclusiveStartTableName).addHints(smithy.api.Documentation("

The first table name that this operation will evaluate. Use the value that was returned for\n LastEvaluatedTableName in a previous operation, so that you can obtain the next page\n of results.

")), ListTablesInputLimit.schema.optional[ListTablesInput]("Limit", _.limit).addHints(smithy.api.Documentation("

A maximum number of table names to return. If this parameter is not specified, the limit is 100.

")), - ){ - ListTablesInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/ListTablesOutput.scala b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/ListTablesOutput.scala index 74745fa34..e8af11772 100644 --- a/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/ListTablesOutput.scala +++ b/modules/bootstrapped/src/generated/com/amazonaws/dynamodb/ListTablesOutput.scala @@ -28,10 +28,11 @@ object ListTablesOutput extends ShapeTag.Companion[ListTablesOutput] { smithy.api.Documentation("

Represents the output of a ListTables operation.

"), ).lazily + // constructor using the original order from the spec + private def make(tableNames: Option[List[TableName]], lastEvaluatedTableName: Option[TableName]): ListTablesOutput = ListTablesOutput(tableNames, lastEvaluatedTableName) + implicit val schema: Schema[ListTablesOutput] = struct( TableNameList.underlyingSchema.optional[ListTablesOutput]("TableNames", _.tableNames).addHints(smithy.api.Documentation("

The names of the tables associated with the current account at the current endpoint. The maximum size of this array is 100.

\n

If LastEvaluatedTableName also appears in the output, you can use this value as the\n ExclusiveStartTableName parameter in a subsequent ListTables request and\n obtain the next page of results.

")), TableName.schema.optional[ListTablesOutput]("LastEvaluatedTableName", _.lastEvaluatedTableName).addHints(smithy.api.Documentation("

The name of the last table in the current page of results. Use this value as the\n ExclusiveStartTableName in a new request to obtain the next page of results, until\n all the table names are returned.

\n

If you do not receive a LastEvaluatedTableName value in the response, this means that\n there are no more table names to be retrieved.

")), - ){ - ListTablesOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/Attributes.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/Attributes.scala index 9dc1ec9dc..d40ca501d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/benchmark/Attributes.scala +++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/Attributes.scala @@ -18,6 +18,9 @@ object Attributes extends ShapeTag.Companion[Attributes] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(user: String, public: Boolean, size: Long, creationDate: Timestamp, region: String, queryable: Option[Boolean], queryableLastChange: Option[Timestamp], blockPublicAccess: Option[Boolean], permissions: Option[List[Permission]], tags: Option[List[String]], backedUp: Option[Boolean], metadata: Option[List[Metadata]], encryption: Option[Encryption]): Attributes = Attributes(user, public, size, creationDate, region, queryable, queryableLastChange, blockPublicAccess, permissions, tags, backedUp, metadata, encryption) + implicit val schema: Schema[Attributes] = struct( string.required[Attributes]("user", _.user), boolean.required[Attributes]("public", _.public), @@ -32,7 +35,5 @@ object Attributes extends ShapeTag.Companion[Attributes] { boolean.optional[Attributes]("backedUp", _.backedUp), ListMetadata.underlyingSchema.optional[Attributes]("metadata", _.metadata), Encryption.schema.optional[Attributes]("encryption", _.encryption), - ){ - Attributes.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/CreateObjectInput.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/CreateObjectInput.scala index f03a707c2..cd7501c1b 100644 --- a/modules/bootstrapped/src/generated/smithy4s/benchmark/CreateObjectInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/CreateObjectInput.scala @@ -14,11 +14,12 @@ object CreateObjectInput extends ShapeTag.Companion[CreateObjectInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(key: String, bucketName: String, payload: S3Object): CreateObjectInput = CreateObjectInput(key, bucketName, payload) + implicit val schema: Schema[CreateObjectInput] = struct( string.required[CreateObjectInput]("key", _.key).addHints(smithy.api.HttpLabel()), string.required[CreateObjectInput]("bucketName", _.bucketName).addHints(smithy.api.HttpLabel()), S3Object.schema.required[CreateObjectInput]("payload", _.payload).addHints(smithy.api.HttpPayload()), - ){ - CreateObjectInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/Creds.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/Creds.scala index d854dbde0..8aaba1dd2 100644 --- a/modules/bootstrapped/src/generated/smithy4s/benchmark/Creds.scala +++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/Creds.scala @@ -14,10 +14,11 @@ object Creds extends ShapeTag.Companion[Creds] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(user: Option[String], key: Option[String]): Creds = Creds(user, key) + implicit val schema: Schema[Creds] = struct( string.optional[Creds]("user", _.user), string.optional[Creds]("key", _.key), - ){ - Creds.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/Encryption.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/Encryption.scala index 773c9fbd1..de97b01fa 100644 --- a/modules/bootstrapped/src/generated/smithy4s/benchmark/Encryption.scala +++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/Encryption.scala @@ -16,11 +16,12 @@ object Encryption extends ShapeTag.Companion[Encryption] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(user: Option[String], date: Option[Timestamp], metadata: Option[EncryptionMetadata]): Encryption = Encryption(user, date, metadata) + implicit val schema: Schema[Encryption] = struct( string.optional[Encryption]("user", _.user), timestamp.optional[Encryption]("date", _.date).addHints(smithy.api.TimestampFormat.EPOCH_SECONDS.widen), EncryptionMetadata.schema.optional[Encryption]("metadata", _.metadata), - ){ - Encryption.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/EncryptionMetadata.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/EncryptionMetadata.scala index b6dd56750..9e58f800a 100644 --- a/modules/bootstrapped/src/generated/smithy4s/benchmark/EncryptionMetadata.scala +++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/EncryptionMetadata.scala @@ -15,11 +15,12 @@ object EncryptionMetadata extends ShapeTag.Companion[EncryptionMetadata] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(system: Option[String], credentials: Option[Creds], partial: Option[Boolean]): EncryptionMetadata = EncryptionMetadata(system, credentials, partial) + implicit val schema: Schema[EncryptionMetadata] = struct( string.optional[EncryptionMetadata]("system", _.system), Creds.schema.optional[EncryptionMetadata]("credentials", _.credentials), boolean.optional[EncryptionMetadata]("partial", _.partial), - ){ - EncryptionMetadata.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/Metadata.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/Metadata.scala index 7e9a46221..007622850 100644 --- a/modules/bootstrapped/src/generated/smithy4s/benchmark/Metadata.scala +++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/Metadata.scala @@ -17,13 +17,14 @@ object Metadata extends ShapeTag.Companion[Metadata] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(contentType: Option[String], lastModified: Option[Timestamp], checkSum: Option[String], pendingDeletion: Option[Boolean], etag: Option[String]): Metadata = Metadata(contentType, lastModified, checkSum, pendingDeletion, etag) + implicit val schema: Schema[Metadata] = struct( string.optional[Metadata]("contentType", _.contentType), timestamp.optional[Metadata]("lastModified", _.lastModified).addHints(smithy.api.TimestampFormat.EPOCH_SECONDS.widen), string.optional[Metadata]("checkSum", _.checkSum), boolean.optional[Metadata]("pendingDeletion", _.pendingDeletion), string.optional[Metadata]("etag", _.etag), - ){ - Metadata.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/Permission.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/Permission.scala index 86c33aae0..fc577ca0d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/benchmark/Permission.scala +++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/Permission.scala @@ -14,11 +14,12 @@ object Permission extends ShapeTag.Companion[Permission] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(read: Option[Boolean], write: Option[Boolean], directory: Option[Boolean]): Permission = Permission(read, write, directory) + implicit val schema: Schema[Permission] = struct( boolean.optional[Permission]("read", _.read), boolean.optional[Permission]("write", _.write), boolean.optional[Permission]("directory", _.directory), - ){ - Permission.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/S3Object.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/S3Object.scala index d675aad1e..7162dfa11 100644 --- a/modules/bootstrapped/src/generated/smithy4s/benchmark/S3Object.scala +++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/S3Object.scala @@ -16,12 +16,13 @@ object S3Object extends ShapeTag.Companion[S3Object] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(id: String, owner: String, attributes: Attributes, data: Blob): S3Object = S3Object(id, owner, attributes, data) + implicit val schema: Schema[S3Object] = struct( string.required[S3Object]("id", _.id), string.required[S3Object]("owner", _.owner), Attributes.schema.required[S3Object]("attributes", _.attributes), bytes.required[S3Object]("data", _.data), - ){ - S3Object.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/benchmark/SendStringInput.scala b/modules/bootstrapped/src/generated/smithy4s/benchmark/SendStringInput.scala index a66e17a97..0c4d405a0 100644 --- a/modules/bootstrapped/src/generated/smithy4s/benchmark/SendStringInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/benchmark/SendStringInput.scala @@ -14,11 +14,12 @@ object SendStringInput extends ShapeTag.Companion[SendStringInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(key: String, bucketName: String, body: String): SendStringInput = SendStringInput(key, bucketName, body) + implicit val schema: Schema[SendStringInput] = struct( string.required[SendStringInput]("key", _.key).addHints(smithy.api.HttpLabel()), string.required[SendStringInput]("bucketName", _.bucketName).addHints(smithy.api.HttpLabel()), string.required[SendStringInput]("body", _.body).addHints(smithy.api.HttpPayload()), - ){ - SendStringInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/AStructure.scala b/modules/bootstrapped/src/generated/smithy4s/example/AStructure.scala index f62bc3298..2e1f4592f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/AStructure.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/AStructure.scala @@ -16,9 +16,10 @@ object AStructure extends ShapeTag.Companion[AStructure] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(astring: AString): AStructure = AStructure(astring) + implicit val schema: Schema[AStructure] = struct( AString.schema.field[AStructure]("astring", _.astring).addHints(smithy.api.Default(smithy4s.Document.fromString("\"Hello World\" with \"quotes\""))), - ){ - AStructure.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/AddBrandsInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/AddBrandsInput.scala index bd005c8b3..a9cf0f3cc 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/AddBrandsInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/AddBrandsInput.scala @@ -14,9 +14,10 @@ object AddBrandsInput extends ShapeTag.Companion[AddBrandsInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(brands: Option[List[String]]): AddBrandsInput = AddBrandsInput(brands) + implicit val schema: Schema[AddBrandsInput] = struct( BrandList.underlyingSchema.optional[AddBrandsInput]("brands", _.brands), - ){ - AddBrandsInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/AddMenuItemRequest.scala b/modules/bootstrapped/src/generated/smithy4s/example/AddMenuItemRequest.scala index 3f1a20cb2..e57299515 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/AddMenuItemRequest.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/AddMenuItemRequest.scala @@ -14,10 +14,11 @@ object AddMenuItemRequest extends ShapeTag.Companion[AddMenuItemRequest] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(restaurant: String, menuItem: MenuItem): AddMenuItemRequest = AddMenuItemRequest(restaurant, menuItem) + implicit val schema: Schema[AddMenuItemRequest] = struct( string.required[AddMenuItemRequest]("restaurant", _.restaurant).addHints(smithy.api.HttpLabel()), MenuItem.schema.required[AddMenuItemRequest]("menuItem", _.menuItem).addHints(smithy.api.HttpPayload()), - ){ - AddMenuItemRequest.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/AddMenuItemResult.scala b/modules/bootstrapped/src/generated/smithy4s/example/AddMenuItemResult.scala index 6cf0d7d8e..e1ac97a0f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/AddMenuItemResult.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/AddMenuItemResult.scala @@ -16,10 +16,11 @@ object AddMenuItemResult extends ShapeTag.Companion[AddMenuItemResult] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(itemId: String, added: Timestamp): AddMenuItemResult = AddMenuItemResult(itemId, added) + implicit val schema: Schema[AddMenuItemResult] = struct( string.required[AddMenuItemResult]("itemId", _.itemId).addHints(smithy.api.HttpPayload()), timestamp.required[AddMenuItemResult]("added", _.added).addHints(smithy.api.TimestampFormat.EPOCH_SECONDS.widen, smithy.api.HttpHeader("X-ADDED-AT")), - ){ - AddMenuItemResult.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/AgeFormat.scala b/modules/bootstrapped/src/generated/smithy4s/example/AgeFormat.scala index 5c0200bf5..b2f5e6b25 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/AgeFormat.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/AgeFormat.scala @@ -15,5 +15,6 @@ object AgeFormat extends ShapeTag.Companion[AgeFormat] { smithy.api.Trait(selector = Some(":test(integer, member > integer)"), structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + implicit val schema: Schema[AgeFormat] = constant(AgeFormat()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ArbitraryDataTest.scala b/modules/bootstrapped/src/generated/smithy4s/example/ArbitraryDataTest.scala index 522fde046..2da65aa3b 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ArbitraryDataTest.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ArbitraryDataTest.scala @@ -15,5 +15,6 @@ object ArbitraryDataTest extends ShapeTag.Companion[ArbitraryDataTest] { smithy4s.example.ArbitraryData(smithy4s.Document.obj("str" -> smithy4s.Document.fromString("hello"), "int" -> smithy4s.Document.fromDouble(1.0d), "bool" -> smithy4s.Document.fromBoolean(true), "arr" -> smithy4s.Document.array(smithy4s.Document.fromString("one"), smithy4s.Document.fromString("two"), smithy4s.Document.fromString("three")), "obj" -> smithy4s.Document.obj("str" -> smithy4s.Document.fromString("s"), "i" -> smithy4s.Document.fromDouble(1.0d)))), ).lazily + implicit val schema: Schema[ArbitraryDataTest] = constant(ArbitraryDataTest()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/BigStruct.scala b/modules/bootstrapped/src/generated/smithy4s/example/BigStruct.scala index 3b7a87cee..9b1da71ca 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/BigStruct.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/BigStruct.scala @@ -14,6 +14,9 @@ object BigStruct extends ShapeTag.Companion[BigStruct] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(a1: Int, a2: Int, a3: Int, a4: Int, a5: Int, a6: Int, a7: Int, a8: Int, a9: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int): BigStruct = BigStruct(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23) + implicit val schema: Schema[BigStruct] = struct.genericArity( int.required[BigStruct]("a1", _.a1), int.required[BigStruct]("a2", _.a2), @@ -39,7 +42,7 @@ object BigStruct extends ShapeTag.Companion[BigStruct] { int.required[BigStruct]("a22", _.a22), int.required[BigStruct]("a23", _.a23), ){ - arr => new BigStruct( + arr => make( arr(0).asInstanceOf[Int], arr(1).asInstanceOf[Int], arr(2).asInstanceOf[Int], diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Candy.scala b/modules/bootstrapped/src/generated/smithy4s/example/Candy.scala index 4c4ab160a..7f95cff9c 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Candy.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Candy.scala @@ -14,9 +14,10 @@ object Candy extends ShapeTag.Companion[Candy] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(name: Option[String]): Candy = Candy(name) + implicit val schema: Schema[Candy] = struct( string.optional[Candy]("name", _.name), - ){ - Candy.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/CityCoordinates.scala b/modules/bootstrapped/src/generated/smithy4s/example/CityCoordinates.scala index 43409f4d7..37cdae0ed 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/CityCoordinates.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/CityCoordinates.scala @@ -14,10 +14,11 @@ object CityCoordinates extends ShapeTag.Companion[CityCoordinates] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(latitude: Float, longitude: Float): CityCoordinates = CityCoordinates(latitude, longitude) + implicit val schema: Schema[CityCoordinates] = struct( float.required[CityCoordinates]("latitude", _.latitude), float.required[CityCoordinates]("longitude", _.longitude), - ){ - CityCoordinates.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/CitySummary.scala b/modules/bootstrapped/src/generated/smithy4s/example/CitySummary.scala index fac0553d8..4b77303c9 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/CitySummary.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/CitySummary.scala @@ -16,10 +16,11 @@ object CitySummary extends ShapeTag.Companion[CitySummary] { smithy.api.References(List(smithy.api.Reference(resource = smithy.api.NonEmptyString("smithy4s.example#City"), ids = None, service = None, rel = None))), ).lazily + // constructor using the original order from the spec + private def make(cityId: CityId, name: String): CitySummary = CitySummary(cityId, name) + implicit val schema: Schema[CitySummary] = struct( CityId.schema.required[CitySummary]("cityId", _.cityId), string.required[CitySummary]("name", _.name), - ){ - CitySummary.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ClientError.scala b/modules/bootstrapped/src/generated/smithy4s/example/ClientError.scala index d72af23ce..dd3ff9b3d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ClientError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ClientError.scala @@ -19,10 +19,11 @@ object ClientError extends ShapeTag.Companion[ClientError] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(code: Int, details: String): ClientError = ClientError(code, details) + implicit val schema: Schema[ClientError] = struct( int.required[ClientError]("code", _.code), string.required[ClientError]("details", _.details), - ){ - ClientError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/CustomCodeInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/CustomCodeInput.scala index 188b367d3..cebd448e0 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/CustomCodeInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/CustomCodeInput.scala @@ -14,9 +14,10 @@ object CustomCodeInput extends ShapeTag.Companion[CustomCodeInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(code: Int): CustomCodeInput = CustomCodeInput(code) + implicit val schema: Schema[CustomCodeInput] = struct( int.required[CustomCodeInput]("code", _.code).addHints(smithy.api.HttpLabel()), - ){ - CustomCodeInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/CustomCodeOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/CustomCodeOutput.scala index 11a96ca7e..aedd9f5ac 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/CustomCodeOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/CustomCodeOutput.scala @@ -14,9 +14,10 @@ object CustomCodeOutput extends ShapeTag.Companion[CustomCodeOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(code: Option[Int]): CustomCodeOutput = CustomCodeOutput(code) + implicit val schema: Schema[CustomCodeOutput] = struct( int.optional[CustomCodeOutput]("code", _.code).addHints(smithy.api.HttpResponseCode()), - ){ - CustomCodeOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DefaultInMixinUsageTest.scala b/modules/bootstrapped/src/generated/smithy4s/example/DefaultInMixinUsageTest.scala index c22d932ca..91a8311d3 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/DefaultInMixinUsageTest.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/DefaultInMixinUsageTest.scala @@ -14,9 +14,10 @@ object DefaultInMixinUsageTest extends ShapeTag.Companion[DefaultInMixinUsageTes val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(one: String): DefaultInMixinUsageTest = DefaultInMixinUsageTest(one) + implicit val schema: Schema[DefaultInMixinUsageTest] = struct( string.field[DefaultInMixinUsageTest]("one", _.one).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), - ){ - DefaultInMixinUsageTest.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DefaultOrderingTest.scala b/modules/bootstrapped/src/generated/smithy4s/example/DefaultOrderingTest.scala index 1942014d3..9860fdcb6 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/DefaultOrderingTest.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/DefaultOrderingTest.scala @@ -15,11 +15,12 @@ object DefaultOrderingTest extends ShapeTag.Companion[DefaultOrderingTest] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(one: Int, two: Option[String], three: String): DefaultOrderingTest = DefaultOrderingTest(three, one, two) + implicit val schema: Schema[DefaultOrderingTest] = struct( - string.required[DefaultOrderingTest]("three", _.three), int.field[DefaultOrderingTest]("one", _.one).addHints(smithy.api.Default(smithy4s.Document.fromDouble(1.0d))), string.optional[DefaultOrderingTest]("two", _.two), - ){ - DefaultOrderingTest.apply - }.withId(id).addHints(hints) + string.required[DefaultOrderingTest]("three", _.three), + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DefaultTest.scala b/modules/bootstrapped/src/generated/smithy4s/example/DefaultTest.scala index 2413dfa7f..bc58468ea 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/DefaultTest.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/DefaultTest.scala @@ -27,6 +27,9 @@ object DefaultTest extends ShapeTag.Companion[DefaultTest] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(one: Int, two: String, three: List[String], four: List[String], five: String, six: Int, seven: Document, eight: Map[String, String], nine: Short, ten: Double, eleven: Float, twelve: Long, thirteen: Timestamp, fourteen: Timestamp, fifteen: Timestamp, sixteen: Byte, seventeen: Blob, eighteen: Boolean): DefaultTest = DefaultTest(one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen) + implicit val schema: Schema[DefaultTest] = struct( int.field[DefaultTest]("one", _.one).addHints(smithy.api.Default(smithy4s.Document.fromDouble(1.0d))), string.field[DefaultTest]("two", _.two).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), @@ -46,7 +49,5 @@ object DefaultTest extends ShapeTag.Companion[DefaultTest] { byte.field[DefaultTest]("sixteen", _.sixteen).addHints(smithy.api.Default(smithy4s.Document.fromDouble(0.0d))), bytes.field[DefaultTest]("seventeen", _.seventeen).addHints(smithy.api.Default(smithy4s.Document.array())), boolean.field[DefaultTest]("eighteen", _.eighteen).addHints(smithy.api.Default(smithy4s.Document.fromBoolean(false))), - ){ - DefaultTest.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DefaultVariants.scala b/modules/bootstrapped/src/generated/smithy4s/example/DefaultVariants.scala index 190fc8f22..262c261f1 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/DefaultVariants.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/DefaultVariants.scala @@ -14,12 +14,13 @@ object DefaultVariants extends ShapeTag.Companion[DefaultVariants] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(req: String, reqDef: String, opt: Option[String], optDef: String): DefaultVariants = DefaultVariants(req, reqDef, optDef, opt) + implicit val schema: Schema[DefaultVariants] = struct( string.required[DefaultVariants]("req", _.req), string.required[DefaultVariants]("reqDef", _.reqDef).addHints(smithy.api.Default(smithy4s.Document.fromString("default"))), - string.field[DefaultVariants]("optDef", _.optDef).addHints(smithy.api.Default(smithy4s.Document.fromString("default"))), string.optional[DefaultVariants]("opt", _.opt), - ){ - DefaultVariants.apply - }.withId(id).addHints(hints) + string.field[DefaultVariants]("optDef", _.optDef).addHints(smithy.api.Default(smithy4s.Document.fromString("default"))), + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedStructure.scala b/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedStructure.scala index 468eb6fe0..5016854e6 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedStructure.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedStructure.scala @@ -17,12 +17,13 @@ object DeprecatedStructure extends ShapeTag.Companion[DeprecatedStructure] { smithy.api.Deprecated(message = Some("A compelling reason"), since = Some("0.0.1")), ).lazily + // constructor using the original order from the spec + private def make(strings: Option[List[String]], other: Option[List[String]], name: Option[String], nameV2: Option[String]): DeprecatedStructure = DeprecatedStructure(strings, other, name, nameV2) + implicit val schema: Schema[DeprecatedStructure] = struct( Strings.underlyingSchema.optional[DeprecatedStructure]("strings", _.strings).addHints(smithy.api.Deprecated(message = None, since = None)), Strings.underlyingSchema.optional[DeprecatedStructure]("other", _.other), string.optional[DeprecatedStructure]("name", _.name).addHints(smithy.api.Deprecated(message = None, since = None)), string.optional[DeprecatedStructure]("nameV2", _.nameV2), - ){ - DeprecatedStructure.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedUnion.scala b/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedUnion.scala index d59b88972..4e8080a68 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedUnion.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/DeprecatedUnion.scala @@ -58,6 +58,7 @@ object DeprecatedUnion extends ShapeTag.Companion[DeprecatedUnion] { smithy.api.Deprecated(message = None, since = None), ).lazily + implicit val schema: Schema[DeprecatedUnionProductCase] = constant(DeprecatedUnionProductCase()).withId(id).addHints(hints) val alt = schema.oneOf[DeprecatedUnion]("p") @@ -74,6 +75,7 @@ object DeprecatedUnion extends ShapeTag.Companion[DeprecatedUnion] { smithy.api.Deprecated(message = None, since = None), ).lazily + implicit val schema: Schema[UnionProductCaseDeprecatedAtCallSite] = constant(UnionProductCaseDeprecatedAtCallSite()).withId(id).addHints(hints) val alt = schema.oneOf[DeprecatedUnion]("p2") diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DocTest.scala b/modules/bootstrapped/src/generated/smithy4s/example/DocTest.scala index 455b0605f..54f5b6f39 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/DocTest.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/DocTest.scala @@ -18,5 +18,6 @@ object DocTest extends ShapeTag.Companion[DocTest] { smithy.api.Documentation("Test if an at-sign is rendered appropriately\n@test"), ).lazily + implicit val schema: Schema[DocTest] = constant(DocTest()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/DocumentationComment.scala b/modules/bootstrapped/src/generated/smithy4s/example/DocumentationComment.scala index 845e500dd..1095f0431 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/DocumentationComment.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/DocumentationComment.scala @@ -20,9 +20,10 @@ object DocumentationComment extends ShapeTag.Companion[DocumentationComment] { smithy.api.Documentation("We should be able to use comments in documentation /* */"), ).lazily + // constructor using the original order from the spec + private def make(member: Option[String]): DocumentationComment = DocumentationComment(member) + implicit val schema: Schema[DocumentationComment] = struct( string.optional[DocumentationComment]("member", _.member).addHints(smithy.api.Documentation("/*")), - ){ - DocumentationComment.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/EHFallbackClientError.scala b/modules/bootstrapped/src/generated/smithy4s/example/EHFallbackClientError.scala index e4d8b452f..40e8aa7ce 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/EHFallbackClientError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/EHFallbackClientError.scala @@ -19,9 +19,10 @@ object EHFallbackClientError extends ShapeTag.Companion[EHFallbackClientError] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): EHFallbackClientError = EHFallbackClientError(message) + implicit val schema: Schema[EHFallbackClientError] = struct( string.optional[EHFallbackClientError]("message", _.message), - ){ - EHFallbackClientError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/EHFallbackServerError.scala b/modules/bootstrapped/src/generated/smithy4s/example/EHFallbackServerError.scala index cf29ba67e..441901fab 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/EHFallbackServerError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/EHFallbackServerError.scala @@ -19,9 +19,10 @@ object EHFallbackServerError extends ShapeTag.Companion[EHFallbackServerError] { smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): EHFallbackServerError = EHFallbackServerError(message) + implicit val schema: Schema[EHFallbackServerError] = struct( string.optional[EHFallbackServerError]("message", _.message), - ){ - EHFallbackServerError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/EHNotFound.scala b/modules/bootstrapped/src/generated/smithy4s/example/EHNotFound.scala index 13da18b51..fd9a3f468 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/EHNotFound.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/EHNotFound.scala @@ -20,9 +20,10 @@ object EHNotFound extends ShapeTag.Companion[EHNotFound] { smithy.api.HttpError(404), ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): EHNotFound = EHNotFound(message) + implicit val schema: Schema[EHNotFound] = struct( string.optional[EHNotFound]("message", _.message), - ){ - EHNotFound.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/EHServiceUnavailable.scala b/modules/bootstrapped/src/generated/smithy4s/example/EHServiceUnavailable.scala index 6b92be906..896f71a0d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/EHServiceUnavailable.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/EHServiceUnavailable.scala @@ -20,9 +20,10 @@ object EHServiceUnavailable extends ShapeTag.Companion[EHServiceUnavailable] { smithy.api.HttpError(503), ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): EHServiceUnavailable = EHServiceUnavailable(message) + implicit val schema: Schema[EHServiceUnavailable] = struct( string.optional[EHServiceUnavailable]("message", _.message), - ){ - EHServiceUnavailable.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/EchoBody.scala b/modules/bootstrapped/src/generated/smithy4s/example/EchoBody.scala index 24610a848..2aeb84a5f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/EchoBody.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/EchoBody.scala @@ -14,9 +14,10 @@ object EchoBody extends ShapeTag.Companion[EchoBody] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(data: Option[String]): EchoBody = EchoBody(data) + implicit val schema: Schema[EchoBody] = struct( string.validated(smithy.api.Length(min = Some(10L), max = None)).optional[EchoBody]("data", _.data), - ){ - EchoBody.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/EchoInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/EchoInput.scala index d0163a892..e9f8952df 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/EchoInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/EchoInput.scala @@ -14,11 +14,12 @@ object EchoInput extends ShapeTag.Companion[EchoInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(pathParam: String, queryParam: Option[String], body: EchoBody): EchoInput = EchoInput(pathParam, body, queryParam) + implicit val schema: Schema[EchoInput] = struct( string.validated(smithy.api.Length(min = Some(10L), max = None)).required[EchoInput]("pathParam", _.pathParam).addHints(smithy.api.HttpLabel()), - EchoBody.schema.required[EchoInput]("body", _.body).addHints(smithy.api.HttpPayload()), string.validated(smithy.api.Length(min = Some(10L), max = None)).optional[EchoInput]("queryParam", _.queryParam).addHints(smithy.api.HttpQuery("queryParam")), - ){ - EchoInput.apply - }.withId(id).addHints(hints) + EchoBody.schema.required[EchoInput]("body", _.body).addHints(smithy.api.HttpPayload()), + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/EnvVarString.scala b/modules/bootstrapped/src/generated/smithy4s/example/EnvVarString.scala index d801b8587..2e9bc526a 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/EnvVarString.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/EnvVarString.scala @@ -20,9 +20,10 @@ object EnvVarString extends ShapeTag.Companion[EnvVarString] { smithy.api.Documentation(s"This is meant to be used with $${ENV_VAR}"), ).lazily + // constructor using the original order from the spec + private def make(member: Option[String]): EnvVarString = EnvVarString(member) + implicit val schema: Schema[EnvVarString] = struct( string.optional[EnvVarString]("member", _.member).addHints(smithy.api.Documentation(s"This is meant to be used with $$ENV_VAR")), - ){ - EnvVarString.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorCustomTypeMessage.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorCustomTypeMessage.scala index 1cabf17e6..fa81d91a0 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorCustomTypeMessage.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorCustomTypeMessage.scala @@ -18,9 +18,10 @@ object ErrorCustomTypeMessage extends ShapeTag.Companion[ErrorCustomTypeMessage] smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Option[CustomErrorMessageType]): ErrorCustomTypeMessage = ErrorCustomTypeMessage(message) + implicit val schema: Schema[ErrorCustomTypeMessage] = struct( CustomErrorMessageType.schema.optional[ErrorCustomTypeMessage]("message", _.message), - ){ - ErrorCustomTypeMessage.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorCustomTypeRequiredMessage.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorCustomTypeRequiredMessage.scala index 0a1b0b585..fde6e1f77 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorCustomTypeRequiredMessage.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorCustomTypeRequiredMessage.scala @@ -18,9 +18,10 @@ object ErrorCustomTypeRequiredMessage extends ShapeTag.Companion[ErrorCustomType smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(message: CustomErrorMessageType): ErrorCustomTypeRequiredMessage = ErrorCustomTypeRequiredMessage(message) + implicit val schema: Schema[ErrorCustomTypeRequiredMessage] = struct( CustomErrorMessageType.schema.required[ErrorCustomTypeRequiredMessage]("message", _.message), - ){ - ErrorCustomTypeRequiredMessage.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingOperationInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingOperationInput.scala index 26727a182..42a5f4f4a 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingOperationInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingOperationInput.scala @@ -16,9 +16,10 @@ object ErrorHandlingOperationInput extends ShapeTag.Companion[ErrorHandlingOpera smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(in: Option[String]): ErrorHandlingOperationInput = ErrorHandlingOperationInput(in) + implicit val schema: Schema[ErrorHandlingOperationInput] = struct( string.optional[ErrorHandlingOperationInput]("in", _.in), - ){ - ErrorHandlingOperationInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingOperationOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingOperationOutput.scala index 8c668a281..1ca1a71d7 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingOperationOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorHandlingOperationOutput.scala @@ -16,9 +16,10 @@ object ErrorHandlingOperationOutput extends ShapeTag.Companion[ErrorHandlingOper smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(out: Option[String]): ErrorHandlingOperationOutput = ErrorHandlingOperationOutput(out) + implicit val schema: Schema[ErrorHandlingOperationOutput] = struct( string.optional[ErrorHandlingOperationOutput]("out", _.out), - ){ - ErrorHandlingOperationOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableCustomTypeMessage.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableCustomTypeMessage.scala index f5431a084..94150c679 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableCustomTypeMessage.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableCustomTypeMessage.scala @@ -19,9 +19,10 @@ object ErrorNullableCustomTypeMessage extends ShapeTag.Companion[ErrorNullableCu smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Option[Nullable[CustomErrorMessageType]]): ErrorNullableCustomTypeMessage = ErrorNullableCustomTypeMessage(message) + implicit val schema: Schema[ErrorNullableCustomTypeMessage] = struct( CustomErrorMessageType.schema.nullable.optional[ErrorNullableCustomTypeMessage]("message", _.message), - ){ - ErrorNullableCustomTypeMessage.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableCustomTypeRequiredMessage.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableCustomTypeRequiredMessage.scala index 5985d5473..3f1d27809 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableCustomTypeRequiredMessage.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableCustomTypeRequiredMessage.scala @@ -19,9 +19,10 @@ object ErrorNullableCustomTypeRequiredMessage extends ShapeTag.Companion[ErrorNu smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Nullable[CustomErrorMessageType]): ErrorNullableCustomTypeRequiredMessage = ErrorNullableCustomTypeRequiredMessage(message) + implicit val schema: Schema[ErrorNullableCustomTypeRequiredMessage] = struct( CustomErrorMessageType.schema.nullable.required[ErrorNullableCustomTypeRequiredMessage]("message", _.message), - ){ - ErrorNullableCustomTypeRequiredMessage.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableMessage.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableMessage.scala index ddf3e2dd8..98b55be67 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableMessage.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableMessage.scala @@ -20,9 +20,10 @@ object ErrorNullableMessage extends ShapeTag.Companion[ErrorNullableMessage] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Option[Nullable[String]]): ErrorNullableMessage = ErrorNullableMessage(message) + implicit val schema: Schema[ErrorNullableMessage] = struct( string.nullable.optional[ErrorNullableMessage]("message", _.message), - ){ - ErrorNullableMessage.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableRequiredMessage.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableRequiredMessage.scala index 9f1e55f24..0a61bc849 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableRequiredMessage.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorNullableRequiredMessage.scala @@ -20,9 +20,10 @@ object ErrorNullableRequiredMessage extends ShapeTag.Companion[ErrorNullableRequ smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Nullable[String]): ErrorNullableRequiredMessage = ErrorNullableRequiredMessage(message) + implicit val schema: Schema[ErrorNullableRequiredMessage] = struct( string.nullable.required[ErrorNullableRequiredMessage]("message", _.message), - ){ - ErrorNullableRequiredMessage.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ErrorRequiredMessage.scala b/modules/bootstrapped/src/generated/smithy4s/example/ErrorRequiredMessage.scala index f34c204b6..4cf9f5f91 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ErrorRequiredMessage.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ErrorRequiredMessage.scala @@ -19,9 +19,10 @@ object ErrorRequiredMessage extends ShapeTag.Companion[ErrorRequiredMessage] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(message: String): ErrorRequiredMessage = ErrorRequiredMessage(message) + implicit val schema: Schema[ErrorRequiredMessage] = struct( string.required[ErrorRequiredMessage]("message", _.message), - ){ - ErrorRequiredMessage.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ExtraErrorOperationInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/ExtraErrorOperationInput.scala index 8fd1c4ff3..a6913112e 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ExtraErrorOperationInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ExtraErrorOperationInput.scala @@ -16,9 +16,10 @@ object ExtraErrorOperationInput extends ShapeTag.Companion[ExtraErrorOperationIn smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(in: Option[String]): ExtraErrorOperationInput = ExtraErrorOperationInput(in) + implicit val schema: Schema[ExtraErrorOperationInput] = struct( string.optional[ExtraErrorOperationInput]("in", _.in), - ){ - ExtraErrorOperationInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/FallbackError.scala b/modules/bootstrapped/src/generated/smithy4s/example/FallbackError.scala index 40fe9470e..722bd8106 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/FallbackError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/FallbackError.scala @@ -18,9 +18,10 @@ object FallbackError extends ShapeTag.Companion[FallbackError] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(error: String): FallbackError = FallbackError(error) + implicit val schema: Schema[FallbackError] = struct( string.required[FallbackError]("error", _.error), - ){ - FallbackError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/FallbackError2.scala b/modules/bootstrapped/src/generated/smithy4s/example/FallbackError2.scala index da732a725..c73619a50 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/FallbackError2.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/FallbackError2.scala @@ -18,9 +18,10 @@ object FallbackError2 extends ShapeTag.Companion[FallbackError2] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(error: String): FallbackError2 = FallbackError2(error) + implicit val schema: Schema[FallbackError2] = struct( string.required[FallbackError2]("error", _.error), - ){ - FallbackError2.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/FancyListFormat.scala b/modules/bootstrapped/src/generated/smithy4s/example/FancyListFormat.scala index 7cfbb139c..abd0b7648 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/FancyListFormat.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/FancyListFormat.scala @@ -15,5 +15,6 @@ object FancyListFormat extends ShapeTag.Companion[FancyListFormat] { smithy.api.Trait(selector = Some("list:test(> member > string)"), structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + implicit val schema: Schema[FancyListFormat] = constant(FancyListFormat()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Four.scala b/modules/bootstrapped/src/generated/smithy4s/example/Four.scala index 21871e44e..d54de4517 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Four.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Four.scala @@ -14,9 +14,10 @@ object Four extends ShapeTag.Companion[Four] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(four: Int): Four = Four(four) + implicit val schema: Schema[Four] = struct( int.required[Four]("four", _.four), - ){ - Four.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GenericClientError.scala b/modules/bootstrapped/src/generated/smithy4s/example/GenericClientError.scala index 681558f0c..07ffb2a3a 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GenericClientError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GenericClientError.scala @@ -20,9 +20,10 @@ object GenericClientError extends ShapeTag.Companion[GenericClientError] { smithy.api.HttpError(418), ).lazily + // constructor using the original order from the spec + private def make(message: String): GenericClientError = GenericClientError(message) + implicit val schema: Schema[GenericClientError] = struct( string.required[GenericClientError]("message", _.message), - ){ - GenericClientError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GenericServerError.scala b/modules/bootstrapped/src/generated/smithy4s/example/GenericServerError.scala index 1ec2364f3..36045febe 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GenericServerError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GenericServerError.scala @@ -20,9 +20,10 @@ object GenericServerError extends ShapeTag.Companion[GenericServerError] { smithy.api.HttpError(502), ).lazily + // constructor using the original order from the spec + private def make(message: String): GenericServerError = GenericServerError(message) + implicit val schema: Schema[GenericServerError] = struct( string.required[GenericServerError]("message", _.message), - ){ - GenericServerError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetCityInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetCityInput.scala index 1691ad67e..6e3122679 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetCityInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetCityInput.scala @@ -18,9 +18,10 @@ object GetCityInput extends ShapeTag.Companion[GetCityInput] { val cityId: Lens[GetCityInput, CityId] = Lens[GetCityInput, CityId](_.cityId)(n => a => a.copy(cityId = n)) } + // constructor using the original order from the spec + private def make(cityId: CityId): GetCityInput = GetCityInput(cityId) + implicit val schema: Schema[GetCityInput] = struct( CityId.schema.required[GetCityInput]("cityId", _.cityId), - ){ - GetCityInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetCityOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetCityOutput.scala index 4c087dd66..84ff8b39c 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetCityOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetCityOutput.scala @@ -14,10 +14,11 @@ object GetCityOutput extends ShapeTag.Companion[GetCityOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(name: String, coordinates: CityCoordinates): GetCityOutput = GetCityOutput(name, coordinates) + implicit val schema: Schema[GetCityOutput] = struct( string.required[GetCityOutput]("name", _.name), CityCoordinates.schema.required[GetCityOutput]("coordinates", _.coordinates), - ){ - GetCityOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetCurrentTimeOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetCurrentTimeOutput.scala index 7b8723d43..b38a66e0b 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetCurrentTimeOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetCurrentTimeOutput.scala @@ -15,9 +15,10 @@ object GetCurrentTimeOutput extends ShapeTag.Companion[GetCurrentTimeOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(time: Timestamp): GetCurrentTimeOutput = GetCurrentTimeOutput(time) + implicit val schema: Schema[GetCurrentTimeOutput] = struct( timestamp.required[GetCurrentTimeOutput]("time", _.time), - ){ - GetCurrentTimeOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetEnumInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetEnumInput.scala index e9f0a8d9a..1536de7e2 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetEnumInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetEnumInput.scala @@ -13,9 +13,10 @@ object GetEnumInput extends ShapeTag.Companion[GetEnumInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(aa: TheEnum): GetEnumInput = GetEnumInput(aa) + implicit val schema: Schema[GetEnumInput] = struct( TheEnum.schema.required[GetEnumInput]("aa", _.aa).addHints(smithy.api.HttpLabel()), - ){ - GetEnumInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetEnumOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetEnumOutput.scala index 595cb77ed..ef064c2cf 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetEnumOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetEnumOutput.scala @@ -14,9 +14,10 @@ object GetEnumOutput extends ShapeTag.Companion[GetEnumOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(result: Option[String]): GetEnumOutput = GetEnumOutput(result) + implicit val schema: Schema[GetEnumOutput] = struct( string.optional[GetEnumOutput]("result", _.result), - ){ - GetEnumOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetFooOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetFooOutput.scala index 08ec2f5af..4c6eaf208 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetFooOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetFooOutput.scala @@ -18,9 +18,10 @@ object GetFooOutput extends ShapeTag.Companion[GetFooOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(foo: Option[Foo]): GetFooOutput = GetFooOutput(foo) + implicit val schema: Schema[GetFooOutput] = struct( Foo.schema.optional[GetFooOutput]("foo", _.foo), - ){ - GetFooOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetForecastInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetForecastInput.scala index 00da55b89..5b1365ff4 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetForecastInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetForecastInput.scala @@ -13,9 +13,10 @@ object GetForecastInput extends ShapeTag.Companion[GetForecastInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(cityId: CityId): GetForecastInput = GetForecastInput(cityId) + implicit val schema: Schema[GetForecastInput] = struct( CityId.schema.required[GetForecastInput]("cityId", _.cityId), - ){ - GetForecastInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetForecastOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetForecastOutput.scala index eb5b03951..9fa701868 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetForecastOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetForecastOutput.scala @@ -18,9 +18,10 @@ object GetForecastOutput extends ShapeTag.Companion[GetForecastOutput] { val forecast: Lens[GetForecastOutput, Option[ForecastResult]] = Lens[GetForecastOutput, Option[ForecastResult]](_.forecast)(n => a => a.copy(forecast = n)) } + // constructor using the original order from the spec + private def make(forecast: Option[ForecastResult]): GetForecastOutput = GetForecastOutput(forecast) + implicit val schema: Schema[GetForecastOutput] = struct( ForecastResult.schema.optional[GetForecastOutput]("forecast", _.forecast), - ){ - GetForecastOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetIntEnumInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetIntEnumInput.scala index 94a36e1f6..7c714e350 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetIntEnumInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetIntEnumInput.scala @@ -15,9 +15,10 @@ object GetIntEnumInput extends ShapeTag.Companion[GetIntEnumInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(aa: EnumResult): GetIntEnumInput = GetIntEnumInput(aa) + implicit val schema: Schema[GetIntEnumInput] = struct( EnumResult.schema.required[GetIntEnumInput]("aa", _.aa).addHints(smithy.api.HttpLabel()), - ){ - GetIntEnumInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetIntEnumOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetIntEnumOutput.scala index 427d909e4..287a8bd7e 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetIntEnumOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetIntEnumOutput.scala @@ -15,9 +15,10 @@ object GetIntEnumOutput extends ShapeTag.Companion[GetIntEnumOutput] { smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(result: EnumResult): GetIntEnumOutput = GetIntEnumOutput(result) + implicit val schema: Schema[GetIntEnumOutput] = struct( EnumResult.schema.required[GetIntEnumOutput]("result", _.result), - ){ - GetIntEnumOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetMenuRequest.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetMenuRequest.scala index db8f99667..a43ac4351 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetMenuRequest.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetMenuRequest.scala @@ -14,9 +14,10 @@ object GetMenuRequest extends ShapeTag.Companion[GetMenuRequest] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(restaurant: String): GetMenuRequest = GetMenuRequest(restaurant) + implicit val schema: Schema[GetMenuRequest] = struct( string.required[GetMenuRequest]("restaurant", _.restaurant).addHints(smithy.api.HttpLabel()), - ){ - GetMenuRequest.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetMenuResult.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetMenuResult.scala index 32f1da46a..f94913cdb 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetMenuResult.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetMenuResult.scala @@ -13,9 +13,10 @@ object GetMenuResult extends ShapeTag.Companion[GetMenuResult] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(menu: Map[String, MenuItem]): GetMenuResult = GetMenuResult(menu) + implicit val schema: Schema[GetMenuResult] = struct( Menu.underlyingSchema.required[GetMenuResult]("menu", _.menu).addHints(smithy.api.HttpPayload()), - ){ - GetMenuResult.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetObjectInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetObjectInput.scala index d8f4f8dde..a226df6c1 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetObjectInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetObjectInput.scala @@ -26,10 +26,11 @@ object GetObjectInput extends ShapeTag.Companion[GetObjectInput] { smithy.api.Documentation("Input for getting an Object\nall fields are required\nand are given through HTTP labels\nSee https://smithy.io/2.0/spec/http-bindings.html?highlight=httppayload#http-uri-label"), ).lazily + // constructor using the original order from the spec + private def make(key: ObjectKey, bucketName: BucketName): GetObjectInput = GetObjectInput(key, bucketName) + implicit val schema: Schema[GetObjectInput] = struct( ObjectKey.schema.required[GetObjectInput]("key", _.key).addHints(smithy.api.Documentation("Sent in the URI label named \"key\".\nKey can also be seen as the filename\nIt is always required for a GET operation"), smithy.api.HttpLabel()), BucketName.schema.required[GetObjectInput]("bucketName", _.bucketName).addHints(smithy.api.Documentation("Sent in the URI label named \"bucketName\"."), smithy.api.HttpLabel()), - ){ - GetObjectInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetObjectOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetObjectOutput.scala index 642ee7084..824e52cf5 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetObjectOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetObjectOutput.scala @@ -14,10 +14,11 @@ object GetObjectOutput extends ShapeTag.Companion[GetObjectOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(size: ObjectSize, data: Option[String]): GetObjectOutput = GetObjectOutput(size, data) + implicit val schema: Schema[GetObjectOutput] = struct( ObjectSize.schema.required[GetObjectOutput]("size", _.size).addHints(smithy.api.HttpHeader("X-Size")), string.optional[GetObjectOutput]("data", _.data).addHints(smithy.api.HttpPayload()), - ){ - GetObjectOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetStreamedObjectInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetStreamedObjectInput.scala index a3b111877..528416385 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetStreamedObjectInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetStreamedObjectInput.scala @@ -14,9 +14,10 @@ object GetStreamedObjectInput extends ShapeTag.Companion[GetStreamedObjectInput] val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(key: String): GetStreamedObjectInput = GetStreamedObjectInput(key) + implicit val schema: Schema[GetStreamedObjectInput] = struct( string.required[GetStreamedObjectInput]("key", _.key), - ){ - GetStreamedObjectInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/GetStreamedObjectOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/GetStreamedObjectOutput.scala index 84339ff6f..1c7b9c6d3 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/GetStreamedObjectOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/GetStreamedObjectOutput.scala @@ -13,5 +13,6 @@ object GetStreamedObjectOutput extends ShapeTag.Companion[GetStreamedObjectOutpu val hints: Hints = Hints.empty + implicit val schema: Schema[GetStreamedObjectOutput] = constant(GetStreamedObjectOutput()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Hash.scala b/modules/bootstrapped/src/generated/smithy4s/example/Hash.scala index fa9630a69..4f0b7ed7d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Hash.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Hash.scala @@ -15,5 +15,6 @@ object Hash extends ShapeTag.Companion[Hash] { smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + implicit val schema: Schema[Hash] = constant(Hash()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/HeadRequestOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/HeadRequestOutput.scala index 5787aeb46..19d510ea6 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/HeadRequestOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/HeadRequestOutput.scala @@ -14,9 +14,10 @@ object HeadRequestOutput extends ShapeTag.Companion[HeadRequestOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(test: String): HeadRequestOutput = HeadRequestOutput(test) + implicit val schema: Schema[HeadRequestOutput] = struct( string.required[HeadRequestOutput]("test", _.test).addHints(smithy.api.HttpHeader("Test")), - ){ - HeadRequestOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/HeaderEndpointData.scala b/modules/bootstrapped/src/generated/smithy4s/example/HeaderEndpointData.scala index 7e4913cba..009621f35 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/HeaderEndpointData.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/HeaderEndpointData.scala @@ -14,12 +14,13 @@ object HeaderEndpointData extends ShapeTag.Companion[HeaderEndpointData] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(uppercaseHeader: Option[String], capitalizedHeader: Option[String], lowercaseHeader: Option[String], mixedHeader: Option[String]): HeaderEndpointData = HeaderEndpointData(uppercaseHeader, capitalizedHeader, lowercaseHeader, mixedHeader) + implicit val schema: Schema[HeaderEndpointData] = struct( string.optional[HeaderEndpointData]("uppercaseHeader", _.uppercaseHeader).addHints(smithy.api.HttpHeader("X-UPPERCASE-HEADER")), string.optional[HeaderEndpointData]("capitalizedHeader", _.capitalizedHeader).addHints(smithy.api.HttpHeader("X-Capitalized-Header")), string.optional[HeaderEndpointData]("lowercaseHeader", _.lowercaseHeader).addHints(smithy.api.HttpHeader("x-lowercase-header")), string.optional[HeaderEndpointData]("mixedHeader", _.mixedHeader).addHints(smithy.api.HttpHeader("x-MiXeD-hEaDEr")), - ){ - HeaderEndpointData.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/HeadersStruct.scala b/modules/bootstrapped/src/generated/smithy4s/example/HeadersStruct.scala index 195351dfa..e30a9db48 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/HeadersStruct.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/HeadersStruct.scala @@ -18,6 +18,9 @@ object HeadersStruct extends ShapeTag.Companion[HeadersStruct] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(str: Option[String], int: Option[Int], ts1: Option[Timestamp], ts2: Option[Timestamp], ts3: Option[Timestamp], ts4: Option[Timestamp], b: Option[Boolean], sl: Option[List[String]], ie: Option[Numbers], on: Option[OpenNums], ons: Option[OpenNumsStr], slm: Option[Map[String, String]]): HeadersStruct = HeadersStruct(str, int, ts1, ts2, ts3, ts4, b, sl, ie, on, ons, slm) + implicit val schema: Schema[HeadersStruct] = struct( string.optional[HeadersStruct]("str", _.str).addHints(smithy.api.HttpHeader("str")), int.optional[HeadersStruct]("int", _.int).addHints(smithy.api.HttpHeader("int")), @@ -31,7 +34,5 @@ object HeadersStruct extends ShapeTag.Companion[HeadersStruct] { OpenNums.schema.optional[HeadersStruct]("on", _.on).addHints(smithy.api.HttpHeader("openNums")), OpenNumsStr.schema.optional[HeadersStruct]("ons", _.ons).addHints(smithy.api.HttpHeader("openNumsStr")), StringMap.underlyingSchema.optional[HeadersStruct]("slm", _.slm).addHints(smithy.api.HttpPrefixHeaders("foo-")), - ){ - HeadersStruct.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/HeadersWithDefaults.scala b/modules/bootstrapped/src/generated/smithy4s/example/HeadersWithDefaults.scala index da79656e5..0bf3b427b 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/HeadersWithDefaults.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/HeadersWithDefaults.scala @@ -14,9 +14,10 @@ object HeadersWithDefaults extends ShapeTag.Companion[HeadersWithDefaults] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(dflt: String): HeadersWithDefaults = HeadersWithDefaults(dflt) + implicit val schema: Schema[HeadersWithDefaults] = struct( string.field[HeadersWithDefaults]("dflt", _.dflt).addHints(smithy.api.Default(smithy4s.Document.fromString("test")), smithy.api.HttpHeader("dflt")), - ){ - HeadersWithDefaults.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/HealthRequest.scala b/modules/bootstrapped/src/generated/smithy4s/example/HealthRequest.scala index bdd5ff029..b3c11385e 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/HealthRequest.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/HealthRequest.scala @@ -14,9 +14,10 @@ object HealthRequest extends ShapeTag.Companion[HealthRequest] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(query: Option[String]): HealthRequest = HealthRequest(query) + implicit val schema: Schema[HealthRequest] = struct( string.validated(smithy.api.Length(min = Some(0L), max = Some(5L))).optional[HealthRequest]("query", _.query).addHints(smithy.api.HttpQuery("query")), - ){ - HealthRequest.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/HealthResponse.scala b/modules/bootstrapped/src/generated/smithy4s/example/HealthResponse.scala index 5be00aabf..cefc9a3a7 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/HealthResponse.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/HealthResponse.scala @@ -16,9 +16,10 @@ object HealthResponse extends ShapeTag.Companion[HealthResponse] { smithy4s.example.FreeForm(smithy4s.Document.obj("i" -> smithy4s.Document.fromDouble(1.0d), "a" -> smithy4s.Document.fromDouble(2.0d))), ).lazily + // constructor using the original order from the spec + private def make(status: String): HealthResponse = HealthResponse(status) + implicit val schema: Schema[HealthResponse] = struct( string.required[HealthResponse]("status", _.status), - ){ - HealthResponse.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/HostLabelInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/HostLabelInput.scala index 9641541b5..18f463fd3 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/HostLabelInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/HostLabelInput.scala @@ -14,11 +14,12 @@ object HostLabelInput extends ShapeTag.Companion[HostLabelInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(label1: String, label2: String, label3: HostLabelEnum): HostLabelInput = HostLabelInput(label1, label2, label3) + implicit val schema: Schema[HostLabelInput] = struct( string.required[HostLabelInput]("label1", _.label1).addHints(smithy.api.HostLabel()), string.required[HostLabelInput]("label2", _.label2).addHints(smithy.api.HostLabel()), HostLabelEnum.schema.required[HostLabelInput]("label3", _.label3).addHints(smithy.api.HostLabel()), - ){ - HostLabelInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/IntList.scala b/modules/bootstrapped/src/generated/smithy4s/example/IntList.scala index 664294cea..d0fc634f7 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/IntList.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/IntList.scala @@ -15,10 +15,11 @@ object IntList extends ShapeTag.Companion[IntList] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(head: Int, tail: Option[smithy4s.example.IntList]): IntList = IntList(head, tail) + implicit val schema: Schema[IntList] = recursive(struct( int.required[IntList]("head", _.head), smithy4s.example.IntList.schema.optional[IntList]("tail", _.tail), - ){ - IntList.apply - }.withId(id).addHints(hints)) + )(make).withId(id).addHints(hints)) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Key.scala b/modules/bootstrapped/src/generated/smithy4s/example/Key.scala index 8c897d925..258345f79 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Key.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Key.scala @@ -14,9 +14,10 @@ object Key extends ShapeTag.Companion[Key] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(key: String): Key = Key(key) + implicit val schema: Schema[Key] = struct( string.required[Key]("key", _.key), - ){ - Key.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/KeyNotFoundError.scala b/modules/bootstrapped/src/generated/smithy4s/example/KeyNotFoundError.scala index 8b63244af..50d0f6e52 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/KeyNotFoundError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/KeyNotFoundError.scala @@ -19,9 +19,10 @@ object KeyNotFoundError extends ShapeTag.Companion[KeyNotFoundError] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(message: String): KeyNotFoundError = KeyNotFoundError(message) + implicit val schema: Schema[KeyNotFoundError] = struct( string.required[KeyNotFoundError]("message", _.message), - ){ - KeyNotFoundError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/KeyValue.scala b/modules/bootstrapped/src/generated/smithy4s/example/KeyValue.scala index 1d9e04d0f..5e348ec03 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/KeyValue.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/KeyValue.scala @@ -14,10 +14,11 @@ object KeyValue extends ShapeTag.Companion[KeyValue] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(key: String, value: String): KeyValue = KeyValue(key, value) + implicit val schema: Schema[KeyValue] = struct( string.required[KeyValue]("key", _.key), string.required[KeyValue]("value", _.value), - ){ - KeyValue.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ListCitiesInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/ListCitiesInput.scala index 91792fa2e..a15fe762f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ListCitiesInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ListCitiesInput.scala @@ -15,10 +15,11 @@ object ListCitiesInput extends ShapeTag.Companion[ListCitiesInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(nextToken: Option[String], pageSize: Option[Int]): ListCitiesInput = ListCitiesInput(nextToken, pageSize) + implicit val schema: Schema[ListCitiesInput] = struct( string.optional[ListCitiesInput]("nextToken", _.nextToken), int.optional[ListCitiesInput]("pageSize", _.pageSize), - ){ - ListCitiesInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ListCitiesOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/ListCitiesOutput.scala index a454076d7..c9e25e80f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ListCitiesOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ListCitiesOutput.scala @@ -14,10 +14,11 @@ object ListCitiesOutput extends ShapeTag.Companion[ListCitiesOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(nextToken: Option[String], items: List[CitySummary]): ListCitiesOutput = ListCitiesOutput(items, nextToken) + implicit val schema: Schema[ListCitiesOutput] = struct( - CitySummaries.underlyingSchema.required[ListCitiesOutput]("items", _.items), string.optional[ListCitiesOutput]("nextToken", _.nextToken), - ){ - ListCitiesOutput.apply - }.withId(id).addHints(hints) + CitySummaries.underlyingSchema.required[ListCitiesOutput]("items", _.items), + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ListPublishersOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/ListPublishersOutput.scala index 84e2ca088..386a71d1c 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ListPublishersOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ListPublishersOutput.scala @@ -15,9 +15,10 @@ object ListPublishersOutput extends ShapeTag.Companion[ListPublishersOutput] { smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(publishers: List[PublisherId]): ListPublishersOutput = ListPublishersOutput(publishers) + implicit val schema: Schema[ListPublishersOutput] = struct( PublishersList.underlyingSchema.required[ListPublishersOutput]("publishers", _.publishers), - ){ - ListPublishersOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/MenuItem.scala b/modules/bootstrapped/src/generated/smithy4s/example/MenuItem.scala index 17021371c..90cc511aa 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/MenuItem.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/MenuItem.scala @@ -14,10 +14,11 @@ object MenuItem extends ShapeTag.Companion[MenuItem] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(food: Food, price: Float): MenuItem = MenuItem(food, price) + implicit val schema: Schema[MenuItem] = struct( Food.schema.required[MenuItem]("food", _.food), float.required[MenuItem]("price", _.price), - ){ - MenuItem.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/MixinErrorExample.scala b/modules/bootstrapped/src/generated/smithy4s/example/MixinErrorExample.scala index 5e829af09..16b55137a 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/MixinErrorExample.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/MixinErrorExample.scala @@ -21,12 +21,13 @@ object MixinErrorExample extends ShapeTag.Companion[MixinErrorExample] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(a: Option[String], b: Option[Int], c: Option[Long], d: Option[Boolean]): MixinErrorExample = MixinErrorExample(a, b, c, d) + implicit val schema: Schema[MixinErrorExample] = struct( string.optional[MixinErrorExample]("a", _.a), int.optional[MixinErrorExample]("b", _.b), long.optional[MixinErrorExample]("c", _.c), boolean.optional[MixinErrorExample]("d", _.d), - ){ - MixinErrorExample.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/MixinExample.scala b/modules/bootstrapped/src/generated/smithy4s/example/MixinExample.scala index 7ddd988ba..4e5aaeb1e 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/MixinExample.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/MixinExample.scala @@ -17,12 +17,13 @@ object MixinExample extends ShapeTag.Companion[MixinExample] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(a: Option[String], b: Option[Int], c: Option[Long], d: Option[Boolean]): MixinExample = MixinExample(a, b, c, d) + implicit val schema: Schema[MixinExample] = struct( string.optional[MixinExample]("a", _.a), int.optional[MixinExample]("b", _.b), long.optional[MixinExample]("c", _.c), boolean.optional[MixinExample]("d", _.d), - ){ - MixinExample.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/MixinOptionalMemberDefaultAdded.scala b/modules/bootstrapped/src/generated/smithy4s/example/MixinOptionalMemberDefaultAdded.scala index 875e67644..67f33e1f5 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/MixinOptionalMemberDefaultAdded.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/MixinOptionalMemberDefaultAdded.scala @@ -14,9 +14,10 @@ object MixinOptionalMemberDefaultAdded extends ShapeTag.Companion[MixinOptionalM val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(a: String): MixinOptionalMemberDefaultAdded = MixinOptionalMemberDefaultAdded(a) + implicit val schema: Schema[MixinOptionalMemberDefaultAdded] = struct( string.field[MixinOptionalMemberDefaultAdded]("a", _.a).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), - ){ - MixinOptionalMemberDefaultAdded.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/MixinOptionalMemberOverride.scala b/modules/bootstrapped/src/generated/smithy4s/example/MixinOptionalMemberOverride.scala index 720b41ff2..3db9db9ee 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/MixinOptionalMemberOverride.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/MixinOptionalMemberOverride.scala @@ -14,9 +14,10 @@ object MixinOptionalMemberOverride extends ShapeTag.Companion[MixinOptionalMembe val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(a: String): MixinOptionalMemberOverride = MixinOptionalMemberOverride(a) + implicit val schema: Schema[MixinOptionalMemberOverride] = struct( string.required[MixinOptionalMemberOverride]("a", _.a), - ){ - MixinOptionalMemberOverride.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/MovieTheater.scala b/modules/bootstrapped/src/generated/smithy4s/example/MovieTheater.scala index cfaf4ada5..4053c4a40 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/MovieTheater.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/MovieTheater.scala @@ -17,11 +17,12 @@ object MovieTheater extends ShapeTag.Companion[MovieTheater] { smithy4s.example.Hash(), ).lazily + // constructor using the original order from the spec + private def make(name: Option[String]): MovieTheater = MovieTheater(name) + implicit val schema: Schema[MovieTheater] = struct( string.optional[MovieTheater]("name", _.name), - ){ - MovieTheater.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) implicit val movieTheaterHash: cats.Hash[MovieTheater] = SchemaVisitorHash.fromSchema(schema) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/MyOpError.scala b/modules/bootstrapped/src/generated/smithy4s/example/MyOpError.scala index daf8341af..b6cc35f80 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/MyOpError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/MyOpError.scala @@ -17,5 +17,6 @@ object MyOpError extends ShapeTag.Companion[MyOpError] { smithy.api.Error.CLIENT.widen, ).lazily + implicit val schema: Schema[MyOpError] = constant(MyOpError()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/NameFormat.scala b/modules/bootstrapped/src/generated/smithy4s/example/NameFormat.scala index 47985e22b..6786997b5 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/NameFormat.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/NameFormat.scala @@ -15,5 +15,6 @@ object NameFormat extends ShapeTag.Companion[NameFormat] { smithy.api.Trait(selector = Some("string"), structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + implicit val schema: Schema[NameFormat] = constant(NameFormat()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/NoMoreSpace.scala b/modules/bootstrapped/src/generated/smithy4s/example/NoMoreSpace.scala index 233f9f689..04a99f106 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/NoMoreSpace.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/NoMoreSpace.scala @@ -25,10 +25,11 @@ object NoMoreSpace extends ShapeTag.Companion[NoMoreSpace] { smithy.api.HttpError(507), ).lazily + // constructor using the original order from the spec + private def make(message: String, foo: Option[Foo]): NoMoreSpace = NoMoreSpace(message, foo) + implicit val schema: Schema[NoMoreSpace] = struct( string.required[NoMoreSpace]("message", _.message), Foo.schema.optional[NoMoreSpace]("foo", _.foo), - ){ - NoMoreSpace.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/NoSuchResource.scala b/modules/bootstrapped/src/generated/smithy4s/example/NoSuchResource.scala index dc0c46dd7..107b9581e 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/NoSuchResource.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/NoSuchResource.scala @@ -18,9 +18,10 @@ object NoSuchResource extends ShapeTag.Companion[NoSuchResource] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(resourceType: String): NoSuchResource = NoSuchResource(resourceType) + implicit val schema: Schema[NoSuchResource] = struct( string.required[NoSuchResource]("resourceType", _.resourceType), - ){ - NoSuchResource.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/NonEmptyListFormat.scala b/modules/bootstrapped/src/generated/smithy4s/example/NonEmptyListFormat.scala index c8d5d0be9..26bb31475 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/NonEmptyListFormat.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/NonEmptyListFormat.scala @@ -15,5 +15,6 @@ object NonEmptyListFormat extends ShapeTag.Companion[NonEmptyListFormat] { smithy.api.Trait(selector = Some("list"), structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + implicit val schema: Schema[NonEmptyListFormat] = constant(NonEmptyListFormat()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/NonEmptyMapFormat.scala b/modules/bootstrapped/src/generated/smithy4s/example/NonEmptyMapFormat.scala index eda0b05aa..be005727d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/NonEmptyMapFormat.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/NonEmptyMapFormat.scala @@ -15,5 +15,6 @@ object NonEmptyMapFormat extends ShapeTag.Companion[NonEmptyMapFormat] { smithy.api.Trait(selector = Some("map"), structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + implicit val schema: Schema[NonEmptyMapFormat] = constant(NonEmptyMapFormat()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/NotFoundError.scala b/modules/bootstrapped/src/generated/smithy4s/example/NotFoundError.scala index 5a638aef3..05355370e 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/NotFoundError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/NotFoundError.scala @@ -19,9 +19,10 @@ object NotFoundError extends ShapeTag.Companion[NotFoundError] { smithy.api.HttpError(404), ).lazily + // constructor using the original order from the spec + private def make(name: String): NotFoundError = NotFoundError(name) + implicit val schema: Schema[NotFoundError] = struct( string.required[NotFoundError]("name", _.name), - ){ - NotFoundError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Numeric.scala b/modules/bootstrapped/src/generated/smithy4s/example/Numeric.scala index 8994a6dea..ad8ffef6e 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Numeric.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Numeric.scala @@ -20,6 +20,9 @@ object Numeric extends ShapeTag.Companion[Numeric] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(i: Int, f: Float, d: Double, s: Short, l: Long, bi: BigInt, bd: BigDecimal): Numeric = Numeric(i, f, d, s, l, bi, bd) + implicit val schema: Schema[Numeric] = struct( int.field[Numeric]("i", _.i).addHints(smithy.api.Default(smithy4s.Document.fromDouble(1.0d))), float.field[Numeric]("f", _.f).addHints(smithy.api.Default(smithy4s.Document.fromDouble(1.0d))), @@ -28,7 +31,5 @@ object Numeric extends ShapeTag.Companion[Numeric] { long.field[Numeric]("l", _.l).addHints(smithy.api.Default(smithy4s.Document.fromDouble(1.0d))), bigint.field[Numeric]("bi", _.bi).addHints(smithy.api.Default(smithy4s.Document.fromDouble(1.0d))), bigdecimal.field[Numeric]("bd", _.bd).addHints(smithy.api.Default(smithy4s.Document.fromDouble(1.0d))), - ){ - Numeric.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/One.scala b/modules/bootstrapped/src/generated/smithy4s/example/One.scala index db79d736a..fd37a688a 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/One.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/One.scala @@ -14,9 +14,10 @@ object One extends ShapeTag.Companion[One] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(value: Option[String]): One = One(value) + implicit val schema: Schema[One] = struct( string.optional[One]("value", _.value), - ){ - One.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/OperationInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/OperationInput.scala index 6640a2556..6a6f0b704 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/OperationInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/OperationInput.scala @@ -16,18 +16,19 @@ object OperationInput extends ShapeTag.Companion[OperationInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(optional: Option[String], optionalWithDefault: String, requiredLabel: String, requiredWithDefault: String, optionalHeader: Option[String], optionalHeaderWithDefault: String, requiredHeaderWithDefault: String, optionalQuery: Option[String], optionalQueryWithDefault: String, requiredQueryWithDefault: String): OperationInput = OperationInput(optionalWithDefault, requiredLabel, requiredWithDefault, optionalHeaderWithDefault, requiredHeaderWithDefault, optionalQueryWithDefault, requiredQueryWithDefault, optional, optionalHeader, optionalQuery) + implicit val schema: Schema[OperationInput] = struct( + string.optional[OperationInput]("optional", _.optional), string.field[OperationInput]("optionalWithDefault", _.optionalWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("optional-default"))), string.required[OperationInput]("requiredLabel", _.requiredLabel).addHints(smithy.api.Default(smithy4s.Document.fromString("required-label-with-default")), smithy.api.HttpLabel()), string.required[OperationInput]("requiredWithDefault", _.requiredWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("required-default"))), + string.optional[OperationInput]("optionalHeader", _.optionalHeader).addHints(smithy.api.HttpHeader("optional-header")), string.field[OperationInput]("optionalHeaderWithDefault", _.optionalHeaderWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("optional-header-with-default")), smithy.api.HttpHeader("optional-header-with-default")), string.required[OperationInput]("requiredHeaderWithDefault", _.requiredHeaderWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("required-header-with-default")), smithy.api.HttpHeader("required-header-with-default")), + string.optional[OperationInput]("optionalQuery", _.optionalQuery).addHints(smithy.api.HttpQuery("optional-query")), string.field[OperationInput]("optionalQueryWithDefault", _.optionalQueryWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("optional-query-with-default")), smithy.api.HttpQuery("optional-query-with-default")), string.field[OperationInput]("requiredQueryWithDefault", _.requiredQueryWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("required-query-with-default")), smithy.api.HttpQuery("required-query-with-default")), - string.optional[OperationInput]("optional", _.optional), - string.optional[OperationInput]("optionalHeader", _.optionalHeader).addHints(smithy.api.HttpHeader("optional-header")), - string.optional[OperationInput]("optionalQuery", _.optionalQuery).addHints(smithy.api.HttpQuery("optional-query")), - ){ - OperationInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/OperationOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/OperationOutput.scala index c059e1ac9..19b2c128d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/OperationOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/OperationOutput.scala @@ -16,14 +16,15 @@ object OperationOutput extends ShapeTag.Companion[OperationOutput] { smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(optional: Option[String], optionalWithDefault: String, requiredWithDefault: String, optionalHeader: Option[String], optionalHeaderWithDefault: String, requiredHeaderWithDefault: String): OperationOutput = OperationOutput(optionalWithDefault, requiredWithDefault, optionalHeaderWithDefault, requiredHeaderWithDefault, optional, optionalHeader) + implicit val schema: Schema[OperationOutput] = struct( + string.optional[OperationOutput]("optional", _.optional), string.field[OperationOutput]("optionalWithDefault", _.optionalWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("optional-default"))), string.required[OperationOutput]("requiredWithDefault", _.requiredWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("required-default"))), + string.optional[OperationOutput]("optionalHeader", _.optionalHeader).addHints(smithy.api.HttpHeader("optional-header")), string.field[OperationOutput]("optionalHeaderWithDefault", _.optionalHeaderWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("optional-header-with-default")), smithy.api.HttpHeader("optional-header-with-default")), string.required[OperationOutput]("requiredHeaderWithDefault", _.requiredHeaderWithDefault).addHints(smithy.api.Default(smithy4s.Document.fromString("required-header-with-default")), smithy.api.HttpHeader("required-header-with-default")), - string.optional[OperationOutput]("optional", _.optional), - string.optional[OperationOutput]("optionalHeader", _.optionalHeader).addHints(smithy.api.HttpHeader("optional-header")), - ){ - OperationOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/OpticsStructure.scala b/modules/bootstrapped/src/generated/smithy4s/example/OpticsStructure.scala index 2ab51fc3f..c1ac0af15 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/OpticsStructure.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/OpticsStructure.scala @@ -18,9 +18,10 @@ object OpticsStructure extends ShapeTag.Companion[OpticsStructure] { val two: Lens[OpticsStructure, Option[OpticsEnum]] = Lens[OpticsStructure, Option[OpticsEnum]](_.two)(n => a => a.copy(two = n)) } + // constructor using the original order from the spec + private def make(two: Option[OpticsEnum]): OpticsStructure = OpticsStructure(two) + implicit val schema: Schema[OpticsStructure] = struct( OpticsEnum.schema.optional[OpticsStructure]("two", _.two), - ){ - OpticsStructure.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/OptionalOutputOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/OptionalOutputOutput.scala index bfd1bb0cf..1d3dfec7f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/OptionalOutputOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/OptionalOutputOutput.scala @@ -16,9 +16,10 @@ object OptionalOutputOutput extends ShapeTag.Companion[OptionalOutputOutput] { smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(body: Option[String]): OptionalOutputOutput = OptionalOutputOutput(body) + implicit val schema: Schema[OptionalOutputOutput] = struct( string.optional[OptionalOutputOutput]("body", _.body).addHints(smithy.api.HttpPayload()), - ){ - OptionalOutputOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/OrderType.scala b/modules/bootstrapped/src/generated/smithy4s/example/OrderType.scala index a670f643a..5a2dcdd22 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/OrderType.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/OrderType.scala @@ -55,12 +55,13 @@ object OrderType extends ShapeTag.Companion[OrderType] { smithy.api.Documentation("For an InStoreOrder a location ID isn\'t needed"), ).lazily + // constructor using the original order from the spec + private def make(id: OrderNumber, locationId: Option[String]): InStoreOrder = InStoreOrder(id, locationId) + val schema: Schema[InStoreOrder] = struct( OrderNumber.schema.required[InStoreOrder]("id", _.id), string.optional[InStoreOrder]("locationId", _.locationId), - ){ - InStoreOrder.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) val alt = schema.oneOf[OrderType]("inStore") } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PackedInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/PackedInput.scala index 7f376b9b0..d1a298be7 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/PackedInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/PackedInput.scala @@ -14,9 +14,10 @@ object PackedInput extends ShapeTag.Companion[PackedInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(key: String): PackedInput = PackedInput(key) + implicit val schema: Schema[PackedInput] = struct( string.required[PackedInput]("key", _.key), - ){ - PackedInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Patchable.scala b/modules/bootstrapped/src/generated/smithy4s/example/Patchable.scala index a681d2627..67a6d94ba 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Patchable.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Patchable.scala @@ -15,9 +15,10 @@ object Patchable extends ShapeTag.Companion[Patchable] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(allowExplicitNull: Option[Nullable[Int]]): Patchable = Patchable(allowExplicitNull) + implicit val schema: Schema[Patchable] = struct( int.nullable.optional[Patchable]("allowExplicitNull", _.allowExplicitNull), - ){ - Patchable.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PatchableEdgeCases.scala b/modules/bootstrapped/src/generated/smithy4s/example/PatchableEdgeCases.scala index d2681ab34..d0258f39d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/PatchableEdgeCases.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/PatchableEdgeCases.scala @@ -16,13 +16,14 @@ object PatchableEdgeCases extends ShapeTag.Companion[PatchableEdgeCases] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(required: Nullable[Int], requiredDefaultValue: Nullable[Int], requiredDefaultNull: Nullable[Int], defaultValue: Nullable[Int], defaultNull: Nullable[Int]): PatchableEdgeCases = PatchableEdgeCases(required, requiredDefaultValue, requiredDefaultNull, defaultValue, defaultNull) + implicit val schema: Schema[PatchableEdgeCases] = struct( int.nullable.required[PatchableEdgeCases]("required", _.required), int.nullable.required[PatchableEdgeCases]("requiredDefaultValue", _.requiredDefaultValue).addHints(smithy.api.Default(smithy4s.Document.fromDouble(3.0d))), int.nullable.required[PatchableEdgeCases]("requiredDefaultNull", _.requiredDefaultNull).addHints(smithy.api.Default(smithy4s.Document.nullDoc)), int.nullable.field[PatchableEdgeCases]("defaultValue", _.defaultValue).addHints(smithy.api.Default(smithy4s.Document.fromDouble(5.0d))), int.nullable.field[PatchableEdgeCases]("defaultNull", _.defaultNull).addHints(smithy.api.Default(smithy4s.Document.nullDoc)), - ){ - PatchableEdgeCases.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PathParams.scala b/modules/bootstrapped/src/generated/smithy4s/example/PathParams.scala index c6636f79f..c725f0ac2 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/PathParams.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/PathParams.scala @@ -18,6 +18,9 @@ object PathParams extends ShapeTag.Companion[PathParams] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(str: String, int: Int, ts1: Timestamp, ts2: Timestamp, ts3: Timestamp, ts4: Timestamp, b: Boolean, ie: Numbers): PathParams = PathParams(str, int, ts1, ts2, ts3, ts4, b, ie) + implicit val schema: Schema[PathParams] = struct( string.required[PathParams]("str", _.str).addHints(smithy.api.HttpLabel()), int.required[PathParams]("int", _.int).addHints(smithy.api.HttpLabel()), @@ -27,7 +30,5 @@ object PathParams extends ShapeTag.Companion[PathParams] { timestamp.required[PathParams]("ts4", _.ts4).addHints(smithy.api.TimestampFormat.HTTP_DATE.widen, smithy.api.HttpLabel()), boolean.required[PathParams]("b", _.b).addHints(smithy.api.HttpLabel()), Numbers.schema.required[PathParams]("ie", _.ie).addHints(smithy.api.HttpLabel()), - ){ - PathParams.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PayloadData.scala b/modules/bootstrapped/src/generated/smithy4s/example/PayloadData.scala index 010267664..4d5e075a5 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/PayloadData.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/PayloadData.scala @@ -13,9 +13,10 @@ object PayloadData extends ShapeTag.Companion[PayloadData] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(testBiggerUnion: Option[TestBiggerUnion]): PayloadData = PayloadData(testBiggerUnion) + implicit val schema: Schema[PayloadData] = struct( TestBiggerUnion.schema.optional[PayloadData]("testBiggerUnion", _.testBiggerUnion), - ){ - PayloadData.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Pizza.scala b/modules/bootstrapped/src/generated/smithy4s/example/Pizza.scala index 51abc7509..f11b3a439 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Pizza.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Pizza.scala @@ -14,11 +14,12 @@ object Pizza extends ShapeTag.Companion[Pizza] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(name: String, base: PizzaBase, toppings: List[Ingredient]): Pizza = Pizza(name, base, toppings) + implicit val schema: Schema[Pizza] = struct( string.required[Pizza]("name", _.name), PizzaBase.schema.required[Pizza]("base", _.base), Ingredients.underlyingSchema.required[Pizza]("toppings", _.toppings), - ){ - Pizza.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Podcast.scala b/modules/bootstrapped/src/generated/smithy4s/example/Podcast.scala index 71aa7dc5e..f5a10d5a3 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Podcast.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Podcast.scala @@ -54,13 +54,14 @@ object Podcast extends ShapeTag.Companion[Podcast] { val durationMillis: Lens[Video, Option[Long]] = Lens[Video, Option[Long]](_.durationMillis)(n => a => a.copy(durationMillis = n)) } + // constructor using the original order from the spec + private def make(title: Option[String], url: Option[String], durationMillis: Option[Long]): Video = Video(title, url, durationMillis) + val schema: Schema[Video] = struct( string.optional[Video]("title", _.title), string.optional[Video]("url", _.url), long.optional[Video]("durationMillis", _.durationMillis), - ){ - Video.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) val alt = schema.oneOf[Podcast]("video") } @@ -79,13 +80,14 @@ object Podcast extends ShapeTag.Companion[Podcast] { val durationMillis: Lens[Audio, Option[Long]] = Lens[Audio, Option[Long]](_.durationMillis)(n => a => a.copy(durationMillis = n)) } + // constructor using the original order from the spec + private def make(title: Option[String], url: Option[String], durationMillis: Option[Long]): Audio = Audio(title, url, durationMillis) + val schema: Schema[Audio] = struct( string.optional[Audio]("title", _.title), string.optional[Audio]("url", _.url), long.optional[Audio]("durationMillis", _.durationMillis), - ){ - Audio.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) val alt = schema.oneOf[Podcast]("audio") } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PriceError.scala b/modules/bootstrapped/src/generated/smithy4s/example/PriceError.scala index 017b2d358..1482a1b09 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/PriceError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/PriceError.scala @@ -20,10 +20,11 @@ object PriceError extends ShapeTag.Companion[PriceError] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(message: String, code: Int): PriceError = PriceError(message, code) + implicit val schema: Schema[PriceError] = struct( string.required[PriceError]("message", _.message), int.required[PriceError]("code", _.code).addHints(smithy.api.HttpHeader("X-CODE")), - ){ - PriceError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Product.scala b/modules/bootstrapped/src/generated/smithy4s/example/Product.scala index 9e17279df..18693bed1 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Product.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Product.scala @@ -13,5 +13,6 @@ object Product extends ShapeTag.Companion[Product] { val hints: Hints = Hints.empty + implicit val schema: Schema[Product] = constant(Product()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PutObjectInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/PutObjectInput.scala index e9b408d9e..70c036793 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/PutObjectInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/PutObjectInput.scala @@ -17,13 +17,14 @@ object PutObjectInput extends ShapeTag.Companion[PutObjectInput] { smithy.api.Documentation("A key and bucket is always required for putting a new file in a bucket"), ).lazily + // constructor using the original order from the spec + private def make(key: ObjectKey, bucketName: BucketName, foo: Option[LowHigh], someValue: Option[SomeValue], data: String): PutObjectInput = PutObjectInput(key, bucketName, data, foo, someValue) + implicit val schema: Schema[PutObjectInput] = struct( ObjectKey.schema.required[PutObjectInput]("key", _.key).addHints(smithy.api.HttpLabel()), BucketName.schema.required[PutObjectInput]("bucketName", _.bucketName).addHints(smithy.api.HttpLabel()), - string.required[PutObjectInput]("data", _.data).addHints(smithy.api.HttpPayload()), LowHigh.schema.optional[PutObjectInput]("foo", _.foo).addHints(smithy.api.HttpHeader("X-Foo")), SomeValue.schema.optional[PutObjectInput]("someValue", _.someValue).addHints(smithy.api.HttpQuery("paramName")), - ){ - PutObjectInput.apply - }.withId(id).addHints(hints) + string.required[PutObjectInput]("data", _.data).addHints(smithy.api.HttpPayload()), + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/PutStreamedObjectInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/PutStreamedObjectInput.scala index 3ec3d4d00..1f50c00aa 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/PutStreamedObjectInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/PutStreamedObjectInput.scala @@ -14,9 +14,10 @@ object PutStreamedObjectInput extends ShapeTag.Companion[PutStreamedObjectInput] val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(key: String): PutStreamedObjectInput = PutStreamedObjectInput(key) + implicit val schema: Schema[PutStreamedObjectInput] = struct( string.required[PutStreamedObjectInput]("key", _.key), - ){ - PutStreamedObjectInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Queries.scala b/modules/bootstrapped/src/generated/smithy4s/example/Queries.scala index 602f663d6..19077344f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Queries.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Queries.scala @@ -18,6 +18,9 @@ object Queries extends ShapeTag.Companion[Queries] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(str: Option[String], int: Option[Int], ts1: Option[Timestamp], ts2: Option[Timestamp], ts3: Option[Timestamp], ts4: Option[Timestamp], b: Option[Boolean], sl: Option[List[String]], ie: Option[Numbers], on: Option[OpenNums], ons: Option[OpenNumsStr], slm: Option[Map[String, String]]): Queries = Queries(str, int, ts1, ts2, ts3, ts4, b, sl, ie, on, ons, slm) + implicit val schema: Schema[Queries] = struct( string.optional[Queries]("str", _.str).addHints(smithy.api.HttpQuery("str")), int.optional[Queries]("int", _.int).addHints(smithy.api.HttpQuery("int")), @@ -31,7 +34,5 @@ object Queries extends ShapeTag.Companion[Queries] { OpenNums.schema.optional[Queries]("on", _.on).addHints(smithy.api.HttpQuery("openNums")), OpenNumsStr.schema.optional[Queries]("ons", _.ons).addHints(smithy.api.HttpQuery("openNumsStr")), StringMap.underlyingSchema.optional[Queries]("slm", _.slm).addHints(smithy.api.HttpQueryParams()), - ){ - Queries.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/QueriesWithDefaults.scala b/modules/bootstrapped/src/generated/smithy4s/example/QueriesWithDefaults.scala index 6b7849756..aa80121dc 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/QueriesWithDefaults.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/QueriesWithDefaults.scala @@ -14,9 +14,10 @@ object QueriesWithDefaults extends ShapeTag.Companion[QueriesWithDefaults] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(dflt: String): QueriesWithDefaults = QueriesWithDefaults(dflt) + implicit val schema: Schema[QueriesWithDefaults] = struct( string.field[QueriesWithDefaults]("dflt", _.dflt).addHints(smithy.api.Default(smithy4s.Document.fromString("test")), smithy.api.HttpQuery("dflt")), - ){ - QueriesWithDefaults.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherClientError.scala b/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherClientError.scala index de03a5f6c..c19d1d46f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherClientError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherClientError.scala @@ -19,9 +19,10 @@ object RandomOtherClientError extends ShapeTag.Companion[RandomOtherClientError] smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): RandomOtherClientError = RandomOtherClientError(message) + implicit val schema: Schema[RandomOtherClientError] = struct( string.optional[RandomOtherClientError]("message", _.message), - ){ - RandomOtherClientError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherClientErrorWithCode.scala b/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherClientErrorWithCode.scala index 9ad675321..a963dded0 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherClientErrorWithCode.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherClientErrorWithCode.scala @@ -20,9 +20,10 @@ object RandomOtherClientErrorWithCode extends ShapeTag.Companion[RandomOtherClie smithy.api.HttpError(404), ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): RandomOtherClientErrorWithCode = RandomOtherClientErrorWithCode(message) + implicit val schema: Schema[RandomOtherClientErrorWithCode] = struct( string.optional[RandomOtherClientErrorWithCode]("message", _.message), - ){ - RandomOtherClientErrorWithCode.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherServerError.scala b/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherServerError.scala index c7d4236eb..1a75d4eab 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherServerError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherServerError.scala @@ -19,9 +19,10 @@ object RandomOtherServerError extends ShapeTag.Companion[RandomOtherServerError] smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): RandomOtherServerError = RandomOtherServerError(message) + implicit val schema: Schema[RandomOtherServerError] = struct( string.optional[RandomOtherServerError]("message", _.message), - ){ - RandomOtherServerError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherServerErrorWithCode.scala b/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherServerErrorWithCode.scala index 05f07af8a..e9970e5fa 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherServerErrorWithCode.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/RandomOtherServerErrorWithCode.scala @@ -20,9 +20,10 @@ object RandomOtherServerErrorWithCode extends ShapeTag.Companion[RandomOtherServ smithy.api.HttpError(503), ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): RandomOtherServerErrorWithCode = RandomOtherServerErrorWithCode(message) + implicit val schema: Schema[RandomOtherServerErrorWithCode] = struct( string.optional[RandomOtherServerErrorWithCode]("message", _.message), - ){ - RandomOtherServerErrorWithCode.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/RangeCheck.scala b/modules/bootstrapped/src/generated/smithy4s/example/RangeCheck.scala index f84a839fc..5703066bf 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/RangeCheck.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/RangeCheck.scala @@ -16,9 +16,10 @@ object RangeCheck extends ShapeTag.Companion[RangeCheck] { smithy.api.Suppress(List("UnreferencedShape")), ).lazily + // constructor using the original order from the spec + private def make(qty: Int): RangeCheck = RangeCheck(qty) + implicit val schema: Schema[RangeCheck] = struct( int.validated(smithy.api.Range(min = Some(scala.math.BigDecimal(1.0)), max = None)).required[RangeCheck]("qty", _.qty), - ){ - RangeCheck.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/RecursiveInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/RecursiveInput.scala index 349001198..cd52c7419 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/RecursiveInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/RecursiveInput.scala @@ -14,9 +14,10 @@ object RecursiveInput extends ShapeTag.Companion[RecursiveInput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(hello: Option[smithy4s.example.RecursiveInput]): RecursiveInput = RecursiveInput(hello) + implicit val schema: Schema[RecursiveInput] = recursive(struct( smithy4s.example.RecursiveInput.schema.optional[RecursiveInput]("hello", _.hello), - ){ - RecursiveInput.apply - }.withId(id).addHints(hints)) + )(make).withId(id).addHints(hints)) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/RecursiveTraitStructure.scala b/modules/bootstrapped/src/generated/smithy4s/example/RecursiveTraitStructure.scala index 943de8f25..360d2f8d3 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/RecursiveTraitStructure.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/RecursiveTraitStructure.scala @@ -17,9 +17,10 @@ object RecursiveTraitStructure extends ShapeTag.Companion[RecursiveTraitStructur smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + // constructor using the original order from the spec + private def make(name: Option[String]): RecursiveTraitStructure = RecursiveTraitStructure(name) + implicit val schema: Schema[RecursiveTraitStructure] = recursive(struct( string.optional[RecursiveTraitStructure]("name", _.name).addHints(smithy4s.example.RecursiveTraitStructure(name = None)), - ){ - RecursiveTraitStructure.apply - }.withId(id).addHints(hints)) + )(make).withId(id).addHints(hints)) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ReservationInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/ReservationInput.scala index d5bf33d33..bd31f09c1 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ReservationInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ReservationInput.scala @@ -16,10 +16,11 @@ object ReservationInput extends ShapeTag.Companion[ReservationInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(name: String, town: Option[String]): ReservationInput = ReservationInput(name, town) + implicit val schema: Schema[ReservationInput] = struct( string.required[ReservationInput]("name", _.name).addHints(smithy.api.HttpLabel()), string.optional[ReservationInput]("town", _.town).addHints(smithy.api.HttpQuery("town")), - ){ - ReservationInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ReservationOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/ReservationOutput.scala index 42687bff3..4133c13ca 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ReservationOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ReservationOutput.scala @@ -16,9 +16,10 @@ object ReservationOutput extends ShapeTag.Companion[ReservationOutput] { smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(message: String): ReservationOutput = ReservationOutput(message) + implicit val schema: Schema[ReservationOutput] = struct( string.required[ReservationOutput]("message", _.message), - ){ - ReservationOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/RoundTripData.scala b/modules/bootstrapped/src/generated/smithy4s/example/RoundTripData.scala index 7c9082350..e35c451ed 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/RoundTripData.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/RoundTripData.scala @@ -14,12 +14,13 @@ object RoundTripData extends ShapeTag.Companion[RoundTripData] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(label: String, header: Option[String], query: Option[String], body: Option[String]): RoundTripData = RoundTripData(label, header, query, body) + implicit val schema: Schema[RoundTripData] = struct( string.required[RoundTripData]("label", _.label).addHints(smithy.api.HttpLabel()), string.optional[RoundTripData]("header", _.header).addHints(smithy.api.HttpHeader("HEADER")), string.optional[RoundTripData]("query", _.query).addHints(smithy.api.HttpQuery("query")), string.optional[RoundTripData]("body", _.body), - ){ - RoundTripData.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Salad.scala b/modules/bootstrapped/src/generated/smithy4s/example/Salad.scala index fcbd941b6..9cffe0a98 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Salad.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Salad.scala @@ -14,10 +14,11 @@ object Salad extends ShapeTag.Companion[Salad] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(name: String, ingredients: List[Ingredient]): Salad = Salad(name, ingredients) + implicit val schema: Schema[Salad] = struct( string.required[Salad]("name", _.name), Ingredients.underlyingSchema.required[Salad]("ingredients", _.ingredients), - ){ - Salad.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Serializable.scala b/modules/bootstrapped/src/generated/smithy4s/example/Serializable.scala index 843a8d197..d15f83013 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Serializable.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Serializable.scala @@ -13,5 +13,6 @@ object Serializable extends ShapeTag.Companion[Serializable] { val hints: Hints = Hints.empty + implicit val schema: Schema[Serializable] = constant(Serializable()).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ServerError.scala b/modules/bootstrapped/src/generated/smithy4s/example/ServerError.scala index b99acea5d..a5029b246 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ServerError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ServerError.scala @@ -19,9 +19,10 @@ object ServerError extends ShapeTag.Companion[ServerError] { smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): ServerError = ServerError(message) + implicit val schema: Schema[ServerError] = struct( string.optional[ServerError]("message", _.message), - ){ - ServerError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ServerErrorCustomMessage.scala b/modules/bootstrapped/src/generated/smithy4s/example/ServerErrorCustomMessage.scala index c8e2c48f2..649818c2f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ServerErrorCustomMessage.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ServerErrorCustomMessage.scala @@ -19,9 +19,10 @@ object ServerErrorCustomMessage extends ShapeTag.Companion[ServerErrorCustomMess smithy.api.Error.SERVER.widen, ).lazily + // constructor using the original order from the spec + private def make(messageField: Option[String]): ServerErrorCustomMessage = ServerErrorCustomMessage(messageField) + implicit val schema: Schema[ServerErrorCustomMessage] = struct( string.optional[ServerErrorCustomMessage]("messageField", _.messageField), - ){ - ServerErrorCustomMessage.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/SomeCollections.scala b/modules/bootstrapped/src/generated/smithy4s/example/SomeCollections.scala index 686b88c56..7860ff0d2 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/SomeCollections.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/SomeCollections.scala @@ -16,11 +16,12 @@ object SomeCollections extends ShapeTag.Companion[SomeCollections] { smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + // constructor using the original order from the spec + private def make(someList: List[String], someSet: Set[String], someMap: Map[String, String]): SomeCollections = SomeCollections(someList, someSet, someMap) + implicit val schema: Schema[SomeCollections] = recursive(struct( StringList.underlyingSchema.required[SomeCollections]("someList", _.someList), StringSet.underlyingSchema.required[SomeCollections]("someSet", _.someSet), StringMap.underlyingSchema.required[SomeCollections]("someMap", _.someMap), - ){ - SomeCollections.apply - }.withId(id).addHints(hints)) + )(make).withId(id).addHints(hints)) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/StructureConstrainingEnum.scala b/modules/bootstrapped/src/generated/smithy4s/example/StructureConstrainingEnum.scala index 12dc9e05e..96e181f8b 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/StructureConstrainingEnum.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/StructureConstrainingEnum.scala @@ -16,10 +16,11 @@ object StructureConstrainingEnum extends ShapeTag.Companion[StructureConstrainin val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(letter: Option[Letters], card: Option[FaceCard]): StructureConstrainingEnum = StructureConstrainingEnum(letter, card) + implicit val schema: Schema[StructureConstrainingEnum] = struct( Letters.schema.validated(smithy.api.Length(min = Some(2L), max = None)).validated(smithy.api.Pattern(s"$$aaa$$")).optional[StructureConstrainingEnum]("letter", _.letter), FaceCard.schema.validated(smithy.api.Range(min = None, max = Some(scala.math.BigDecimal(1.0)))).optional[StructureConstrainingEnum]("card", _.card), - ){ - StructureConstrainingEnum.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/StructureWithRefinedMember.scala b/modules/bootstrapped/src/generated/smithy4s/example/StructureWithRefinedMember.scala index 2e80c3efe..46576aa45 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/StructureWithRefinedMember.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/StructureWithRefinedMember.scala @@ -15,9 +15,10 @@ object StructureWithRefinedMember extends ShapeTag.Companion[StructureWithRefine val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(otherAge: Option[smithy4s.refined.Age]): StructureWithRefinedMember = StructureWithRefinedMember(otherAge) + implicit val schema: Schema[StructureWithRefinedMember] = struct( int.refined[smithy4s.refined.Age](smithy4s.example.AgeFormat()).optional[StructureWithRefinedMember]("otherAge", _.otherAge), - ){ - StructureWithRefinedMember.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/StructureWithRefinedTypes.scala b/modules/bootstrapped/src/generated/smithy4s/example/StructureWithRefinedTypes.scala index baf14356a..6de7e3ca7 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/StructureWithRefinedTypes.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/StructureWithRefinedTypes.scala @@ -13,6 +13,9 @@ object StructureWithRefinedTypes extends ShapeTag.Companion[StructureWithRefined val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(age: Age, personAge: PersonAge, requiredAge: Age, fancyList: Option[smithy4s.example.FancyList], unwrappedFancyList: Option[smithy4s.refined.FancyList], name: Option[smithy4s.example.Name], dogName: Option[smithy4s.refined.Name]): StructureWithRefinedTypes = StructureWithRefinedTypes(age, personAge, requiredAge, fancyList, unwrappedFancyList, name, dogName) + implicit val schema: Schema[StructureWithRefinedTypes] = struct( Age.schema.field[StructureWithRefinedTypes]("age", _.age).addHints(smithy.api.Default(smithy4s.Document.fromDouble(0.0d))), PersonAge.schema.field[StructureWithRefinedTypes]("personAge", _.personAge).addHints(smithy.api.Default(smithy4s.Document.fromDouble(0.0d))), @@ -21,7 +24,5 @@ object StructureWithRefinedTypes extends ShapeTag.Companion[StructureWithRefined UnwrappedFancyList.underlyingSchema.optional[StructureWithRefinedTypes]("unwrappedFancyList", _.unwrappedFancyList), smithy4s.example.Name.schema.optional[StructureWithRefinedTypes]("name", _.name), DogName.underlyingSchema.optional[StructureWithRefinedTypes]("dogName", _.dogName), - ){ - StructureWithRefinedTypes.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestAdt.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestAdt.scala index 5860ece68..42b173c7a 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestAdt.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestAdt.scala @@ -45,14 +45,15 @@ object TestAdt extends ShapeTag.Companion[TestAdt] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(lng: Option[Long], sht: Option[Short], blb: Option[Blob], str: Option[String]): AdtOne = AdtOne(lng, sht, blb, str) + val schema: Schema[AdtOne] = struct( long.optional[AdtOne]("lng", _.lng), short.optional[AdtOne]("sht", _.sht), bytes.optional[AdtOne]("blb", _.blb), string.optional[AdtOne]("str", _.str), - ){ - AdtOne.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) val alt = schema.oneOf[TestAdt]("one") } @@ -65,13 +66,14 @@ object TestAdt extends ShapeTag.Companion[TestAdt] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(lng: Option[Long], sht: Option[Short], int: Option[Int]): AdtTwo = AdtTwo(lng, sht, int) + val schema: Schema[AdtTwo] = struct( long.optional[AdtTwo]("lng", _.lng), short.optional[AdtTwo]("sht", _.sht), int.optional[AdtTwo]("int", _.int), - ){ - AdtTwo.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) val alt = schema.oneOf[TestAdt]("two") } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestBody.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestBody.scala index 90ac42416..3a2558b64 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestBody.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestBody.scala @@ -19,9 +19,10 @@ object TestBody extends ShapeTag.Companion[TestBody] { val data: Lens[TestBody, Option[String]] = Lens[TestBody, Option[String]](_.data)(n => a => a.copy(data = n)) } + // constructor using the original order from the spec + private def make(data: Option[String]): TestBody = TestBody(data) + implicit val schema: Schema[TestBody] = struct( string.validated(smithy.api.Length(min = Some(10L), max = None)).optional[TestBody]("data", _.data), - ){ - TestBody.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestDiscriminatedInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestDiscriminatedInput.scala index 0d5687de8..7f4a20a28 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestDiscriminatedInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestDiscriminatedInput.scala @@ -14,9 +14,10 @@ object TestDiscriminatedInput extends ShapeTag.Companion[TestDiscriminatedInput] val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(key: String): TestDiscriminatedInput = TestDiscriminatedInput(key) + implicit val schema: Schema[TestDiscriminatedInput] = struct( string.required[TestDiscriminatedInput]("key", _.key).addHints(smithy.api.HttpLabel()), - ){ - TestDiscriminatedInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestDiscriminatedOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestDiscriminatedOutput.scala index 11cfdc307..3c23cd837 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestDiscriminatedOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestDiscriminatedOutput.scala @@ -13,9 +13,10 @@ object TestDiscriminatedOutput extends ShapeTag.Companion[TestDiscriminatedOutpu val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(data: Option[PayloadData]): TestDiscriminatedOutput = TestDiscriminatedOutput(data) + implicit val schema: Schema[TestDiscriminatedOutput] = struct( PayloadData.schema.optional[TestDiscriminatedOutput]("data", _.data).addHints(smithy.api.HttpPayload()), - ){ - TestDiscriminatedOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestEmptyMixin.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestEmptyMixin.scala index 6d8566a6c..e0430d1a7 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestEmptyMixin.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestEmptyMixin.scala @@ -14,9 +14,10 @@ object TestEmptyMixin extends ShapeTag.Companion[TestEmptyMixin] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(a: Option[Long]): TestEmptyMixin = TestEmptyMixin(a) + implicit val schema: Schema[TestEmptyMixin] = struct( long.optional[TestEmptyMixin]("a", _.a), - ){ - TestEmptyMixin.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestIdRef.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestIdRef.scala index 7189b2c52..1a8193909 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestIdRef.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestIdRef.scala @@ -14,10 +14,11 @@ object TestIdRef extends ShapeTag.Companion[TestIdRef] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(test: Option[ShapeId], test2: Option[TestIdRefTwo]): TestIdRef = TestIdRef(test, test2) + implicit val schema: Schema[TestIdRef] = struct( string.refined[ShapeId](smithy.api.IdRef(selector = "*", failWhenMissing = None, errorMessage = None)).optional[TestIdRef]("test", _.test), TestIdRefTwo.schema.optional[TestIdRef]("test2", _.test2), - ){ - TestIdRef.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestInput.scala index a1b180044..061ef1f3f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestInput.scala @@ -21,11 +21,12 @@ object TestInput extends ShapeTag.Companion[TestInput] { val queryParam: Lens[TestInput, Option[String]] = Lens[TestInput, Option[String]](_.queryParam)(n => a => a.copy(queryParam = n)) } + // constructor using the original order from the spec + private def make(pathParam: String, queryParam: Option[String], body: TestBody): TestInput = TestInput(pathParam, body, queryParam) + implicit val schema: Schema[TestInput] = struct( string.validated(smithy.api.Length(min = Some(10L), max = None)).required[TestInput]("pathParam", _.pathParam).addHints(smithy.api.HttpLabel()), - TestBody.schema.required[TestInput]("body", _.body).addHints(smithy.api.HttpPayload()), string.validated(smithy.api.Length(min = Some(10L), max = None)).optional[TestInput]("queryParam", _.queryParam).addHints(smithy.api.HttpQuery("queryParam")), - ){ - TestInput.apply - }.withId(id).addHints(hints) + TestBody.schema.required[TestInput]("body", _.body).addHints(smithy.api.HttpPayload()), + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestMixinAdt.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestMixinAdt.scala index a6a02b8a3..3bcbf9854 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestMixinAdt.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestMixinAdt.scala @@ -38,12 +38,13 @@ object TestMixinAdt extends ShapeTag.Companion[TestMixinAdt] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(a: Option[String], b: Option[Int]): TestAdtMemberWithMixin = TestAdtMemberWithMixin(a, b) + val schema: Schema[TestAdtMemberWithMixin] = struct( string.optional[TestAdtMemberWithMixin]("a", _.a), int.optional[TestAdtMemberWithMixin]("b", _.b), - ){ - TestAdtMemberWithMixin.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) val alt = schema.oneOf[TestMixinAdt]("test") } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestStructurePatternTarget.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestStructurePatternTarget.scala index a075bba2b..31a4daa3e 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestStructurePatternTarget.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestStructurePatternTarget.scala @@ -15,10 +15,11 @@ object TestStructurePatternTarget extends ShapeTag.Companion[TestStructurePatter val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(one: String, two: Int): TestStructurePatternTarget = TestStructurePatternTarget(one, two) + implicit val schema: Schema[TestStructurePatternTarget] = struct( string.required[TestStructurePatternTarget]("one", _.one), int.required[TestStructurePatternTarget]("two", _.two), - ){ - TestStructurePatternTarget.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/TestTrait.scala b/modules/bootstrapped/src/generated/smithy4s/example/TestTrait.scala index 4f88cfc5a..471b56d6c 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/TestTrait.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/TestTrait.scala @@ -20,9 +20,10 @@ object TestTrait extends ShapeTag.Companion[TestTrait] { smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + // constructor using the original order from the spec + private def make(orderType: Option[OrderType]): TestTrait = TestTrait(orderType) + implicit val schema: Schema[TestTrait] = recursive(struct( OrderType.schema.optional[TestTrait]("orderType", _.orderType), - ){ - TestTrait.apply - }.withId(id).addHints(hints)) + )(make).withId(id).addHints(hints)) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Three.scala b/modules/bootstrapped/src/generated/smithy4s/example/Three.scala index 27a20425d..e96da6136 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Three.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Three.scala @@ -14,9 +14,10 @@ object Three extends ShapeTag.Companion[Three] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(three: String): Three = Three(three) + implicit val schema: Schema[Three] = struct( string.required[Three]("three", _.three), - ){ - Three.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Two.scala b/modules/bootstrapped/src/generated/smithy4s/example/Two.scala index 5e7a7b18f..35ef4cad8 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Two.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Two.scala @@ -14,9 +14,10 @@ object Two extends ShapeTag.Companion[Two] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(value: Option[Int]): Two = Two(value) + implicit val schema: Schema[Two] = struct( int.optional[Two]("value", _.value), - ){ - Two.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/UnauthorizedError.scala b/modules/bootstrapped/src/generated/smithy4s/example/UnauthorizedError.scala index 13c56808b..a8cc34088 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/UnauthorizedError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/UnauthorizedError.scala @@ -18,9 +18,10 @@ object UnauthorizedError extends ShapeTag.Companion[UnauthorizedError] { smithy.api.Error.CLIENT.widen, ).lazily + // constructor using the original order from the spec + private def make(reason: String): UnauthorizedError = UnauthorizedError(reason) + implicit val schema: Schema[UnauthorizedError] = struct( string.required[UnauthorizedError]("reason", _.reason), - ){ - UnauthorizedError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/UnknownServerError.scala b/modules/bootstrapped/src/generated/smithy4s/example/UnknownServerError.scala index a44b1a125..96bb7dd97 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/UnknownServerError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/UnknownServerError.scala @@ -19,11 +19,12 @@ object UnknownServerError extends ShapeTag.Companion[UnknownServerError] { smithy.api.HttpError(500), ).lazily + // constructor using the original order from the spec + private def make(errorCode: UnknownServerErrorCode, description: Option[String], stateHash: Option[String]): UnknownServerError = UnknownServerError(errorCode, description, stateHash) + implicit val schema: Schema[UnknownServerError] = struct( UnknownServerErrorCode.schema.required[UnknownServerError]("errorCode", _.errorCode), string.optional[UnknownServerError]("description", _.description), string.optional[UnknownServerError]("stateHash", _.stateHash), - ){ - UnknownServerError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/ValidationChecks.scala b/modules/bootstrapped/src/generated/smithy4s/example/ValidationChecks.scala index af58ae91c..f8afd2fbf 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/ValidationChecks.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/ValidationChecks.scala @@ -15,11 +15,12 @@ object ValidationChecks extends ShapeTag.Companion[ValidationChecks] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(str: Option[String], lst: Option[List[String]], int: Option[Int]): ValidationChecks = ValidationChecks(str, lst, int) + implicit val schema: Schema[ValidationChecks] = struct( string.validated(smithy.api.Length(min = Some(1L), max = Some(10L))).optional[ValidationChecks]("str", _.str).addHints(smithy.api.HttpQuery("str")), StringList.underlyingSchema.validated(smithy.api.Length(min = Some(1L), max = Some(10L))).optional[ValidationChecks]("lst", _.lst).addHints(smithy.api.HttpQuery("lst")), int.validated(smithy.api.Range(min = Some(scala.math.BigDecimal(1.0)), max = Some(scala.math.BigDecimal(10.0)))).optional[ValidationChecks]("int", _.int).addHints(smithy.api.HttpQuery("int")), - ){ - ValidationChecks.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/Value.scala b/modules/bootstrapped/src/generated/smithy4s/example/Value.scala index 81a985299..cefbe6b60 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/Value.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/Value.scala @@ -14,9 +14,10 @@ object Value extends ShapeTag.Companion[Value] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(value: String): Value = Value(value) + implicit val schema: Schema[Value] = struct( string.required[Value]("value", _.value), - ){ - Value.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/VersionOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/VersionOutput.scala index 2c86176da..63c67100f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/VersionOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/VersionOutput.scala @@ -14,9 +14,10 @@ object VersionOutput extends ShapeTag.Companion[VersionOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(version: String): VersionOutput = VersionOutput(version) + implicit val schema: Schema[VersionOutput] = struct( string.required[VersionOutput]("version", _.version).addHints(smithy.api.HttpPayload()), - ){ - VersionOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/ListInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/ListInput.scala index ab1d2962b..85ee551af 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/collision/ListInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/ListInput.scala @@ -15,9 +15,10 @@ object ListInput extends ShapeTag.Companion[ListInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(list: List[String]): ListInput = ListInput(list) + implicit val schema: Schema[ListInput] = struct( MyList.underlyingSchema.required[ListInput]("list", _.list), - ){ - ListInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/MapInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/MapInput.scala index 57e71784b..0eb8fb17b 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/collision/MapInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/MapInput.scala @@ -15,9 +15,10 @@ object MapInput extends ShapeTag.Companion[MapInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(value: Map[String, String]): MapInput = MapInput(value) + implicit val schema: Schema[MapInput] = struct( MyMap.underlyingSchema.required[MapInput]("value", _.value), - ){ - MapInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/OptionInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/OptionInput.scala index 367455983..d5e208d56 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/collision/OptionInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/OptionInput.scala @@ -15,9 +15,10 @@ object OptionInput extends ShapeTag.Companion[OptionInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(value: Option[String]): OptionInput = OptionInput(value) + implicit val schema: Schema[OptionInput] = struct( String.schema.optional[OptionInput]("value", _.value), - ){ - OptionInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/Packagee.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/Packagee.scala index e2bfe2cf1..f79d96e30 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/collision/Packagee.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/Packagee.scala @@ -14,9 +14,10 @@ object Packagee extends ShapeTag.Companion[Packagee] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(_class: Option[Int]): Packagee = Packagee(_class) + implicit val schema: Schema[Packagee] = struct( int.optional[Packagee]("class", _._class), - ){ - Packagee.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedKeywordStructTrait.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedKeywordStructTrait.scala index 28af31c19..ad1ab6262 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedKeywordStructTrait.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedKeywordStructTrait.scala @@ -16,10 +16,11 @@ object ReservedKeywordStructTrait extends ShapeTag.Companion[ReservedKeywordStru smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None), ).lazily + // constructor using the original order from the spec + private def make(_implicit: String, _package: Option[Packagee]): ReservedKeywordStructTrait = ReservedKeywordStructTrait(_implicit, _package) + implicit val schema: Schema[ReservedKeywordStructTrait] = recursive(struct( String.schema.required[ReservedKeywordStructTrait]("implicit", _._implicit), Packagee.schema.optional[ReservedKeywordStructTrait]("package", _._package), - ){ - ReservedKeywordStructTrait.apply - }.withId(id).addHints(hints)) + )(make).withId(id).addHints(hints)) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedKeywordTraitExampleStruct.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedKeywordTraitExampleStruct.scala index a3fef97c4..452e29d2d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedKeywordTraitExampleStruct.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/ReservedKeywordTraitExampleStruct.scala @@ -16,9 +16,10 @@ object ReservedKeywordTraitExampleStruct extends ShapeTag.Companion[ReservedKeyw smithy4s.example.collision.ReservedKeywordUnionTrait.PackageCase(smithy4s.example.collision.PackageUnion.ClassCase(42).widen).widen, ).lazily + // constructor using the original order from the spec + private def make(member: Option[String]): ReservedKeywordTraitExampleStruct = ReservedKeywordTraitExampleStruct(member) + implicit val schema: Schema[ReservedKeywordTraitExampleStruct] = struct( String.schema.optional[ReservedKeywordTraitExampleStruct]("member", _.member).addHints(smithy4s.example.collision.ReservedKeywordStructTrait(_implicit = smithy4s.example.collision.String("demo"), _package = Some(smithy4s.example.collision.Packagee(_class = Some(42)))), smithy4s.example.collision.ReservedKeywordUnionTrait.PackageCase(smithy4s.example.collision.PackageUnion.ClassCase(42).widen).widen), - ){ - ReservedKeywordTraitExampleStruct.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/Scala3ReservedKeywords.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/Scala3ReservedKeywords.scala index e0846e10b..1983adf50 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/collision/Scala3ReservedKeywords.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/Scala3ReservedKeywords.scala @@ -13,10 +13,11 @@ object Scala3ReservedKeywords extends ShapeTag.Companion[Scala3ReservedKeywords] val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(_export: Option[String], _enum: Option[String]): Scala3ReservedKeywords = Scala3ReservedKeywords(_export, _enum) + implicit val schema: Schema[Scala3ReservedKeywords] = struct( String.schema.optional[Scala3ReservedKeywords]("export", _._export), String.schema.optional[Scala3ReservedKeywords]("enum", _._enum), - ){ - Scala3ReservedKeywords.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/SetInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/SetInput.scala index 62f90ae3e..0fb3fbb6d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/collision/SetInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/SetInput.scala @@ -15,9 +15,10 @@ object SetInput extends ShapeTag.Companion[SetInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(set: Set[String]): SetInput = SetInput(set) + implicit val schema: Schema[SetInput] = struct( MySet.underlyingSchema.required[SetInput]("set", _.set), - ){ - SetInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/collision/TestReservedNamespaceImport.scala b/modules/bootstrapped/src/generated/smithy4s/example/collision/TestReservedNamespaceImport.scala index e05d3bda3..04eeae93b 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/collision/TestReservedNamespaceImport.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/collision/TestReservedNamespaceImport.scala @@ -14,9 +14,10 @@ object TestReservedNamespaceImport extends ShapeTag.Companion[TestReservedNamesp val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(_package: Option[MyPackageString]): TestReservedNamespaceImport = TestReservedNamespaceImport(_package) + implicit val schema: Schema[TestReservedNamespaceImport] = struct( MyPackageString.schema.optional[TestReservedNamespaceImport]("package", _._package), - ){ - TestReservedNamespaceImport.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/error/NotFoundError.scala b/modules/bootstrapped/src/generated/smithy4s/example/error/NotFoundError.scala index 1624a24ba..7cd7bb49b 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/error/NotFoundError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/error/NotFoundError.scala @@ -19,9 +19,10 @@ object NotFoundError extends ShapeTag.Companion[NotFoundError] { smithy.api.HttpError(404), ).lazily + // constructor using the original order from the spec + private def make(error: Option[String]): NotFoundError = NotFoundError(error) + implicit val schema: Schema[NotFoundError] = struct( string.optional[NotFoundError]("error", _.error), - ){ - NotFoundError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetInput.scala index e9d879052..cfa7f81e2 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetInput.scala @@ -16,9 +16,10 @@ object GreetInput extends ShapeTag.Companion[GreetInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(name: String): GreetInput = GreetInput(name) + implicit val schema: Schema[GreetInput] = struct( string.required[GreetInput]("name", _.name), - ){ - GreetInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetOutput.scala index b4963ab10..d2f92b7ee 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/greet/GreetOutput.scala @@ -16,9 +16,10 @@ object GreetOutput extends ShapeTag.Companion[GreetOutput] { smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(message: String): GreetOutput = GreetOutput(message) + implicit val schema: Schema[GreetOutput] = struct( string.required[GreetOutput]("message", _.message), - ){ - GreetOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/HealthCheckOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/HealthCheckOutput.scala index 0f10b696d..2fde94a38 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/HealthCheckOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/HealthCheckOutput.scala @@ -16,9 +16,10 @@ object HealthCheckOutput extends ShapeTag.Companion[HealthCheckOutput] { smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(message: String): HealthCheckOutput = HealthCheckOutput(message) + implicit val schema: Schema[HealthCheckOutput] = struct( string.required[HealthCheckOutput]("message", _.message), - ){ - HealthCheckOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/NotAuthorizedError.scala b/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/NotAuthorizedError.scala index e665d4c3e..58f37ff65 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/NotAuthorizedError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/NotAuthorizedError.scala @@ -20,9 +20,10 @@ object NotAuthorizedError extends ShapeTag.Companion[NotAuthorizedError] { smithy.api.HttpError(401), ).lazily + // constructor using the original order from the spec + private def make(message: String): NotAuthorizedError = NotAuthorizedError(message) + implicit val schema: Schema[NotAuthorizedError] = struct( string.required[NotAuthorizedError]("message", _.message), - ){ - NotAuthorizedError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/World.scala b/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/World.scala index ce9eebb92..671a28000 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/World.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/guides/auth/World.scala @@ -14,9 +14,10 @@ object World extends ShapeTag.Companion[World] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(message: String): World = World(message) + implicit val schema: Schema[World] = struct( string.field[World]("message", _.message).addHints(smithy.api.Default(smithy4s.Document.fromString("World !"))), - ){ - World.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/guides/hello/World.scala b/modules/bootstrapped/src/generated/smithy4s/example/guides/hello/World.scala index 855c310c9..75c0c72bf 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/guides/hello/World.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/guides/hello/World.scala @@ -14,9 +14,10 @@ object World extends ShapeTag.Companion[World] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(message: String): World = World(message) + implicit val schema: Schema[World] = struct( string.field[World]("message", _.message).addHints(smithy.api.Default(smithy4s.Document.fromString("World !"))), - ){ - World.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/hello/GenericServerError.scala b/modules/bootstrapped/src/generated/smithy4s/example/hello/GenericServerError.scala index d01b83fca..930ad03e0 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/hello/GenericServerError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/hello/GenericServerError.scala @@ -20,9 +20,10 @@ object GenericServerError extends ShapeTag.Companion[GenericServerError] { smithy.api.HttpError(500), ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): GenericServerError = GenericServerError(message) + implicit val schema: Schema[GenericServerError] = struct( string.optional[GenericServerError]("message", _.message), - ){ - GenericServerError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/hello/Greeting.scala b/modules/bootstrapped/src/generated/smithy4s/example/hello/Greeting.scala index 979eed29a..886fbb7f7 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/hello/Greeting.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/hello/Greeting.scala @@ -14,9 +14,10 @@ object Greeting extends ShapeTag.Companion[Greeting] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(message: String): Greeting = Greeting(message) + implicit val schema: Schema[Greeting] = struct( string.required[Greeting]("message", _.message), - ){ - Greeting.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/hello/Person.scala b/modules/bootstrapped/src/generated/smithy4s/example/hello/Person.scala index 9f3790325..b5e719510 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/hello/Person.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/hello/Person.scala @@ -14,10 +14,11 @@ object Person extends ShapeTag.Companion[Person] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(name: String, town: Option[String]): Person = Person(name, town) + implicit val schema: Schema[Person] = struct( string.required[Person]("name", _.name).addHints(smithy.api.HttpLabel()), string.optional[Person]("town", _.town).addHints(smithy.api.HttpQuery("town")), - ){ - Person.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/hello/SpecificServerError.scala b/modules/bootstrapped/src/generated/smithy4s/example/hello/SpecificServerError.scala index a94923632..5abcb3bcb 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/hello/SpecificServerError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/hello/SpecificServerError.scala @@ -20,9 +20,10 @@ object SpecificServerError extends ShapeTag.Companion[SpecificServerError] { smithy.api.HttpError(599), ).lazily + // constructor using the original order from the spec + private def make(message: Option[String]): SpecificServerError = SpecificServerError(message) + implicit val schema: Schema[SpecificServerError] = struct( string.optional[SpecificServerError]("message", _.message), - ){ - SpecificServerError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/import_test/OpOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/import_test/OpOutput.scala index 219a4bb6c..fab95e56a 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/import_test/OpOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/import_test/OpOutput.scala @@ -14,9 +14,10 @@ object OpOutput extends ShapeTag.Companion[OpOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(output: String): OpOutput = OpOutput(output) + implicit val schema: Schema[OpOutput] = struct( string.required[OpOutput]("output", _.output).addHints(smithy.api.HttpPayload()), - ){ - OpOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleOperationInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleOperationInput.scala index 8f8203b72..68f1f9ddd 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleOperationInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleOperationInput.scala @@ -16,9 +16,10 @@ object ExampleOperationInput extends ShapeTag.Companion[ExampleOperationInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(a: String): ExampleOperationInput = ExampleOperationInput(a) + implicit val schema: Schema[ExampleOperationInput] = struct( string.required[ExampleOperationInput]("a", _.a), - ){ - ExampleOperationInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleOperationOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleOperationOutput.scala index 520159ee2..90197112a 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleOperationOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/product/ExampleOperationOutput.scala @@ -16,9 +16,10 @@ object ExampleOperationOutput extends ShapeTag.Companion[ExampleOperationOutput] smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(b: String): ExampleOperationOutput = ExampleOperationOutput(b) + implicit val schema: Schema[ExampleOperationOutput] = struct( string.required[ExampleOperationOutput]("b", _.b), - ){ - ExampleOperationOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/reservedNameOverride/Set.scala b/modules/bootstrapped/src/generated/smithy4s/example/reservedNameOverride/Set.scala index 1dc11c9c8..6f7143813 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/reservedNameOverride/Set.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/reservedNameOverride/Set.scala @@ -15,10 +15,11 @@ object Set extends ShapeTag.Companion[Set] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(someField: String, otherField: Int): Set = Set(someField, otherField) + implicit val schema: Schema[Set] = struct( string.required[Set]("someField", _.someField), int.required[Set]("otherField", _.otherField), - ){ - Set.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/reservedNameOverride/SetOpInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/reservedNameOverride/SetOpInput.scala index 079966ce3..704a2b302 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/reservedNameOverride/SetOpInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/reservedNameOverride/SetOpInput.scala @@ -15,9 +15,10 @@ object SetOpInput extends ShapeTag.Companion[SetOpInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(set: Set): SetOpInput = SetOpInput(set) + implicit val schema: Schema[SetOpInput] = struct( Set.schema.required[SetOpInput]("set", _.set), - ){ - SetOpInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/ComplexError.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/ComplexError.scala index 5d5ba693a..e7c7d4878 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/test/ComplexError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/test/ComplexError.scala @@ -22,11 +22,12 @@ object ComplexError extends ShapeTag.Companion[ComplexError] { smithy.test.HttpResponseTests(List(smithy.test.HttpResponseTestCase(id = "complex_error", protocol = smithy4s.ShapeId(namespace = "alloy", name = "simpleRestJson"), code = 504, authScheme = None, headers = None, forbidHeaders = None, requireHeaders = Some(List("X-Error-Type")), body = Some("{\"value\":-1,\"message\":\"some error message\",\"details\":{\"date\":123,\"location\":\"NYC\"}}"), bodyMediaType = Some("application/json"), params = Some(smithy4s.Document.obj("value" -> smithy4s.Document.fromDouble(-1.0d), "message" -> smithy4s.Document.fromString("some error message"), "details" -> smithy4s.Document.obj("date" -> smithy4s.Document.fromDouble(123.0d), "location" -> smithy4s.Document.fromString("NYC")))), vendorParams = None, vendorParamsShape = None, documentation = None, tags = None, appliesTo = None), smithy.test.HttpResponseTestCase(id = "complex_error_no_details", protocol = smithy4s.ShapeId(namespace = "alloy", name = "simpleRestJson"), code = 504, authScheme = None, headers = None, forbidHeaders = None, requireHeaders = Some(List("X-Error-Type")), body = Some("{\"value\":-1,\"message\":\"some error message\"}"), bodyMediaType = Some("application/json"), params = Some(smithy4s.Document.obj("value" -> smithy4s.Document.fromDouble(-1.0d), "message" -> smithy4s.Document.fromString("some error message"))), vendorParams = None, vendorParamsShape = None, documentation = None, tags = None, appliesTo = None))), ).lazily + // constructor using the original order from the spec + private def make(value: Int, message: String, details: Option[ErrorDetails]): ComplexError = ComplexError(value, message, details) + implicit val schema: Schema[ComplexError] = struct( int.required[ComplexError]("value", _.value), string.required[ComplexError]("message", _.message), ErrorDetails.schema.optional[ComplexError]("details", _.details), - ){ - ComplexError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/ErrorDetails.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/ErrorDetails.scala index bbf883f12..e24e8b178 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/test/ErrorDetails.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/test/ErrorDetails.scala @@ -16,10 +16,11 @@ object ErrorDetails extends ShapeTag.Companion[ErrorDetails] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(date: Timestamp, location: String): ErrorDetails = ErrorDetails(date, location) + implicit val schema: Schema[ErrorDetails] = struct( timestamp.required[ErrorDetails]("date", _.date).addHints(smithy.api.TimestampFormat.EPOCH_SECONDS.widen), string.required[ErrorDetails]("location", _.location), - ){ - ErrorDetails.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/HelloInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/HelloInput.scala index c16c11ba1..5b392e413 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/test/HelloInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/test/HelloInput.scala @@ -16,9 +16,10 @@ object HelloInput extends ShapeTag.Companion[HelloInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(name: String): HelloInput = HelloInput(name) + implicit val schema: Schema[HelloInput] = struct( string.required[HelloInput]("name", _.name).addHints(smithy.api.HttpLabel()), - ){ - HelloInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/HelloOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/HelloOutput.scala index 463a01f64..20756b64f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/test/HelloOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/test/HelloOutput.scala @@ -16,9 +16,10 @@ object HelloOutput extends ShapeTag.Companion[HelloOutput] { smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(message: String): HelloOutput = HelloOutput(message) + implicit val schema: Schema[HelloOutput] = struct( string.required[HelloOutput]("message", _.message), - ){ - HelloOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloInput.scala index df5ff96c1..69e0ea9c6 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloInput.scala @@ -16,11 +16,12 @@ object SayHelloInput extends ShapeTag.Companion[SayHelloInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(greeting: Option[String], query: Option[String], name: Option[String]): SayHelloInput = SayHelloInput(greeting, query, name) + implicit val schema: Schema[SayHelloInput] = struct( string.optional[SayHelloInput]("greeting", _.greeting).addHints(smithy.api.HttpHeader("X-Greeting")), string.optional[SayHelloInput]("query", _.query).addHints(smithy.api.HttpQuery("Hi")), string.optional[SayHelloInput]("name", _.name), - ){ - SayHelloInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloOutput.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloOutput.scala index ff1f22f0c..afd583e63 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloOutput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloOutput.scala @@ -14,10 +14,11 @@ object SayHelloOutput extends ShapeTag.Companion[SayHelloOutput] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(payload: SayHelloPayload, header1: String): SayHelloOutput = SayHelloOutput(payload, header1) + implicit val schema: Schema[SayHelloOutput] = struct( SayHelloPayload.schema.required[SayHelloOutput]("payload", _.payload).addHints(smithy.api.HttpPayload()), string.required[SayHelloOutput]("header1", _.header1).addHints(smithy.api.HttpHeader("X-H1")), - ){ - SayHelloOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloPayload.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloPayload.scala index cd13d88b9..20e247d7f 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloPayload.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/test/SayHelloPayload.scala @@ -14,9 +14,10 @@ object SayHelloPayload extends ShapeTag.Companion[SayHelloPayload] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(result: String): SayHelloPayload = SayHelloPayload(result) + implicit val schema: Schema[SayHelloPayload] = struct( string.required[SayHelloPayload]("result", _.result), - ){ - SayHelloPayload.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/SimpleError.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/SimpleError.scala index 4d48c4005..75707535d 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/test/SimpleError.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/test/SimpleError.scala @@ -19,9 +19,10 @@ object SimpleError extends ShapeTag.Companion[SimpleError] { smithy.test.HttpResponseTests(List(smithy.test.HttpResponseTestCase(id = "simple_error", protocol = smithy4s.ShapeId(namespace = "alloy", name = "simpleRestJson"), code = 400, authScheme = None, headers = None, forbidHeaders = None, requireHeaders = Some(List("X-Error-Type")), body = Some("{\"expected\":-1}"), bodyMediaType = Some("application/json"), params = Some(smithy4s.Document.obj("expected" -> smithy4s.Document.fromDouble(-1.0d))), vendorParams = None, vendorParamsShape = None, documentation = None, tags = None, appliesTo = None))), ).lazily + // constructor using the original order from the spec + private def make(expected: Int): SimpleError = SimpleError(expected) + implicit val schema: Schema[SimpleError] = struct( int.required[SimpleError]("expected", _.expected), - ){ - SimpleError.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/smithy4s/example/test/TestPathInput.scala b/modules/bootstrapped/src/generated/smithy4s/example/test/TestPathInput.scala index 9a0da39c7..138a8a504 100644 --- a/modules/bootstrapped/src/generated/smithy4s/example/test/TestPathInput.scala +++ b/modules/bootstrapped/src/generated/smithy4s/example/test/TestPathInput.scala @@ -16,9 +16,10 @@ object TestPathInput extends ShapeTag.Companion[TestPathInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(path: String): TestPathInput = TestPathInput(path) + implicit val schema: Schema[TestPathInput] = struct( string.required[TestPathInput]("path", _.path).addHints(smithy.api.HttpLabel()), - ){ - TestPathInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/weather/Dog.scala b/modules/bootstrapped/src/generated/weather/Dog.scala index 8471bb189..6a62004ee 100644 --- a/modules/bootstrapped/src/generated/weather/Dog.scala +++ b/modules/bootstrapped/src/generated/weather/Dog.scala @@ -14,9 +14,10 @@ object Dog extends ShapeTag.Companion[Dog] { val hints: Hints = Hints.empty + // constructor using the original order from the spec + private def make(name: String): Dog = Dog(name) + implicit val schema: Schema[Dog] = struct( string.required[Dog]("name", _.name), - ){ - Dog.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/weather/GetWeatherInput.scala b/modules/bootstrapped/src/generated/weather/GetWeatherInput.scala index 59deaf4b5..47a90690c 100644 --- a/modules/bootstrapped/src/generated/weather/GetWeatherInput.scala +++ b/modules/bootstrapped/src/generated/weather/GetWeatherInput.scala @@ -16,9 +16,10 @@ object GetWeatherInput extends ShapeTag.Companion[GetWeatherInput] { smithy.api.Input(), ).lazily + // constructor using the original order from the spec + private def make(city: String): GetWeatherInput = GetWeatherInput(city) + implicit val schema: Schema[GetWeatherInput] = struct( string.required[GetWeatherInput]("city", _.city).addHints(smithy.api.HttpLabel()), - ){ - GetWeatherInput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/bootstrapped/src/generated/weather/GetWeatherOutput.scala b/modules/bootstrapped/src/generated/weather/GetWeatherOutput.scala index af2a2d943..b43989b76 100644 --- a/modules/bootstrapped/src/generated/weather/GetWeatherOutput.scala +++ b/modules/bootstrapped/src/generated/weather/GetWeatherOutput.scala @@ -16,9 +16,10 @@ object GetWeatherOutput extends ShapeTag.Companion[GetWeatherOutput] { smithy.api.Output(), ).lazily + // constructor using the original order from the spec + private def make(weather: String): GetWeatherOutput = GetWeatherOutput(weather) + implicit val schema: Schema[GetWeatherOutput] = struct( string.required[GetWeatherOutput]("weather", _.weather), - ){ - GetWeatherOutput.apply - }.withId(id).addHints(hints) + )(make).withId(id).addHints(hints) } diff --git a/modules/codegen/src/smithy4s/codegen/internals/CollisionAvoidance.scala b/modules/codegen/src/smithy4s/codegen/internals/CollisionAvoidance.scala index f3632b204..649641bda 100644 --- a/modules/codegen/src/smithy4s/codegen/internals/CollisionAvoidance.scala +++ b/modules/codegen/src/smithy4s/codegen/internals/CollisionAvoidance.scala @@ -147,6 +147,7 @@ private[internals] object CollisionAvoidance { field.name, modType(field.tpe), field.modifier, + field.originalIndex, field.hints.map(modHint) ) } diff --git a/modules/codegen/src/smithy4s/codegen/internals/IR.scala b/modules/codegen/src/smithy4s/codegen/internals/IR.scala index d1f9cf4a1..9b5e385c0 100644 --- a/modules/codegen/src/smithy4s/codegen/internals/IR.scala +++ b/modules/codegen/src/smithy4s/codegen/internals/IR.scala @@ -132,6 +132,7 @@ private[internals] case class Field( realName: String, tpe: Type, modifier: Field.Modifier, + originalIndex: Int, hints: List[Hint] ) @@ -193,9 +194,10 @@ private[internals] object Field { name: String, tpe: Type, modifier: Modifier, + originalIndex: Int, hints: List[Hint] = Nil ): Field = - Field(name, name, tpe, modifier, hints) + Field(name, name, tpe, modifier, originalIndex, hints) } diff --git a/modules/codegen/src/smithy4s/codegen/internals/Renderer.scala b/modules/codegen/src/smithy4s/codegen/internals/Renderer.scala index 29194cf8a..1d3e7de9a 100644 --- a/modules/codegen/src/smithy4s/codegen/internals/Renderer.scala +++ b/modules/codegen/src/smithy4s/codegen/internals/Renderer.scala @@ -698,9 +698,19 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self => renderProtocol(product.nameRef, hints), newline, renderLenses(product, hints), + locally { + val params = + fields.sortBy(_.originalIndex).map(fieldToRenderLine(_, noDefault = true)).intercalate(Line.comma) + val args = fields.map(f => Line(f.name)).intercalate(Line.comma) + lines( + line"// constructor using the original order from the spec", + line"private def make($params): ${product.nameRef} = ${product.nameRef}($args)" + ).when(fields.nonEmpty) + }, + newline, if (fields.nonEmpty) { val renderedFields = - fields.map { case Field(fieldName, realName, tpe, modifier, hints) => + fields.sortBy(_.originalIndex).map { case Field(fieldName, realName, tpe, modifier, _, hints) => val fieldBuilder = modifier.typeMod match { case Field.TypeModification.None if modifier.required => "required" case Field.TypeModification.None => "field" @@ -727,8 +737,7 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self => if (recursive) line"$recursive_($struct_" else line"$struct_" line"${schemaImplicit}val schema: $Schema_[${product.nameRef}] = $definition" .args(renderedFields) - .block(line"${product.nameRef}.apply") - .appendToLast(".withId(id).addHints(hints)") + .appendToLast("(make).withId(id).addHints(hints)") .appendToLast(if (recursive) ")" else "") } else { val definition = @@ -737,7 +746,7 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self => line"${schemaImplicit}val schema: $Schema_[${product.nameRef}] = $definition" .args(renderedFields) .block( - line"arr => new ${product.nameRef}".args( + line"arr => make".args( fields.zipWithIndex.map { case (field, idx) => line"arr($idx).asInstanceOf[${Line.fieldType(field)}]" } diff --git a/modules/codegen/src/smithy4s/codegen/internals/SmithyToIR.scala b/modules/codegen/src/smithy4s/codegen/internals/SmithyToIR.scala index f3954b136..08054d5b8 100644 --- a/modules/codegen/src/smithy4s/codegen/internals/SmithyToIR.scala +++ b/modules/codegen/src/smithy4s/codegen/internals/SmithyToIR.scala @@ -1035,12 +1035,13 @@ private[codegen] class SmithyToIR(model: Model, namespace: String) { hintsExtractor(member) ++ default ++ noDefault ) } + .zipWithIndex .collect { - case (name, Some(tpe: Type.ExternalType), modifier, hints) => + case ((name, Some(tpe: Type.ExternalType), modifier, hints), index) => val newHints = hints.filterNot(_ == tpe.refinementHint) - Field(name, tpe, modifier, newHints) - case (name, Some(tpe), modifier, hints) => - Field(name, tpe, modifier, hints) + Field(name, tpe, modifier, index, newHints) + case ((name, Some(tpe), modifier, hints), index) => + Field(name, tpe, modifier, index, hints) } .toList @@ -1234,13 +1235,13 @@ private[codegen] class SmithyToIR(model: Model, namespace: String) { val structFields = struct.getFieldsPlain val fieldNames = struct.getFieldsPlain.map(_.name) val fields: List[TypedNode.FieldTN[NodeAndType]] = structFields.map { - case Field(_, realName, tpe, mod, _) + case Field(_, realName, tpe, mod, _, _) if mod.typeMod == Field.TypeModification.None => val node = map.get(realName).getOrElse { mod.default.get.node } // value or default must be present if type is not wrapped TypedNode.FieldTN.RequiredTN(NodeAndType(node, tpe)) - case Field(_, realName, tpe, _, _) => + case Field(_, realName, tpe, _, _, _) => map.get(realName) match { case Some(node) => TypedNode.FieldTN.OptionalSomeTN(NodeAndType(node, tpe)) diff --git a/modules/codegen/test/src/smithy4s/codegen/internals/DefaultRenderModeSpec.scala b/modules/codegen/test/src/smithy4s/codegen/internals/DefaultRenderModeSpec.scala index 7c5de4302..2ecfaa8c3 100644 --- a/modules/codegen/test/src/smithy4s/codegen/internals/DefaultRenderModeSpec.scala +++ b/modules/codegen/test/src/smithy4s/codegen/internals/DefaultRenderModeSpec.scala @@ -64,6 +64,9 @@ final class DefaultRenderModeSpec extends munit.FunSuite { | | val hints: Hints = Hints.empty | + | // constructor using the original order from the spec + | private def make(one: Option[String], two: String, three: String, four: String, five: Option[Nullable[String]], six: Nullable[String], seven: Nullable[String], eight: Nullable[String]): Test = Test(one, two, three, four, five, six, seven, eight) + | | implicit val schema: Schema[Test] = struct( | string.optional[Test]("one", _.one), | string.field[Test]("two", _.two).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), @@ -73,9 +76,7 @@ final class DefaultRenderModeSpec extends munit.FunSuite { | string.nullable.field[Test]("six", _.six).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), | string.nullable.field[Test]("seven", _.seven).addHints(smithy.api.Default(smithy4s.Document.nullDoc)), | string.nullable.required[Test]("eight", _.eight), - | ){ - | Test.apply - | }.withId(id).addHints(hints) + | )(make).withId(id).addHints(hints) |}""".stripMargin TestUtils.runTest(smithy, scalaCode) @@ -127,18 +128,19 @@ final class DefaultRenderModeSpec extends munit.FunSuite { | | val hints: Hints = Hints.empty | + | // constructor using the original order from the spec + | private def make(one: Option[String], two: String, three: String, four: String, five: Option[Nullable[String]], six: Nullable[String], seven: Nullable[String], eight: Nullable[String]): Test = Test(two, three, four, six, seven, eight, one, five) + | | implicit val schema: Schema[Test] = struct( + | string.optional[Test]("one", _.one), | string.field[Test]("two", _.two).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), | string.required[Test]("three", _.three), | string.required[Test]("four", _.four).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), + | string.nullable.optional[Test]("five", _.five), | string.nullable.field[Test]("six", _.six).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), | string.nullable.field[Test]("seven", _.seven).addHints(smithy.api.Default(smithy4s.Document.nullDoc)), | string.nullable.required[Test]("eight", _.eight), - | string.optional[Test]("one", _.one), - | string.nullable.optional[Test]("five", _.five), - | ){ - | Test.apply - | }.withId(id).addHints(hints) + | )(make).withId(id).addHints(hints) |}""".stripMargin TestUtils.runTest(smithy, scalaCode) @@ -192,18 +194,19 @@ final class DefaultRenderModeSpec extends munit.FunSuite { | | val hints: Hints = Hints.empty | + | // constructor using the original order from the spec + | private def make(one: Option[String], two: String, three: String, four: String, five: Option[Nullable[String]], six: Nullable[String], seven: Nullable[String], eight: Nullable[String]): Test = Test(three, eight, two, four, six, seven, one, five) + | | implicit val schema: Schema[Test] = struct( - | string.required[Test]("three", _.three), - | string.nullable.required[Test]("eight", _.eight), + | string.optional[Test]("one", _.one), | string.field[Test]("two", _.two).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), + | string.required[Test]("three", _.three), | string.required[Test]("four", _.four).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), + | string.nullable.optional[Test]("five", _.five), | string.nullable.field[Test]("six", _.six).addHints(smithy.api.Default(smithy4s.Document.fromString("test"))), | string.nullable.field[Test]("seven", _.seven).addHints(smithy.api.Default(smithy4s.Document.nullDoc)), - | string.optional[Test]("one", _.one), - | string.nullable.optional[Test]("five", _.five), - | ){ - | Test.apply - | }.withId(id).addHints(hints) + | string.nullable.required[Test]("eight", _.eight), + | )(make).withId(id).addHints(hints) |} |""".stripMargin diff --git a/modules/codegen/test/src/smithy4s/codegen/transformers/AwsStandardTypesTransformerSpec.scala b/modules/codegen/test/src/smithy4s/codegen/transformers/AwsStandardTypesTransformerSpec.scala index b88f25d17..d5cd704a9 100644 --- a/modules/codegen/test/src/smithy4s/codegen/transformers/AwsStandardTypesTransformerSpec.scala +++ b/modules/codegen/test/src/smithy4s/codegen/transformers/AwsStandardTypesTransformerSpec.scala @@ -87,13 +87,14 @@ final class AwsStandardTypesTransformerSpec extends munit.FunSuite { | | val hints: Hints = Hints.empty | + | // constructor using the original order from the spec + | private def make(i: Int, d: Option[Date], l: Option[Long]): TestStructure = TestStructure(i, d, l) + | | implicit val schema: Schema[TestStructure] = struct( | int.required[TestStructure]("i", _.i), | Date.schema.optional[TestStructure]("d", _.d), | Long.schema.optional[TestStructure]("l", _.l), - | ){ - | TestStructure.apply - | }.withId(id).addHints(hints) + | )(make).withId(id).addHints(hints) |}""".stripMargin ) } @@ -149,11 +150,12 @@ final class AwsStandardTypesTransformerSpec extends munit.FunSuite { | | val hints: Hints = Hints.empty | + | // constructor using the original order from the spec + | private def make(s: Option[String]): TestStructure = TestStructure(s) + | | implicit val schema: Schema[TestStructure] = struct( | string.validated(smithy.api.Length(min = Some(5L), max = Some(10L))).optional[TestStructure]("s", _.s), - | ){ - | TestStructure.apply - | }.withId(id).addHints(hints) + | )(make).withId(id).addHints(hints) |}""".stripMargin ) } @@ -211,11 +213,12 @@ final class AwsStandardTypesTransformerSpec extends munit.FunSuite { | | val hints: Hints = Hints.empty | + | // constructor using the original order from the spec + | private def make(i: Int): TestStructure = TestStructure(i) + | | implicit val schema: Schema[TestStructure] = struct( | int.field[TestStructure]("i", _.i).addHints(smithy.api.Default(smithy4s.Document.fromDouble(5.0d))), - | ){ - | TestStructure.apply - | }.withId(id).addHints(hints) + | )(make).withId(id).addHints(hints) |}""".stripMargin ) }