Skip to content

Commit

Permalink
Fix properties declaration in NodeJS SDK when the token isn't from an…
Browse files Browse the repository at this point in the history
… external module
  • Loading branch information
pasqualet committed Nov 25, 2022
1 parent 449307d commit 96a3049
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- type: fix
scope: sdkgen/nodejs
description: Fix NodeJS SDK when a component is using another component from the same schema as a property
6 changes: 4 additions & 2 deletions pkg/codegen/nodejs/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,12 @@ func (mod *modContext) resourceType(r *schema.ResourceType) string {
pkg = r.Resource.Package
}
namingCtx, pkgName, external := mod.namingContext(pkg)
if external {
pkgName = externalModuleName(pkgName)
if !external {
name := tokenToName(r.Token)
return title(name)
}

pkgName = externalModuleName(pkgName)
modName, name := namingCtx.tokenToModName(r.Token), tokenToName(r.Token)

return pkgName + modName + title(name)
Expand Down

0 comments on commit 96a3049

Please sign in to comment.