@@ -74,13 +74,8 @@ func main() {
7474
7575 // Detect format and extract shapes accordingly
7676 var shapes map [string ]interface {}
77- if smithyVersion , ok := api ["smithy" ]; ok && smithyVersion != nil {
78- // Smithy format (api-models-aws)
79- shapes = api ["shapes" ].(map [string ]interface {})
80- } else {
81- // Legacy Ruby SDK format
82- shapes = api ["shapes" ].(map [string ]interface {})
83- }
77+ // Extract shapes from Smithy format
78+ shapes = api ["shapes" ].(map [string ]interface {})
8479
8580 for _ , mapping := range mappingFile .Mappings {
8681 for attribute , value := range mapping .Attrs {
@@ -142,33 +137,26 @@ func fetchSchema(resource, attribute string, model map[string]interface{}, provi
142137 return attrSchema
143138}
144139
145- // findShape locates a shape in either Ruby SDK or Smithy format
140+ // findShape locates a shape in Smithy format
146141func findShape (shapes map [string ]interface {}, shapeName , importPath string ) map [string ]interface {} {
147- // First try direct lookup (Ruby SDK format)
148- if shape , ok := shapes [shapeName ]; ok {
149- return shape .(map [string ]interface {})
142+ // Try with service namespace qualification
143+ serviceNamespace := extractServiceNamespace (shapes )
144+ if serviceNamespace != "" {
145+ qualifiedName := fmt .Sprintf ("%s#%s" , serviceNamespace , shapeName )
146+ if shape , ok := shapes [qualifiedName ]; ok {
147+ // Convert Smithy shape to standard format for compatibility
148+ return convertSmithyShape (shape .(map [string ]interface {}))
149+ }
150150 }
151151
152- // If not found and this looks like a Smithy file, try with service namespace
153- if isSmithyFile (importPath ) {
154- serviceNamespace := extractServiceNamespace (shapes )
155- if serviceNamespace != "" {
156- qualifiedName := fmt .Sprintf ("%s#%s" , serviceNamespace , shapeName )
157- if shape , ok := shapes [qualifiedName ]; ok {
158- // Convert Smithy shape to Ruby SDK-like format for compatibility
159- return convertSmithyShape (shape .(map [string ]interface {}))
160- }
161- }
152+ // Fallback to direct lookup
153+ if shape , ok := shapes [shapeName ]; ok {
154+ return shape .(map [string ]interface {})
162155 }
163156
164157 return nil
165158}
166159
167- // isSmithyFile checks if the import path is for a Smithy file
168- func isSmithyFile (importPath string ) bool {
169- return strings .Contains (importPath , "api-models-aws" ) &&
170- ! strings .Contains (importPath , "aws-sdk-ruby" )
171- }
172160
173161// extractServiceNamespace gets the service namespace from the Smithy shapes
174162func extractServiceNamespace (shapes map [string ]interface {}) string {
@@ -186,7 +174,7 @@ func extractServiceNamespace(shapes map[string]interface{}) string {
186174 return ""
187175}
188176
189- // convertSmithyShape converts a Smithy shape format to Ruby SDK-like format
177+ // convertSmithyShape converts a Smithy shape format to standard format
190178func convertSmithyShape (smithyShape map [string ]interface {}) map [string ]interface {} {
191179 result := make (map [string ]interface {})
192180
@@ -195,7 +183,7 @@ func convertSmithyShape(smithyShape map[string]interface{}) map[string]interface
195183 result ["type" ] = shapeType
196184 }
197185
198- // Convert traits to Ruby SDK format
186+ // Convert traits to standard format
199187 if traits , ok := smithyShape ["traits" ].(map [string ]interface {}); ok {
200188 // Handle length constraints
201189 if lengthTrait , ok := traits ["smithy.api#length" ].(map [string ]interface {}); ok {
0 commit comments