Skip to content

Commit

Permalink
Remove show-docs handling
Browse files Browse the repository at this point in the history
show-docs attribute is no longer part of upstream metaschema.
  • Loading branch information
isimluk committed Oct 29, 2020
1 parent 20cffb1 commit 0ce56a8
Showing 1 changed file with 5 additions and 33 deletions.
38 changes: 5 additions & 33 deletions metaschema/parser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,8 @@ const (
AsTypeEmail AsType = "email"
AsTypeURI AsType = "uri"
AsTypeBase64 AsType = "base64Binary"

ShowDocsXML ShowDocs = "xml"
ShowDocsJSON ShowDocs = "json"
ShowDocsXMLJSON ShowDocs = "xml json"
)

var ShowDocsOptions = []ShowDocs{
ShowDocsXML,
ShowDocsJSON,
ShowDocsXMLJSON,
}

type GoType interface {
GoTypeName() string
GetMetaschema() *Metaschema
Expand Down Expand Up @@ -107,9 +97,8 @@ func (Metaschema *Metaschema) ContainsRootElement() bool {
// DefineAssembly is a definition for for an object or element that contains
// structured content
type DefineAssembly struct {
Name string `xml:"name,attr"`
ShowDocs string `xml:"show-docs,attr"`
Address string `xml:"address,attr"`
Name string `xml:"name,attr"`
Address string `xml:"address,attr"`

JsonKey *JsonKey `xml:"json-key"`
Flags []Flag `xml:"flag"`
Expand Down Expand Up @@ -138,8 +127,7 @@ func (a *DefineAssembly) GetMetaschema() *Metaschema {
}

type DefineField struct {
Name string `xml:"name,attr"`
ShowDocs string `xml:"show-docs,attr"`
Name string `xml:"name,attr"`

Flags []Flag `xml:"flag"`
FormalName string `xml:"formal-name"`
Expand Down Expand Up @@ -187,9 +175,8 @@ func (df *DefineField) GoName() string {
}

type DefineFlag struct {
Name string `xml:"name,attr"`
AsType datatype `xml:"as-type,attr"`
ShowDocs ShowDocs `xml:"show-docs,attr"`
Name string `xml:"name,attr"`
AsType datatype `xml:"as-type,attr"`

FormalName string `xml:"formal-name"`
Description string `xml:"description"`
Expand Down Expand Up @@ -566,21 +553,6 @@ func (h *Href) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {

type AsType string

type ShowDocs string

func (sd ShowDocs) UnmarshalXMLAttr(attr xml.Attr) error {
showDocs := ShowDocs(attr.Value)

for _, showDocsOption := range ShowDocsOptions {
if showDocs == showDocsOption {
sd = showDocs
return nil
}
}

return fmt.Errorf("Show docs option \"%s\" is not a valid option", attr.Value)
}

type datatype string

const (
Expand Down

0 comments on commit 0ce56a8

Please sign in to comment.