Implement namespace support for generated Unison client code#12
Merged
Conversation
Update generate.py to derive namespace from service and output to generated/ directory. Add additional Smithy AWS dependencies to aws-demo smithy-build.json.
Add method to convert dot-separated namespace config to PascalCase Unison namespace prefix (e.g., aws.s3 -> Aws.S3).
Add toNamespacedTypeName() and toNamespacedFunctionName() methods for generating fully qualified Unison names with namespace prefix.
Apply namespace prefix to Config, Credentials, error types, XML parsers, operation stubs, and field extraction in generated client code.
Apply namespace prefix to operations, types, enum functions, XML parsers, and error types in generated REST-XML protocol code.
Update stub implementation to use namespaced function names for future REST-JSON protocol support.
Update stub implementation to use namespaced function names for future AWS JSON 1.0/1.1 protocol support.
Apply namespace prefix to enum types and converter functions. Types use Aws.S3.EnumName format, functions use Aws.S3.enumNameToText format.
Apply namespace prefix to structure types (including errors), union types, and their field references. All complex types now use Aws.S3.TypeName format.
…helpers Update ClientModuleWriter to pass clientNamespace when creating PaginationGenerator. This ensures pagination helper functions use namespaced types like Aws.S3.Config instead of unqualified Config references.
Update toLowerCamelCase to only convert the last component of namespaced names. Aws.S3.RequestPayer now generates Aws.S3.requestPayerToText instead of aws.S3.RequestPayerToText. Also pass clientNamespace to PaginationGenerator.
Fix Unison namespace resolution by using base type names for record constructor calls instead of fully namespaced names. Unison resolves constructors differently than type references in the same file context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR does:
getClientNamespace()method to UnisonSettings that derives namespace from config (e.g., "aws.s3" -> "Aws.S3")toNamespacedTypeName()andtoNamespacedFunctionName()methods to UnisonSymbolProviderAws.S3.requestPayerToText)This can be verified by doing:
./gradlew testto verify all tests passsmithy buildin examples/aws-demoAws.S3.Config,Aws.S3.createBucket