From 0ce56a88703bb21b471a02274c08f187d139aba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Luka=C5=A1=C3=ADk?= Date: Thu, 29 Oct 2020 21:49:10 +0100 Subject: [PATCH] Remove show-docs handling show-docs attribute is no longer part of upstream metaschema. --- metaschema/parser/main.go | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/metaschema/parser/main.go b/metaschema/parser/main.go index 2cecd3e..36b88b0 100644 --- a/metaschema/parser/main.go +++ b/metaschema/parser/main.go @@ -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 @@ -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"` @@ -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"` @@ -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"` @@ -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 (