Skip to content
New issue

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

Option to replace types #205

Open
davidsbond opened this issue Apr 20, 2021 · 0 comments
Open

Option to replace types #205

davidsbond opened this issue Apr 20, 2021 · 0 comments

Comments

@davidsbond
Copy link

Hello, I'm using gowsdl to generate code for an ancient API.

The problem I ran into is while their WSDL definition states something is a time.Time the actual format of the string is not one that time.Parse can use. It would be great if there was an option on the CLI to specify that any time.Time instances should be string instead.

To do this myself, I've had to do a bit of sed magic in go:generate directives:

// Produces go code from the WSDL file.
//go:generate gowsdl -o ./generated.go -p generated <url>

// This is some gross stuff right here. Basically, this API does not return time strings in a way that go can parse them. So
// we use sed to replace them all with strings
//go:generate sed -i "s/time.Time/string/g" ./generated/generated.go

// Then we need to get rid of the "time" import at the top.
//go:generate sed -i "s/\"time\"//g" ./generated/generated.go

While I don't mind doing it this way, I figure many people who are using soap and go are probably dealing with old APIs that have quirks like this one. So perhaps some built-in way of replacing types would be beneficial? What do you think?

I appreciate it's probably a non-goal of this tool, since the API itself is doing something it shouldn't.

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

No branches or pull requests

1 participant