Skip to content

Commit

Permalink
Merge pull request #1583 from disneystreaming/september-2024-0.18-sync
Browse files Browse the repository at this point in the history
September 2024 0.18 sync
  • Loading branch information
kubukoz authored Sep 11, 2024
2 parents 2a3f689 + d5e8963 commit 6b7ac73
Show file tree
Hide file tree
Showing 18 changed files with 921 additions and 113 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ jobs:
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.S01_SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.S01_SONATYPE_USERNAME }}

microsite:
name: Publish Docs Microsite
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Previously they'd be named after the **member target**, now they will use the na

There's usually only one instance of `EncoderK[F, A]` for a particular `F[_]`, and interpreters don't need to know what `A` is. For convenience, the type parameter has been moved to a type member.

# 0.18.24

* Adds missing nanoseconds in Document encoding of EPOCH_SECOND timestamps
* Add support for `alloy#jsonUnknown`, allowing structures to capture unknown JSON fields in one of their members.
* Add `getMessage` implementation in `Smithy4sThrowable` which will be overridden in cases where the error structure contains a message field, but otherwise will be used to prevent a useless `null` result when `getMessage` is called.

# 0.18.23

## Validated newtypes [#1454](https://github.com/disneystreaming/smithy4s/pull/1454)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,52 +54,51 @@
"TestBiggerUnion": {
"oneOf": [
{
"allOf": [
{
"$ref": "#/components/schemas/One"
},
{
"type": "object",
"properties": {
"tpe": {
"type": "string",
"enum": [
"one"
]
}
},
"required": [
"tpe"
]
}
]
"$ref": "#/components/schemas/TestBiggerUnionOne"
},
{
"allOf": [
{
"$ref": "#/components/schemas/Two"
},
{
"type": "object",
"properties": {
"tpe": {
"type": "string",
"enum": [
"two"
]
}
},
"required": [
"tpe"
]
}
]
"$ref": "#/components/schemas/TestBiggerUnionTwo"
}
],
"discriminator": {
"propertyName": "tpe"
"propertyName": "tpe",
"mapping": {
"one": "#/components/schemas/TestBiggerUnionOne",
"two": "#/components/schemas/TestBiggerUnionTwo"
}
}
},
"TestBiggerUnionMixin": {
"type": "object",
"properties": {
"tpe": {
"type": "string"
}
},
"required": [
"tpe"
]
},
"TestBiggerUnionOne": {
"allOf": [
{
"$ref": "#/components/schemas/One"
},
{
"$ref": "#/components/schemas/TestBiggerUnionMixin"
}
]
},
"TestBiggerUnionTwo": {
"allOf": [
{
"$ref": "#/components/schemas/Two"
},
{
"$ref": "#/components/schemas/TestBiggerUnionMixin"
}
]
},
"Two": {
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package smithy4s.example

import smithy4s.Document
import smithy4s.Hints
import smithy4s.Newtype
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.schema.Schema.bijection
import smithy4s.schema.Schema.document
import smithy4s.schema.Schema.map
import smithy4s.schema.Schema.string

object AdditionalProperties extends Newtype[Map[String, Document]] {
val id: ShapeId = ShapeId("smithy4s.example", "AdditionalProperties")
val hints: Hints = Hints.empty
val underlyingSchema: Schema[Map[String, Document]] = map(string, document).withId(id).addHints(hints)
implicit val schema: Schema[AdditionalProperties] = bijection(underlyingSchema, asBijection)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package smithy4s.example

import smithy4s.Document
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.int
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct

final case class JsonUnknownExample(s: Option[String] = None, i: Option[Int] = None, additionalProperties: Option[Map[String, Document]] = None)

object JsonUnknownExample extends ShapeTag.Companion[JsonUnknownExample] {
val id: ShapeId = ShapeId("smithy4s.example", "JsonUnknownExample")

val hints: Hints = Hints.empty

// constructor using the original order from the spec
private def make(s: Option[String], i: Option[Int], additionalProperties: Option[Map[String, Document]]): JsonUnknownExample = JsonUnknownExample(s, i, additionalProperties)

implicit val schema: Schema[JsonUnknownExample] = struct(
string.optional[JsonUnknownExample]("s", _.s),
int.optional[JsonUnknownExample]("i", _.i),
AdditionalProperties.underlyingSchema.optional[JsonUnknownExample]("additionalProperties", _.additionalProperties).addHints(alloy.JsonUnknown()),
)(make).withId(id).addHints(hints)
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ package object example {

/** This is a simple example of a "quoted string" */
type AString = smithy4s.example.AString.Type
type AdditionalProperties = smithy4s.example.AdditionalProperties.Type
type Age = smithy4s.example.Age.Type
/** Multiple line doc comment for another string
* Containing a random \*\/ here.
Expand Down
Loading

0 comments on commit 6b7ac73

Please sign in to comment.