Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove smithy4sRenderOptics setting from plugins #1566

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ 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.

## Remove `smithy4sRenderOptics` setting from SBT and Mill plugins in [#1566](https://github.com/disneystreaming/smithy4s/pull/1566)

Optics can still be rendered using metadata (global) and traits (selective), the only thing that's been removed is configuration in the build tool.

# Removed `UnknownErrorResponse` in [#1570](https://github.com/disneystreaming/smithy4s/pull/1570)

The error type `smithy4s.http.UnknownErrorResponse` has been replaced with `smithy4s.http.RawErrorResponse`, which provides a more accurate description of an error response that failed to decode, including a full representation of the response code, headers, body and the discriminator if one was found.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ object Smithy4sCodegenPlugin extends AutoPlugin {
"String value to use as wildcard argument in types in generated code"
)

val smithy4sRenderOptics =
taskKey[Boolean](
"Boolean value to indicate whether or not to generate optics"
)

val smithy4sGeneratedSmithyFiles =
taskKey[Seq[File]](
"Generated smithy files"
Expand Down Expand Up @@ -259,15 +254,14 @@ object Smithy4sCodegenPlugin extends AutoPlugin {
case _ => "_"
}
},
config / smithy4sRenderOptics := false,
config / smithy4sGeneratedSmithyMetadataFile := {
(config / sourceManaged).value / "smithy" / "generated-metadata.smithy"
},
config / smithy4sGeneratedSmithyFiles := {
val cacheFactory = (config / streams).value.cacheStoreFactory
val cached = Tracked.inputChanged[(String, Boolean), Seq[File]](
val cached = Tracked.inputChanged[String, Seq[File]](
cacheFactory.make("smithy4sGeneratedSmithyFilesInput")
) { case (changed, (wildcardArg, shouldGenerateOptics)) =>
) { case (changed, (wildcardArg)) =>
val lastOutput = Tracked.lastOutput[Boolean, Seq[File]](
cacheFactory.make("smithy4sGeneratedSmithyFilesOutput")
) { case (changed, prevResult) =>
Expand All @@ -278,7 +272,6 @@ object Smithy4sCodegenPlugin extends AutoPlugin {
file,
s"""$$version: "2"
|metadata smithy4sWildcardArgument = "$wildcardArg"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: I would consider dropping smithy4sWildcardArgument too, we should use * and ask people to enable -Xsource:3 or -Xsource:3-cross.

|metadata smithy4sRenderOptics = $shouldGenerateOptics
|""".stripMargin
)
Seq(file)
Expand All @@ -289,8 +282,7 @@ object Smithy4sCodegenPlugin extends AutoPlugin {
lastOutput(changed)
}
val wildcardArg = (config / smithy4sWildcardArgument).value
val generateOptics = (config / smithy4sRenderOptics).value
cached((wildcardArg, generateOptics))
cached(wildcardArg)
},
config / sourceGenerators += (config / smithy4sCodegen).map(
_.filter(_.ext == "scala")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ title: Optics - Lenses and Prisms

Smithy4s has the ability to render optics (Lens/Prism) instances in the code it generates.

If you're using Smithy4s via `mill` or `sbt`, then you can enable this functionality with the following keys:

* in mill, task: `def smithy4sRenderOptics = true`
* in sbt, setting: `smithy4sRenderOptics := true`

If you are using Smithy4s via the CLI, then they way to utilize this feature is through your Smithy specifications. The simplest approach is to add a file with the following content to your CLI invocation:
The way to enable this feature is through your Smithy specifications.
The simplest approach is to add a file with the following content to your CLI invocation:

```kotlin
$version: "2"
Expand Down