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

AWS: Latest Location service can't be compiled (could not find implicit value for parameter constraint: smithy4s.RefinementProvider) #1594

Closed
kubukoz opened this issue Sep 26, 2024 · 2 comments · Fixed by #1595
Assignees
Labels
AWS support Issues related to AWS support bug Something isn't working

Comments

@kubukoz
Copy link
Member

kubukoz commented Sep 26, 2024

To reproduce:

  1. generate code for this: https://github.com/aws/aws-sdk-js-v3/blob/b06a8b7d9d2a0ca2fc73acdbf37220575b0f1945/codegen/sdk-codegen/aws-models/location.json (making sure to include the fix from Include field modifiers in collision avoidance #1593)
  2. Set smithy4sAllowedNamespaces so that the generated code also includes aws.cloudformation and smithy.rules (which would normally be excluded)
  3. Try to compile

Result:

[error] main/smithy4s/com/amazonaws/location/BatchGetDevicePositionRequest.scala:32:34: could not find implicit value for parameter constraint: smithy4s.RefinementProvider.Simple[smithy.api.Length,com.amazonaws.location.ResourceName]
[error]     ResourceName.schema.validated(smithy.api.Length(min = Some(1L), max = None)).required[BatchGetDevicePositionRequest]("TrackerName", _.trackerName).addHints(smithy.api.Documentation("<p>The tracker resource retrieving the device position.</p>"), smithy.api.HttpLabel()),
[error]                                  ^
[error] main/smithy4s/com/amazonaws/location/BatchGetDevicePositionRequest.scala:34:5: missing argument list for method make in object BatchGetDevicePositionRequest
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing `make _` or `make(_,_)` instead of `make`.
[error]   )(make).withId(id).addHints(hints)
[error]     ^
[error] main/smithy4s/com/amazonaws/location/SearchPlaceIndexForSuggestionsRequest.scala:95:37: could not find implicit value for parameter constraint: smithy4s.RefinementProvider.Simple[smithy.api.Length,com.amazonaws.location.SensitiveString]
[error]     SensitiveString.schema.validated(smithy.api.Length(min = Some(1L), max = Some(200L))).required[SearchPlaceIndexForSuggestionsRequest]("Text", _.text).addHints(smithy.api.Documentation("<p>The free-form partial text to use to generate place suggestions. For example,\n                <code>eiffel tow</code>.</p>")),
[error]                                     ^
[error] main/smithy4s/com/amazonaws/location/SearchPlaceIndexForSuggestionsRequest.scala:103:5: missing argument list for method make in object SearchPlaceIndexForSuggestionsRequest
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing `make _` or `make(_,_,_,_,_,_,_,_,_)` instead of `make`.
[error]   )(make).withId(id).addHints(hints)
[error]     ^
[error] main/smithy4s/com/amazonaws/location/SearchPlaceIndexForTextRequest.scala:94:37: could not find implicit value for parameter constraint: smithy4s.RefinementProvider.Simple[smithy.api.Length,com.amazonaws.location.SensitiveString]
[error]     SensitiveString.schema.validated(smithy.api.Length(min = Some(1L), max = Some(200L))).required[SearchPlaceIndexForTextRequest]("Text", _.text).addHints(smithy.api.Documentation("<p>The address, name, city, or region to be used in the search in free-form text format.\n            For example, <code>123 Any Street</code>.</p>")),
[error]                                     ^
[error] main/smithy4s/com/amazonaws/location/SearchPlaceIndexForTextRequest.scala:102:5: missing argument list for method make in object SearchPlaceIndexForTextRequest
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing `make _` or `make(_,_,_,_,_,_,_,_,_)` instead of `make`.
[error]   )(make).withId(id).addHints(hints)
[error]     ^
[error] 6 errors found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 1 s, completed Sep 27, 2024, 1:24:14AM

Looking for a smaller reproduction, but I think we're dealing with a problem that affects member refinements applied to newtypes (specifically @length).

@kubukoz kubukoz added the AWS support Issues related to AWS support label Sep 26, 2024
@kubukoz
Copy link
Member Author

kubukoz commented Sep 26, 2024

well, the minimal repro is embarrassingly simple:

$version: "2"

namespace hello

string Foo

structure HasFoo {
    @length(min: 1)
    @required
    s: Foo
}

I think this has simply never worked as we didn't think to implement refinements on newtypes 😅

@kubukoz kubukoz added the bug Something isn't working label Sep 26, 2024
kubukoz added a commit that referenced this issue Sep 26, 2024
@kubukoz
Copy link
Member Author

kubukoz commented Sep 26, 2024

Update: looks like we did think about it, in #1283. We just... didn't add tests. I don't think it's ever worked, fix incoming.

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

Successfully merging a pull request may close this issue.

1 participant