-
Notifications
You must be signed in to change notification settings - Fork 77
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
Implement scalaImports
trait
#1550
Implement scalaImports
trait
#1550
Conversation
This also update SmithyToIR to convert ScalaImportsTrait pojo to Hint ADT
0a7c0fe
to
ca34324
Compare
modules/protocol/resources/META-INF/smithy/smithy4s.meta.smithy
Outdated
Show resolved
Hide resolved
modules/protocol/resources/META-INF/smithy/smithy4s.meta.smithy
Outdated
Show resolved
Hide resolved
85835cc
to
8116bc0
Compare
Looks good to me. The only other thing that I'd add would be some smoke tests, namely adding some specs in If you can reproduce a minimal spec showcasing the problem that led you to issue this PR, and how it can be fixed with this new trait, I'll deem the PR mergeable 👍 |
Thanks, I was looking at how to do smoke tests, but couldn't find. I'll add it today.
Should I write this in to a docs? probably |
This also fix union renderer issue
11dff05
to
91b4542
Compare
4b33ea7
to
3bfa92f
Compare
Added a minimal smoke test for this. And it also shows We can see why this We need this feature. @scalaImports(["smithy4s.refined.Age.provider._"])
structure StructureWithScalaImports {
@range(min: 13, max: 19)
teenage: Age
} This wouldn't compiled without the needed provider(which is delivered by implicit val rangeProvider: RefinementProvider.Simple[smithy.api.Range, Age] =
RefinementProvider.rangeConstraint(x => x.value) |
So, I think this is done code wise, now times for some documentation and change log. Is this okay better to do those in another PR and let this one going first? |
9d27f20
to
db55c28
Compare
@lenguyenthanh I'd rather the docs were added to this PR, to be honest.
This is a fine place, yes 👍 |
cool, I'll add it tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation is great, thank you very much !
thanks for your guidelines @Baccata . It was fun! |
This is to implement
scalaImports
trait, which provides mechanism to add an import to a specific generatedstructure
from smithy. The rationale behind is on this discussion.I still need to check all the items below but want to make a draft PR first to gather some early feedback.
ps: You can see this pr in action here: lenguyenthanh/fide#100
PR Checklist (not all items are relevant to all PRs)
[ ] Added build-plugins integration tests (when reflection loading is required at codegen-time)[ ] Added alloy compliance tests (when simpleRestJson protocol behaviour is expanded/updated)[ ] Updated dynamic module to match generated-code behaviour