Releases: disneystreaming/smithy4s
v0.17.4: more efficient ArraySeq json parsing
0.17.4
Improvements
More efficient Json parsing of ArraySeq
See #806
Fix parsing logic of AWS credentials file to allow for comments
See #811
Add documentation on how to point AWS clients to local environments
See #812
What's Changed
- Update circe-generic, circe-parser to 0.14.4 by @scala-steward in #805
- Update jsoniter-scala-core to 2.20.7 by @scala-steward in #804
- More efficient parsing of
ArraySeq
by @plokhotnyuk in #806 - Update fs2-core, fs2-io to 3.6.1 by @scala-steward in #803
- Fix reference in model-processing.md by @etspaceman in #808
- Fix skip comments when parsing ~/.aws/credentials by @lolgab in #811
- Localstack docs by @Baccata in #812
New Contributors
Full Changelog: v0.17.3...v0.17.4
v0.17.3: Scaladocs, easier ADTs, Scala 3 wildcards, easier AWS SDK usage
0.17.3
This release is backward binary-compatible with the previous releases from the 0.17.x lineage.
General announcements
- We are opening a public Discord server for users to ask questions about Smithy4s and the Smithy ecosystem in general
- We are lowering the barrier of entry to use Smithy4s as an AWS SDK. Go check out the docs 😄
User-facing features
Addition of an new @adt
trait to streamline the inlining of structures as sealed-trait members
Under certain conditions, it is now possible to annotate union shapes with @adt
, which has the effect of inlining
all the structure shapes under it directly in the companion object of the union, as opposed to create Case
-suffixed
wrappers. Additionally, when a union is annotated with @adt
, the intersection of mixin shapes that are applied to every member of the union is now used as Scala-level mixin traits. This facilitates object-oriented usage of Smithy4s.
Read the new docs for more info.
See #787
Scaladoc now gets generated
Smithy @documentation
traits (which has syntactic sugar in the form of triple-slashes-prefixed comments) is now used to generate Scaladoc above the relevant data-types, interfaces and methods that get generated in Smithy4s.
Thank you @zetashift for this awesome contribution and @msosnicki for this valuable contribution !
Scala 3 wildcards now get generated when relevant.
Under conditions which should automatically be propagated from the build-tool to the code-generation,
Scala 3 wildcards now get generated instead of Scala 2 wildcards. This makes user experience better on
Scala 3, as syntax deprecation warnings will no longer be issued.
Thank you @albertpchen for this awesome contribution !
See #736
Simpler AWS clients
It is now possible to directly instantiate AWS clients against a Monadic context, which makes for a better
UX when calling unary request/response operations. When using that mode, stream operations being called
such clients will fail with a raised exception.
See #744
AWS config file credentials providers
It is now possible to load credentials from an AWS-compliant configuration file (typically found under ~/.aws/credentials).
This is wired by default in the clients, and has lower precedence than the other providers.
Improve docs
We've improved and added new sections to the documentation, in particular around AWS SDK usage and model pre-processing.
Bug fixes
Null default value traits are now correctly handled
The default trait allows for not setting a value. Now, the absence of value (ie null) in the
default trait at the smithy level translates to the correct "zero" value of the target type.
See #782
Decoding Document.DNull to Optional fields now works correctly
Null documents were not being decoded as None
, but rather were leading to decoding failures
when decoding data types from smithy4s.Document
See #725
Fix the JS source-map URI
The URI was previously using the wrong relative path
See #740
Traits applied on collection members now leads to hints being correctly generated
See #769
Defaults are not ignored in refinements
Loading a smithy 1.0 model with smithy 2.0 tooling (which Smithy4s uses) leads to the automatic
addition of "default" traits on some shapes and members. When combined with refinements, this had
the side effect of treating the refined type as required when it should be in fact optional.
It's all the more confusing that there is no mechanism in place to reconcile refinement logic,
with default values, as refinement logic is expressed in run-time code whereas default value validation
is expressed in build-time code.
See #795
Other notable changes
Performance improvements of the json parsing logic
Yet another awesome contribution from @plokhotnyuk to shave allocations off the Json parsing logic, leading
to performance improvements.
See #764
Compliance tests
Our implementation of our alloy#simpleRestJson
protocol is now derived automatically from test specifications
written in Smithy itself
See:
This also paves the road for testing our implementation of the AWS protocols using official tests, which are located
[there]
Generic logic against smithy4s-generated enumerations is now easier to write
Some tweaks were made to the smithy4s.Enumeration.Value
interface to allow for more generic logic using enumerations.
See #794
PR List
- Update fs2-core to 3.4.0 by @scala-steward in #625
- Update jsoniter-scala-core to 2.20.3 by @scala-steward in #724
- Fix decoding an optional
Document.DNull
field by @zetashift in #725 - Tweak background highlight color by @daddykotex in #733
- Split out "default rendering" page by @kubukoz in #734
- Help scala-steward and manually bump alloy-core by @daddykotex in #735
- Update cats-effect to 3.4.5 by @scala-steward in #738
- Actually fix sourcemaps by @zetashift in #740
- add yourkit credit by @lewisjkl in #741
- Add documentation post about protocols by @lewisjkl in #719
- Add yourkit acknowledgments by @Baccata in #742
- Adds protocol compliance tests to the Http4s module by @yisraelU in #715
- [AWS] Awscall to F[_] Transformation #730 by @yisraelU in #744
- Smithy resources for dynamic module by @msosnicki in #743
- Add renderer option to change wildcard type arg by @albertpchen in #736
- Update alloy-core, alloy-openapi to 0.1.9 by @scala-steward in #753
- Update http4s-circe, http4s-client, ... to 0.23.18 by @scala-steward in #754
- Document smithy4sWildcardArgument by @daddykotex in #749
- testing smithy4s apis - docs by @lewisjkl in #748
- Update mill-main, mill-main-api, ... to 0.10.11 by @scala-steward in #758
- Fixes a bug that prevent the inclusion of upstream libraries by @Baccata in #757
- Load file from credentials file (~/.aws/credentials) by @daddykotex in #756
- Update sbt-sonatype to 3.9.16 by @scala-steward in #763
- Update sbt-sonatype to 3.9.17 by @scala-steward in #768
- Update nscplugin, sbt-scala-native, ... to 0.4.10 by @scala-steward in #767
- known issues documentation by @lewisjkl in #765
- Generate scaladoc for
@documentation
trait by @zetashift in #731 - Generate hints for collection members by @albertpchen in #769
- Update sbt-scalajs, scalajs-compiler, ... to 1.13.0 by @scala-steward in #762
- Update smithy-build, smithy-model to 1.27.1 by @scala-steward in #739
- More efficient parsing of json objects and arrays by @plokhotnyuk in #764
- Fix collection hint generation by @kubukoz in #775
- Fix missing struct member docs bug by @msosnicki in #776
- Fix typo in 01-smithy-idl by @zetashift in #777
- Adding operation @param documentation by @msosnicki in #781
- Update sbt-jmh to 0.4.4 by @scala-steward in #784
- Update smithy-build, smithy-model to 1.27.2 by @scala-steward in #785
- Add more docs on assembly by @etspaceman in #786
- Update cats-effect to 3.4.6 by @scala-steward in #788
- Upgrade to latest coursier by @cb372 in #790
- Dynamic compliance tests by @yisraelU in #747
- F...
v0.17.2 : errors as scala3 unions, js sourcemaps
0.17.2
This release is backward binary-compatible with the previous releases from the the 0.17.x lineage.
User-facing features
Scala 3 unions support for operation errors
See #707
In order to render Operation errors as Scala 3 union types, a following metadata flag needs to be added: metadata smithy4sErrorsAsScala3Unions = true
(in any of the smithy files that are used for code generation).
Source-mapping github paths are now automatically added during scala-js compilation
This will make it easier to run front-end debuggers on webpage build with smithy4s-issued clients
See #706
Addition of Transformation.apply utilty method :
it's now possible to invoke transformations more conveniently in polymorhic code, via a method in the Transformation
companion object
See #681
Bug fixes
Static query params are now handled correctly
It is now possible to define static query parameters when using the http trait :
@http(method: "GET", uri: "/foo?bar=baz)
operation Foo {}
Service interfaces now receive the set of all operations tied to resources transitively tied to the service
For instance, when running the code-generator, the Library
interface will now receive a getBook
method, which
wasn't previously the case
service Library {
resources: [Book]
}
resource Book {
read: GetBook
}
@readonly
operation GetBook {
}
New
- Various codegen fixes and improvements by @Baccata in #677
- fix for timestamp format issue for aws tests by @yisraelU in #675
- Make whitespace around colons consistent by @kubukoz in #682
- Update decline to 2.4.1 by @scala-steward in #683
- Add resource operations to generated service by @Baccata in #686
- Fix links to target series/0.17 blob by @lewisjkl in #684
- Add a more convenient Transformation.PartiallyApplied by @kubukoz in #681
- Update cats-effect to 3.4.3 by @scala-steward in #694
- Update mill-main, mill-main-api, ... to 0.10.10 by @scala-steward in #696
- Update cats-effect to 3.4.4 by @scala-steward in #699
- Update jsoniter-scala-core to 2.20.1 by @scala-steward in #695
- fix path segment parsing when suffixed with query by @yisraelU in #689
- Compliancetests fixes improvements by @yisraelU in #680
- restructured timeout call and attemptNarrow by @yisraelU in #708
- Update http4s-circe, http4s-client, ... to 0.22.15 by @scala-steward in #709
- Update sbt, sbt-dependency-tree to 1.8.2 by @scala-steward in #711
- Add scalacOptions for sourcemapping github paths by @zetashift in #706
- Add smithy4sErrorsAsScala3Unions metadata flag by @msosnicki in #707
- Update http4s-circe, http4s-client, ... to 0.23.17 by @scala-steward in #710
- [compliance tests] addresses timeouts on the server side by @yisraelU in #712
- Fix ShapeId.parse not working for valid shapes by @kubukoz in #714
- codegen cli should use a non-zero exit code when failing by @daddykotex in #713
New Contributors
- @msosnicki made their first contribution in #707
Full Changelog: v0.17.1...v0.17.2
v0.17.1 : dependency fetching bugfix
- Fixes a bug that would lead the SBT resolver to try and fetch dependencies with the wrong binary version of Scala. See #672
- Fixes a bug in the compliance test module when tests would fail because json object would exhibit different key ordering. See #664
- Adds a pprint dependency to the compliance test module in order to make value mismatches clearer. See #663
What's Changed
- Update weaver-cats, weaver-scalacheck to 0.8.1 by @scala-steward in #659
- Update sbt-git to 2.0.1 by @scala-steward in #661
- Update jsoniter-scala-core to 2.18.1 by @scala-steward in #660
- Update sbt-pgp to 2.2.1 by @scala-steward in #662
- escape quotes in string literal by @yisraelU in #658
- Compliance tests jsonfix by @yisraelU in #664
- Update cats-core to 2.9.0 by @scala-steward in #668
- Update scala-collection-compat to 2.9.0 by @scala-steward in #667
- Update jsoniter-scala-core to 2.19.0 by @scala-steward in #665
- add pprint library to compliance tests by @yisraelU in #663
- Update cats-effect to 3.4.2 by @scala-steward in #670
- Update jsoniter-scala-core to 2.19.1 by @scala-steward in #669
- Update swagger-ui-dist to 4.15.5 by @scala-steward in #671
- Pass scalaModuleInfo to dynamic resolution invocation by @Baccata in #672
- Adding .distinct where relevant in the sbt plugin by @Baccata in #673
Full Changelog: v0.17.0...v0.17.1
v0.17.0 : move of `smithy4s.api` shapes to `alloy` (and much more)
0.17.0
A word of warning
This Release is breaking on many levels and is therefore NOT compatible with the previous releases in any way : specifications / Scala sourcecode / binary code.
The most user-facing breakage is the move of smithy4s.api
smithy namespace to alloy
, as we've moved our definitions to a Scala-agnostic location. In theory, a project-wide string replacement of smithy4s.api
to alloy
should do the trick.
Read below for more information.
Abstract
This 0.17.0 release of Smithy4s brings a number of improvements on the abstractions implemented by the generated code, in particular in terms of flexibility and user experience.
This release also aims at bringing inter-operability with other tools and projects that Disney Streaming is putting forward to reinforce the Smithy ecosystem, such as smithy-translate and alloy.
In order to achieve these improvements, we've had to break a number of things at different levels. This release is therefore neither source nor binary compatible with the previous ones, and also forces the user to update their Smithy specifications.
Breaking changes
Smithy-level breaking changes
See #561
The Smithy shapes that were previously residing under smithy4s.api
namespace have moved to the alloy
namespace. Alloy is a standalone library containing Smithy shapes and validators, defined here.
The reason for us to bring this change is to have a language specific location to define shapes that are relevant to the protocols/runtime-behaviours we're putting forward, that could be used by tooling working with other languages than Scala. It was important for us to lose the 4s
suffix, which is short for for Scala
.
This change implies, for instance, that any use of smithy4s.api#simpleRestJson
in your specification will have to be replaced by alloy#simpleRestJson
.
Note that this change, in use cases that follow our documentation, should have no visible effect in the Scala code.
Build-plugins breaking changes (SBT/mill)
Multiple input directories
See #587
The smithy4sInputDir
setting/task in SBT/mill has been replaced by smithy4sInputDirs
, allowing the user to set several directories where the plugins should look for Smithy files.
Change in smithy-library dependency resolution
See #607
We've changed the smithy-sharing mechanism to do two things:
- By default, any dependency declared "normally" in SBT or mill, by means or
libraryDepedencies ++=
ordef ivyDeps
, will be inspected for Smithy files after being resolved. This means that, for instance, if your application has a runtime dependency on a library that was built with Smithy4s and contains Smithy files, your local specs can use the code defined in these Smithy files to create or annotate new shapes. You no longer need to declare those using% Smithy4s
ordef smithy4sIvyDeps
: these are now reserved for libraries containing Smithy files that you do not want your application's runtime to depend on. - Libraries built by Smithy4s automatically track the dependencies that they used during their own code-generation, by storing some metadata in their Jar's manifests. By default, the Smithy4s plugins will also pull those dependencies (which will have been declared upstream using
% Smithy4s
in SBT ordef smithy4sIvyDeps
in mill), for your project's code generation. This facilitates the transitivity of specification-holding artifacts. This mechanism is used, for instance, to communicate to users projects the fact that Smithy4s depends on shapes that are defined in the alloy library, and that these shapes should be made available to user projects, without impacting the user's application runtime, and without requiring any setup from the user.
Normal-usage breaking changes in the generated code
See #599
Depending on your setup, it may be a breaking change, but @deprecated
Smithy-traits now translate to the @deprectated
Scala annotation in the generated code. For instance, if you used @enum
heavily, you'll probably deprecation warnings in your console when compiling. Depending on your scalacOptions
, it is possible that these warnings turn into errors. If you want to silence these particular errors while upgrading, you can do the following:
scalacOptions ++= Seq(
"-Wconf:msg=object Enum in package api is deprecated:silent",
"-Wconf:msg=type Enum in package api is deprecated:silent",
// for Scala 3
"-Wconf:msg=object Enum in package smithy.api is deprecated:silent",
"-Wconf:msg=type Enum in package smithy.api is deprecated:silent"
)
Normal-usage source breaking changes
See #569
If you use Smithy4s in the ways that were previously advertised in the documentation, you may have to perform some small adjustments.
In particular, the simpleRestJson
extension method that was added to implementations of service-interfaces generated by Smithy4s is now removed, in favour of the SimpleRestJsonBuilder
construct (which now works for any service
Smithy shape that will have been annotated with alloy#simpleRestJson
).
Additionally, some methods that were deprecated in 0.16.x releases have been removed.
Advanced usage breaking changes
The abstractions that the generated code implements and that the runtime interpreters use have undergone some massive changes.
Non-exhaustive list of symbol renames :
old | new |
---|---|
smithy4s.Monadic | smithy4s.kinds.FunctorAlgebra |
smithy4s.Interpreter | smithy4s.kinds.FunctorInterpreter |
smithy4s.Service#asTransformation | toPolyFunction |
smithy4s.Service#transform | fromPolyFunction |
smithy4s.PolyFunction | smithy4s.kinds.PolyFunction |
smithy4s.Transformation | smithy4s.kinds.PolyFunction5 |
smithy4s.GenLift[F]#λ | smithy4s.kinds.Kind1[F]#toKind5 |
Unification of the natural-transformations/polymorphic functions.
- Smithy4s makes a lot of use of polymorphic functions of various kinds. Those are now code-generated (see the
project/Boilerplate.scala
file) to ensure the consistency of the various ways they are being used. This means thatsmithy4s.PolyFunction
has moved tosmithy4s.kinds.PolyFunction
, and that the previoussmithy4s.Transformation
is nowsmithy4s.kinds.PolyFunction5
. This decision ripples in thesmithy4s.Service
interface, which now sportstoPolyFunction
andfromPolyFunction
methods, allowing to turn a finally-encoded implementation into a final one.smithy4s.kinds.PolyFunction2
is also a thing, and may be used in bi-functor contexts. kind
-specific types were created to facilitate the "lift" of constructs to the right kinds. For instance, when inspecting the internals of this library, you might see things likeKind1[IO]#toKind5
where it was previouslyGenLift[IO]#λ
. We're hoping to convey meaning better, although this code is definitely still not trivial (and never will).smithy4s.Transformation
is now a typeclass-like construct, which expresses the fact that a construct can be applied like a function. This construct is used by thetransform
method that is generated on service interfaces, which allows to apply custom behaviour generically on all method invocations in these interfaces.- The
Service
interface takes a singleAlg
type parameter, theOp
parameter has moved to type-member position, facilitating implicit search in some contexts (as well as the writing of some logic). - A bunch of path-dependent type aliases were created in the
Service
interface. - The
compliancetest
module has changed drastically in UX. For those not aware, this module allows to run tests written in Smithy against your own implementation of protocols. This will be useful for third-party libraries that implementsimpleRestJson
(or any other http/rest like protocol), to virtually get tests for free. We don't think this module had any users so far, but we'll slowly be porting some of our tests away from thesmithy4s
repository and into thealloy
repository.
User facing improvements
Stubs
See #595
It is now possible to quickly stub a service with a default value (IO.stub
being a good candidate), which can be helpful for testing purposes. The resulting code looks like this :
import smithy4s.hello._
import cats.effect._
val stubbedHelloWorld : HelloWorldService[IO] = new HelloWorldService.Default[IO](IO.stub)
Transformations, including bi-functors
See #584
smithy4s.Transformation
has been revised to facilitate the integration with various shapes of transformations. It allows, in particular, to transform a service implementation by applying generic (but polymorphic) behaviour in all of its methods. For instance, this can be used to apply a timeout on all of the methods of a service, or retrying behaviour, etc ...
In particular, the smithy4s.Transformation
companion object contains in particular AbsorbError
and SurfaceError
interfaces that developers can leverage to get their services to go from mon...
v0.16.10
Allow credentials in coursier Fetch in the model loader in #632
Updates the internal dependency resolution mechanism to allow for Coursier credentials to be used in the smithy4s-codegen CLI.
Full Changelog: v0.16.9...v0.16.10
v0.16.9
This release includes a fix for a regression in the http4s server interpreter, as well as a couple library version updates.
Catch metadata errors in operations without an Errorable in #622
What's Changed
- Fix microsite, again by @kubukoz in #597
- Delete .gitattributes by @yisraelU in #606
- Update weaver-cats, weaver-scalacheck to 0.8.1 by @scala-steward in #617
- Update sbt-pgp to 2.2.0 by @scala-steward in #574
- Update sbt-header to 5.9.0 by @scala-steward in #608
- Update decline to 2.4.0 by @scala-steward in #610
- Update cats-effect to 3.4.1 by @scala-steward in #611
- Update cats-core to 2.9.0 by @scala-steward in #603
- Update smithy-aws-traits, smithy-build, ... to 1.26.3 by @scala-steward in #612
- Update sbt, sbt-dependency-tree to 1.8.0 by @scala-steward in #602
Full Changelog: v0.16.8...v0.16.9
v0.16.8
User-facing changes
Catch PayloadErrors in complete decoding in CodecAPI by @kubukoz in #596
Fixes a bug in which decoding failures in CodecAPI
would sometimes be thrown instead of returned in an Either
.
Other changes
- fix microsite workflow by @lewisjkl in #572
- Update swagger-ui-dist to 4.15.2 by @scala-steward in #576
- Update sbt, sbt-dependency-tree to 1.7.3 by @scala-steward in #575
- Update sbt-sonatype to 3.9.14 by @scala-steward in #577
- Update jsoniter-scala-core to 2.17.9 by @scala-steward in #578
- Update scala3-library, ... to 3.2.1 by @scala-steward in #581
- Update swagger-ui-dist to 4.15.5 by @scala-steward in #592
- Update nscplugin, sbt-scala-native, ... to 0.4.8 by @scala-steward in #591
Full Changelog: v0.16.7...v0.16.8
v0.16.7
What's changed
Use a concurrent map on JVM for the compilation cache by @Baccata in #539
Fixes a potential issue in concurrently compiling the same schema.
Client httpResponseTest for output by @daddykotex in #527
Adds support for testing response handling of a client in the compliance-tests
module.
Build http4s routers lazily by @kubukoz in #568
Fixes an issue in which an exception would be thrown instead of an Either's Left being returned in http4s clients.
Other changes
- add logo to microsite by @lewisjkl in #532
- update workflow to split out microsite publishing by @lewisjkl in #536
- Update sbt-header to 5.8.0 by @scala-steward in #543
- Update scala-library, scala-reflect to 2.12.17 by @scala-steward in #544
- Export a SMITHY_VERSION so that publish can use it by @daddykotex in #540
- Update swagger-ui-dist to 4.14.3 by @scala-steward in #548
- Update smithy-aws-traits, smithy-build, ... to 1.25.2 by @scala-steward in #549
- Update jsoniter-scala-core to 2.17.6 by @scala-steward in #552
- Update swagger-ui-dist to 4.15.0 by @scala-steward in #553
- Update sbt, sbt-dependency-tree to 1.7.2 by @scala-steward in #546
- Update scala-library, scala-reflect to 2.13.10 by @scala-steward in #545
Full Changelog: v0.16.6...v0.16.7
v0.16.6 : fix document encoder for maps with newtype keys
Fixes a bug that would have Document encoders believe that string-newtypes should be treated as complex types when encoding maps.
See 0690bdf
I accidentally pushed a commit to main, but I'm rolling with it (I obviously went and changed the branch protection to protect against that in the future)