Skip to content

Commit

Permalink
Merge pull request #461 from Clever/swad-infrang-4970
Browse files Browse the repository at this point in the history
Fix models attributes for DynamoDB generated tests
  • Loading branch information
swadkumar authored Aug 23, 2023
2 parents 96b1fa4 + 743b925 commit 4624c4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
v9.1.1
v9.1.2

v9.1.2 Fixes for models attributes for DynamoDB generated tests

v9.1.1 Fixes for unused aws import in DynamoDB tests

Expand Down
5 changes: 4 additions & 1 deletion server/gendb/templatefuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,12 @@ func exampleValueNotPtrForAttribute(config XDBConfig, attributeName string, i in
if !ok {
panic("expected spec.Schema")
}
ref := propertySchema.Ref.String()
refSplit := strings.Split(ref, "/")
state := swag.ToGoName(refSplit[len(refSplit)-1])
enumVals := schema.SchemaProps.Enum
if enumLength := len(enumVals); enumLength > 0 {
return fmt.Sprintf(`models.Branch%s`, swag.ToGoName(enumVals[(i-1)%enumLength].(string)))
return fmt.Sprintf(`models.%s%s`, state, swag.ToGoName(enumVals[(i-1)%enumLength].(string)))
}
}
} else if ca := findCompositeAttribute(config, attributeName); ca != nil {
Expand Down

0 comments on commit 4624c4d

Please sign in to comment.