8000 Add support for <simpleContent> by kjgorman · Pull Request #106 · fiorix/wsdl2go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support for <simpleContent> #106

New issue 8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2018
Merged

Conversation

kjgorman
Copy link
Contributor
@kjgorman kjgorman commented Sep 19, 2018

Simple content is like... a simpler version of <complexContent> within a
<complexType>! This commit adds support for a <simpleContent> tag with
extensions/restrictions.

I'm looking at using wsdl2go for a quick integration with NetSuite, but hit an immediate hurdle of not having <simpleContent> be supported such that I could use the TokenPassportSignature element defined in https://webservices.netsuite.com/xsd/platform/v2018_1_0/core.xsd

I don't really know what I'm doing here, but this commit copies the approach to <complexContent> and strips down to the supported tags within <simpleContent>. The thing I'm least certain of is the c > 2 && len(ct.Attributes) == 0 pre-condition change.

With this change, and the above linked wsdl, you get output like:

type TokenPassport struct {
	Account     *string                 `xml:"account,omitempty" json:"account,omitempty" yaml:"account,omitempty"`
	ConsumerKey *string                 `xml:"consumerKey,omitempty" json:"consumerKey,omitempty" yaml:"consumerKey,omitempty"`
	Token       *string                 `xml:"token,omitempty" json:"token,omitempty" yaml:"token,omitempty"`
	Nonce       *string                 `xml:"nonce,omitempty" json:"nonce,omitempty" yaml:"nonce,omitempty"`
	Timestamp   *int64                  `xml:"timestamp,omitempty" json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
	Signature   *TokenPassportSignature `xml:"signature,omitempty" json:"signature,omitempty" yaml:"signature,omitempty"`
}

// TokenPassportSignature was auto-generated from WSDL.
type TokenPassportSignature struct {
	Content   *string `xml:"Content,omitempty" json:"Content,omitempty" yaml:"Content,omitempty"`
	Algorithm string `xml:"algorithm,attr,omitempty" json:"algorithm,attr,omitempty" yaml:"algorithm,attr,omitempty"`
}

(Where on master we hit the c > 2 [...] precondition and generate an empty struct instead).

Simple content is like... a simpler version of <complexContent> within a
<complexType>! This commit adds support for a <simpleContent> tag with
extensions/restrictions.
@fiorix fiorix merged commit c0bfd34 into fiorix:master Sep 21, 2018
@fiorix
Copy link
Owner
fiorix commented Sep 21, 2018

Good stuff, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0