func (resource *CodeSystem) MarshalJSON() ([]byte, error) {
	resource.ResourceType = "CodeSystem"
	return json.Marshal(*resource)
}
Custom marshaller to add the resourceType property, as required by the specification
package models
import (
	"encoding/json"
	"errors"
	"fmt"
)
type CodeSystem struct {
	DomainResource   `bson:",inline"`
	Url              string                                 `bson:"url,omitempty" json:"url,omitempty"`
	Identifier       *Identifier                            `bson:"identifier,omitempty" json:"identifier,omitempty"`
	Version          string                                 `bson:"version,omitempty" json:"version,omitempty"`
	Name             string                                 `bson:"name,omitempty" json:"name,omitempty"`
	Status           string                                 `bson:"status,omitempty" json:"status,omitempty"`
	Experimental     *bool                                  `bson:"experimental,omitempty" json:"experimental,omitempty"`
	Publisher        string                                 `bson:"publisher,omitempty" json:"publisher,omitempty"`
	Contact          []CodeSystemContactComponent           `bson:"contact,omitempty" json:"contact,omitempty"`
	Date             *FHIRDateTime                          `bson:"date,omitempty" json:"date,omitempty"`
	Description      string                                 `bson:"description,omitempty" json:"description,omitempty"`
	UseContext       []CodeableConcept                      `bson:"useContext,omitempty" json:"useContext,omitempty"`
	Requirements     string                                 `bson:"requirements,omitempty" json:"requirements,omitempty"`
	Copyright        string                                 `bson:"copyright,omitempty" json:"copyright,omitempty"`
	CaseSensitive    *bool                                  `bson:"caseSensitive,omitempty" json:"caseSensitive,omitempty"`
	ValueSet         string                                 `bson:"valueSet,omitempty" json:"valueSet,omitempty"`
	HierarchyMeaning string                                 `bson:"hierarchyMeaning,omitempty" json:"hierarchyMeaning,omitempty"`
	Compositional    *bool                                  `bson:"compositional,omitempty" json:"compositional,omitempty"`
	VersionNeeded    *bool                                  `bson:"versionNeeded,omitempty" json:"versionNeeded,omitempty"`
	Content          string                                 `bson:"content,omitempty" json:"content,omitempty"`
	Count            *uint32                                `bson:"count,omitempty" json:"count,omitempty"`
	Filter           []CodeSystemFilterComponent            `bson:"filter,omitempty" json:"filter,omitempty"`
	Property         []CodeSystemPropertyComponent          `bson:"property,omitempty" json:"property,omitempty"`
	Concept          []CodeSystemConceptDefinitionComponent `bson:"concept,omitempty" json:"concept,omitempty"`
}