Skip to content

Commit f338296

Browse files
committed
fix inline simpleType restriction resolving to string instead of base type
Elements with inline <simpleType><restriction base="..."> were not resolving the base type, defaulting to string. Added SimpleType field to wsdl.Element and resolve the restriction base in genElementField. Fixes #146.
1 parent 929bb50 commit f338296

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

wsdl/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ type Element struct {
195195
Max string `xml:"maxOccurs,attr"` // can be # or unbounded
196196
Nillable bool `xml:"nillable,attr"`
197197
ComplexType *ComplexType `xml:"complexType"`
198+
SimpleType *SimpleType `xml:"simpleType"`
198199
}
199200

200201
// AnyElement describes an element of an undefined type.

wsdlgo/encoder.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,9 @@ func (ge *goEncoder) genElementField(w io.Writer, el *wsdl.Element) {
17051705
}
17061706
}
17071707
et := el.Type
1708+
if et == "" && el.SimpleType != nil && el.SimpleType.Restriction != nil {
1709+
et = el.SimpleType.Restriction.Base
1710+
}
17081711
if et == "" {
17091712
et = "string"
17101713
}

0 commit comments

Comments
 (0)