Live data from Hacker News

Smithy: A language for defining services and SDKs

awslabs.github.io

31–40 of 77 posts

Re: Smithy: A language for defining services and SDKs

#31

What's the difference between the bracketed syntax, e.g. [City] and `list`?

I think, from reading around the examples/spec a bit, collections of items use brackets to bound the collection. The examples are collections of a single item though, so it's slightly confusing at first glance. One hint at that is the keys defining those collections seems to be pluralized in all the cases I've seen so far.

Re: Smithy: A language for defining services and SDKs

#33

Smithy structure definitions don't have field indexes like in protobuf or thrift. It also has required fields, where proto3 intentionally did away with them. How do these differences impact backwards-compatibility-safety of Smithy schema changes?

Smithy today doesn't support any serialization formats that require fixed ordering. We do recommend that any additional members added to structures are added at the end to help with C++ and Rust codegen though.

That said, traits can be used in Smithy to enforce constraints on structures, so if you ever needed explicit indexing like that, it could be done via traits and protocols (Smithy's nomenclature for describing how clients and servers communicate). In fact, protocols are defined by traits, and traits can enforce requirements on the rest of the model using a DSL called selectors... Probably way too much info other than -- it's possible and easy to support this in Smithy if it's ever needed.

As for required vs optional -- today it's treated as server-side validation only and not used in client codegen. This allows service teams to remove the required trait from members if something ends up needing to be optional in future without breaking clients. We're working on some ideas too to see if we can generate even better code for SDKs in languages like Rust where optionality is very explicit, but without sacrificing the ability of being able to remove the required trait.

And, in general, backward compatibility issues are caught with Smithy diff, which also supports custom rules: https://github.com/awslabs/smithy/tree/main/smithy-diff

Re: Smithy: A language for defining services and SDKs

#34

What's the difference between the bracketed syntax, e.g. [City] and `list`?

Smithy is very focused on codegen, so the model is highly normalized. So for example, defining a list of something needs to be done using a `list` shape. This kind of list is something you'd see directly serialized and sent over the wire. For example:

list Messages { member: Messages }

Then you can reference Messages from other places in the model, like from a structure:

structure Something { messages: Messages }

In contrast, the `[City]` syntax is used in other places in the IDL to define a relationship to a shape. This isn't something that gets sent over the wire, it's just used to form essentially a relationship in the service graph from a service to resources, a resource to operations, an operation to errors, etc. For example:

service Weather { resources: [City, Sensors] }

Re: Smithy: A language for defining services and SDKs

#35
post #32

Pardon my ignorance: once one gets to: https://awslabs.github.io/smithy/quickstart.html#next-steps well, what is it? What was autogenerated? I know JAVA from previous jobs, but not Gradle and whatever the Smithy generated artifacts are to be composed with is unclear to me.

It's not really a fully finished project yet, so not much. We shipped the AWS SDK for JS v3 with Smithy, the AWS SDK for Go v2 with Smithy, and just launched an alpha of the AWS SDK for Rust using Smithy. More are in the works. We're currently iterating on their code generators to make them easier to use outside the AWS SDKs. AWS SDKs are being built in a layered approach where there's a generic code generator that's really extensible, and then the AWS SDKs extend it to add AWS-specific stuff like regions and credential handling.

We're working to get projects like these to GA: https://github.com/awslabs/smithy-typescript, https://github.com/aws/smithy-go, and https://github.com/awslabs/smithy-rs. And we're also working on service code generation.

Re: Smithy: A language for defining services and SDKs

#36
post #14

Reminds me a lot of this talk: https://www.youtube.com/watch?v=j6ow-UemzBc I think it's a really powerful paradigm. I think an org adopting such patterns widespread leads to some really rad capabilities. GDPR compliance, for example, is really tough in SOA architectures in companies without a ton of engineering capacity, but this sort of data/api introspection could do a lot to change that. Any plans to open source p…

We expect to have Smithy code generation for every language we support as official AWS SDKs.

Re: Smithy: A language for defining services and SDKs

#37
post #22

what ever did happen to wsdl? ducks

IIRC SOAP helped give the browser world XmlHttpRequest which eventually helped kickstart the whole AJAX web 2.0 / modern webapp world we love today. So in some ways it was an important stepping stone to get there, just a dead end from the general demise of XML tooling.

Re: Smithy: A language for defining services and SDKs

#39

How does this compare to Google’s protocol buffers? [0] It looks like smithy has a broader set of applications. [0] https://developers.google.com/protocol-buffers

Protobuf and gRPC are great, and AWS will continue to make sure developers can be successful using them with AWS. I’ll try to explain how we ended up at Smithy instead of using other existing tools. We started working on Smithy around 2018 because we wanted to improve the scale of our API program and the AWS SDK team to deal with the growing number of services (over 250 now!) and languages we want to support in offic…

Thanks for the thorough response! This helps me understand the motivations behind Smithy. I’m going to dig into the project and keep an eye on it as the tooling develops.
Post reply on HN