-
Notifications
You must be signed in to change notification settings - Fork 214
Description
Currently, both client and server projects have been using the same bottom-most (i.e. the core symbol provider that sits at the bottom of the hierarchy of "wrappers") symbol provider, defined in SymbolVisitor.kt
:
The mapping between a Smithy shape and a Symbol
, the role of the symbol provider, has become ever more different between the client and the server projects. The first deviation was introduced when the server first decided to generate required
member shapes as non-Option
al, in #1148. This was tackled introducing a handleRequired
configuration flag in the SymbolVisitorConfig
:
We now have more need for deviations:
- Since Add new service builder codegen #1693, we now generate a Rust struct for each
operation
shape. The currentSymbolVisitor
generates other Rust structs for use by the client. - Since Add new service builder codegen #1693, we now generate a "service builder" Rust struct for the service (link). The current
SymbolVisitor
cannot be invoked on aservice
shape. - As a result of "constrained types" in Builders of builders #1342, we will introduce several other symbol providers to provide symbols for constrained and unconstrained shapes. I think these could be slightly unified if the server project had its own bottom-most symbol provider.
- The advent of IDL v2 further complicates when a member shape should be generated as
Option
or not for both projects.
Introducing more configuration flags and increasing the branching in the current SymbolVisitor
to accomodate all these different requirements will make the code increasingly complex, hampering maintainability.
In this task we will split the current SymbolVisitor
into at least two classes across three files:
CoreSymbolProviderUtilities
will live in the recently introducedcodegen-core
Gradle module (Establish thecodegen-core
module #1697) and will provide utilities to constructSymbol
s, espeically those for core simple Smithy shapes whose associated Rust types are common among all projects.ClientSymbolProvider
will live in the client Gradle module and be specifically tailored and unit-tested for the client project's needs.ServerSymbolProvider
will live in thecodegen-server
Gradle module and be specifically tailored and unit-tested for the server project's needs.
Note we get rid of the "visitor" part of the name.
Note the Python server project is using its own bottom-most symbol provider: