hooklift / gowsdl

WSDL2Go code generation as well as its SOAP proxy
Mozilla Public License 2.0
1.14k stars 390 forks source link

Generate xml.Marshaler and xml.Unmarshaler interface implementations for date/time types #222

Closed w65536 closed 2 years ago

w65536 commented 2 years ago

Note that this pull request is based on top of #220 (first two commit) because it also proposes a cleanup of variable names and usage across the entire types template (final commit).

The interface methods must be generated for generated types with underlying type soap.XSDDateTime, soap.XSDDate and soap.XSDTime, such that they can be referenced

<xs:complexType name="myComplexType">
  <xs:sequence>
    <xs:element ref="myType"/>                      <!-- reference -->
  </xs:sequence>
</xs:complexType>

<xs:element name="myType" type="xs:dateTime"/>

as opposed to direct type declaration:

<xs:complexType name="myComplexType">
  <xs:sequence>
    <xs:element name="myType" type="xs:dateTime"/>  <!-- no reference -->
  </xs:sequence>
</xs:complexType>

Calls are redirected to soap.XSDDateTime.MarshalXML() and soap.XSDDateTime.UnmarshalXML() and respectively for soap.XSDDate and soap.XSDTime.

Tests are also implemented to validate correct generation of these methods.

Fixes #221

c4milo commented 2 years ago

@w65536, do you mind resolving the conflict? I was going over your PRs and merging them one by one.

c4milo commented 2 years ago

They are great, BTW. Thanks for taking the time!

w65536 commented 2 years ago

All conflicts resolved. Thanks for your consideration!