'-' within schema causes invalid stuct name to be created '-' can't be within struct name
injested wsdl files with - in there field name, In order to get the program to create the go code, I needed to go through encoder.go and add string.Replace on '-' with "" one the various tag fields
Can you give an example?
I'm sorry for how long this took me. If you replace nick-name with nickname, in the included file, the problem will work.
I messed around wtih wsdlgo/encoder.go so struct names wouldn't include the '-' character, which allowed your code to run.
Alright, so this is mainly about removing - from function names and variables but keeping them in the XML tags? PR?
correct, attached export.go that worked with example file, encoder.txt
created cleanString function (currently removes '-' and ' ') Not sure how complete it is, but it was able to convert the previously attached file thanks!
Yeah we need to fix this. @flavioayra just reported the same problem, finding "-" and "." in type/op names.
Should be good now.
@fiorix i am still seeing this issue with "." in the name, was this added to fix "." or just "-"
here is an example file. it is from the F5 Networks WSDL. unfortunately they use "." all over the place.
for refrence here is the error
generated bad code: 1182:16: expected type, found '.' (and 1 more errors)
1180
1181 // management.ResourceRecordPortType implements the ManagementResourceRecordPortType interface.
1182 type management.ResourceRecordPortType struct {
1183 cli *soap.Client
1184 }
1185
I think I missed the "." in the regex that makes it a valid Go symbol: https://github.com/fiorix/wsdl2go/blob/88777812a5daba043066aae0e7dd72b0a6343f98/wsdlgo/encoder.go#L1243
@fiorix in this case the "." is actually invalid in the type name, i think that problem is that it is not using the validGoSymbol function when creating types
PR?
@fiorix I'm also seeing this as well.
For example:
$ wsdl2go < ParseAddress.wsdsl > ParseAddr.go
2022/10/03 12:04:06 generated bad code: 3:13: expected ';', found '-'
1 // Code generated by wsdl2go. DO NOT EDIT.
2
3 package plsp-public
...
This WSDL comes from: https://information.qld.gov.au/service/Addressing/ValidationService/PLSplusPublic/soap?wsdl
#47 fixes a bunch of bugs I found with generating type names, method names and so on. This resolves my problem as well as the one found in this issue. I'm not happy with the code, but it generated valid Go code finally 😅
FWW I achieved much better results by using the wsdlgen cli utility found in this package:
- https://github.com/droyo/go-xml