-
Notifications
You must be signed in to change notification settings - Fork 75
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
Unwrap Operation output when its structure contains a single field #1627
Comments
Smithy4s doesn't support flattening output types, so you're right, this is currently not possible. It could be added with a trait similar to With What's the usecase, in the bigger picture? |
Ultimately, I think it's just an ergonomics thing. When I wrote up this issue I was focused on recreating a specific interface, so getting to Adding an extra
When a response structure only contains a single field, I would suggest unwrapping it be the default, with the current behavior made optional using a |
OK, I see your point of view now. Indeed, I'm concerned about changing default behavior, but let's see whether this whole thing is something we should do first - @Baccata thoughts? |
Yeah we ain't gonna change the default behaviour, but we could certainly add an |
@bpholt this is up for grabs, then - if you'd like to pick it up, let me know if you need assistance |
NB : I've still not managed to get a corporate CLA, which @bpholt had asked for. I think this contribution would be substantial enough to warrant a signature, but at the same time it's a low-hanging-fruit. |
I'm experimenting with using Smithy4s to define algebras using Smithy, and then generating all the typical stuff, to replace existing code that looks like this:
Everything works pretty well, except that I haven't been able to figure out how to make
getFooById
returnF[Option[Foo]]
. I can have it emitF[Foo]
, orF[GetFooByIdOutput]
with acase class GetFooByIdOutput(output: Option[Foo])
, but I can't strip out the wrapper class without losing the optionality.Am I correct in understanding that it is not currently possible to write a Smithy file that Smithy4s would generate output like I'm looking for?
(This would also come up if I wanted to return
F[List[Foo]]
, I think, because I tried writing an unwrapped type refinement to turnList[Foo]
intoOption[Foo]
and then havebut that doesn't work, because operation shape
output
relationships must target a structure shape.)The text was updated successfully, but these errors were encountered: