@@ -17,15 +17,16 @@ package cmd
1717import (
1818 "encoding/json"
1919 "fmt"
20- "github.com/dave/jennifer/jen"
21- "github.com/samply/golang-fhir-models/fhir-models-gen/fhir"
22- "github.com/spf13/cobra"
2320 "io/ioutil"
2421 "os"
2522 "path/filepath"
2623 "regexp"
2724 . "strings"
2825 "unicode"
26+
27+ "github.com/dave/jennifer/jen"
28+ "github.com/samply/golang-fhir-models/fhir-models-gen/fhir"
29+ "github.com/spf13/cobra"
2930)
3031
3132type Resource struct {
@@ -343,7 +344,7 @@ func appendFields(resources ResourceMap, requiredTypes map[string]bool, required
343344 for _ , pathPart := range Split ((* element .ContentReference )[1 :], "." ) {
344345 typeIdentifier = typeIdentifier + Title (pathPart )
345346 }
346- statement .Id (typeIdentifier ).Tag (map [string ]string {"json" : pathParts [level ] + ",omitempty" })
347+ statement .Id (typeIdentifier ).Tag (map [string ]string {"json" : pathParts [level ] + ",omitempty" , "bson" : pathParts [ level ] + ",omitempty" })
347348 }
348349 // support polymorphic elements later
349350 case 1 :
@@ -423,9 +424,9 @@ func appendFields(resources ResourceMap, requiredTypes map[string]bool, required
423424 }
424425
425426 if * element .Min == 0 {
426- statement .Tag (map [string ]string {"json" : pathParts [level ] + ",omitempty" })
427+ statement .Tag (map [string ]string {"json" : pathParts [level ] + ",omitempty" , "bson" : pathParts [ level ] + ",omitempty" })
427428 } else {
428- statement .Tag (map [string ]string {"json" : pathParts [level ]})
429+ statement .Tag (map [string ]string {"json" : pathParts [level ], "bson" : pathParts [ level ] })
429430 }
430431 }
431432 }
0 commit comments