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

Using Set as operation name causes compilation failures #389

Closed
keynmol opened this issue Aug 20, 2022 · 0 comments · Fixed by #393
Closed

Using Set as operation name causes compilation failures #389

keynmol opened this issue Aug 20, 2022 · 0 comments · Fixed by #393
Labels
bug Something isn't working

Comments

@keynmol
Copy link
Contributor

keynmol commented Aug 20, 2022

The quickest way to reproduce is with Scala CLI

test.smithy

$version: "2.0"

namespace hellosmithy4s.spec

use smithy4s.api#simpleRestJson

@simpleRestJson
service HelloService {
  version: "1.0.0",
  operations: [Set]
}

@http(method: "POST", uri: "/api/update/{key}", code: 204)
operation Set {
  input := {
    @httpLabel
    @required
    key: Key,

    value: Value
  }
}

string Key
integer Value
> cs launch --channel https://disneystreaming.github.io/coursier.json smithy4s -- generate test.smithy
Aug 20, 2022 5:02:18 PM software.amazon.smithy.openapi.fromsmithy.mappers.RemoveUnusedComponents removalRound
INFO: Removing unused OpenAPI components: [#/components/schemas/SetInput]
/private/var/folders/my/drt5584s2w59ncgxgxpq7v040000gn/T/tmp.07Z3NfFw/hellosmithy4s/spec/SetInput.scala
/private/var/folders/my/drt5584s2w59ncgxgxpq7v040000gn/T/tmp.07Z3NfFw/hellosmithy4s/spec/Value.scala
/private/var/folders/my/drt5584s2w59ncgxgxpq7v040000gn/T/tmp.07Z3NfFw/hellosmithy4s/spec/HelloService.scala
/private/var/folders/my/drt5584s2w59ncgxgxpq7v040000gn/T/tmp.07Z3NfFw/hellosmithy4s.spec.HelloService.json
/private/var/folders/my/drt5584s2w59ncgxgxpq7v040000gn/T/tmp.07Z3NfFw/hellosmithy4s/spec/package.scala
/private/var/folders/my/drt5584s2w59ncgxgxpq7v040000gn/T/tmp.07Z3NfFw/hellosmithy4s/spec/Key.scala

Error

/v/f/m/d/T/tmp.07Z3NfFw > scala-cli compile . --dep "com.disneystreaming.smithy4s::smithy4s-http4s:0.15.0"
Compiling project (Scala 3.1.3, JVM)
[error] ./hellosmithy4s/spec/HelloService.scala:45:60: Found:    hellosmithy4s.spec.SetInput
[error] Required: hellosmithy4s.spec.Key
[error]     def _Set(key: Key, value: Option[Value] = None) = _Set(SetInput(key, value))
[error]                                                            ^^^^^^^^^^^^^^^^^^^^
Error compiling project (Scala 3.1.3, JVM)

Workaround - renaming Set to Update fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant