-
-
Notifications
You must be signed in to change notification settings - Fork 807
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
Reserved golang keywords in spec cause errors #30
Comments
There are many cases where this will happen, so I'm thinking of side-stepping the problem by allowing people to specify the Go variable name explicitly via extended properties. You could do something like:
which would yield
I'm in the middle of a big project right now, but I'll revisit this sometime soon. |
The problem here is that you do not always have control over the spec as it can be created by a third party. Adding language specific tags sounds like a hack. Postfixing every param with If we can think up an elegant solution I'm happy to provide a PR if that helps you. |
You're right. I didn't want to break existing clients, so in the case of parameters which are go keywords, I prefix those with p, so |
When a Swagger spec defines a variable name which conflicts with a Go keyword, prefix the Go keyword to avoid a syntax error.
I have a
type
parameter in my spec as follows:Which resuls in the following server interface:
But as you can see this results in a parameter named
type
which is a reseverd golang keyword.Perhaps pre/post fixing all param names can prevent these errors.
The text was updated successfully, but these errors were encountered: