@@ -17,15 +17,16 @@ package cmd
17
17
import (
18
18
"encoding/json"
19
19
"fmt"
20
- "github.com/dave/jennifer/jen"
21
- "github.com/samply/golang-fhir-models/fhir-models-gen/fhir"
22
- "github.com/spf13/cobra"
23
20
"io/ioutil"
24
21
"os"
25
22
"path/filepath"
26
23
"regexp"
27
24
. "strings"
28
25
"unicode"
26
+
27
+ "github.com/dave/jennifer/jen"
28
+ "github.com/samply/golang-fhir-models/fhir-models-gen/fhir"
29
+ "github.com/spf13/cobra"
29
30
)
30
31
31
32
type Resource struct {
@@ -343,7 +344,7 @@ func appendFields(resources ResourceMap, requiredTypes map[string]bool, required
343
344
for _ , pathPart := range Split ((* element .ContentReference )[1 :], "." ) {
344
345
typeIdentifier = typeIdentifier + Title (pathPart )
345
346
}
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" })
347
348
}
348
349
// support polymorphic elements later
349
350
case 1 :
@@ -423,9 +424,9 @@ func appendFields(resources ResourceMap, requiredTypes map[string]bool, required
423
424
}
424
425
425
426
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" })
427
428
} else {
428
- statement .Tag (map [string ]string {"json" : pathParts [level ]})
429
+ statement .Tag (map [string ]string {"json" : pathParts [level ], "bson" : pathParts [ level ] })
429
430
}
430
431
}
431
432
}
0 commit comments