smithy-lang / smithy-rs

Code generation for the AWS SDK for Rust, as well as server and generic smithy client generation.
Apache License 2.0
467 stars 183 forks source link

`Shape` trait to expose Smithy model information in Rust types #3691

Open david-perez opened 2 weeks ago

david-perez commented 2 weeks ago

In the server we have this handy OperationShape trait that we implement on operation shapes. Among other things, it has a const ID that allows one to retrieve the shape id corresponding to the shape from which the Rust type was generated.

It would be nice if we could expose shape IDs for all Rust types derived from Smithy shapes via an e.g. Shape trait.

This way middleware authors and end-users can code against this trait and reach into this information, which can be useful in, for example, the context of metrics and error reporting.