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

Properly capitalize exported go types #7636

Merged
merged 1 commit into from
Feb 18, 2018
Merged

Conversation

achew22
Copy link
Contributor

@achew22 achew22 commented Feb 10, 2018

Previously if the type was "myEnum" it would be written as

type myEnum string

const (
  DEMO MyEnum = "DEMO"
)

which would fail because of the capitalization difference. This fixes that.

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

(details of the change, additional tests that have been done, reference to the issue for tracking, etc)

Previously if the type was "myEnum" it would be written as

```
type myEnum string

const (
  DEMO MyEnum = "DEMO"
)
```

which would fail because of the capitalization difference. This fixes that.
@achew22
Copy link
Contributor Author

achew22 commented Feb 10, 2018

+CC @antihax, @bvwells

@bvwells
Copy link
Contributor

bvwells commented Feb 12, 2018

Hi @achew22, just wondering if there is an issue filed for this PR? Couldn't see a reference to one here, but might have missed it...

@achew22
Copy link
Contributor Author

achew22 commented Feb 12, 2018

I didn't file one since I was just going to send a PR to fix it. Would you like me to open one? Is the description in the PR sufficient?

@antihax
Copy link
Contributor

antihax commented Feb 13, 2018

Looks ok to me. I wanted to take a stab at fixing capitalization on some of the generated variables names also but time is running away from me.

@achew22
Copy link
Contributor Author

achew22 commented Feb 13, 2018

@antihax, does that imply you approve and it should be merged?

@bvwells
Copy link
Contributor

bvwells commented Feb 13, 2018

@achew22 it might be worth adding this bug in the client test swagger located here:

https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml

So that we make sure that there isn't a regression in future.

Running https://github.com/swagger-api/swagger-codegen/blob/master/bin/go-petstore.sh will regenerate the client code.

@wing328 could you advise whether an issue needs to be logged please.

@wing328
Copy link
Contributor

wing328 commented Feb 13, 2018

I'll review in the coming few days...

@achew22
Copy link
Contributor Author

achew22 commented Feb 17, 2018

@wing328 friendly ping 😄

@wing328
Copy link
Contributor

wing328 commented Feb 18, 2018

@achew22 thanks for the PR, which looks good to me (sorry for the delay in merging due to Chinese New Year celebration)

@wing328 wing328 merged commit 47614bb into swagger-api:master Feb 18, 2018
@wing328
Copy link
Contributor

wing328 commented Feb 18, 2018

@achew22
Copy link
Contributor Author

achew22 commented Feb 18, 2018

@wing328, thanks so much for merging! I see you've tagged it with 2.4.0 as the destination release. Is there somewhere I can track the progress of that release? This bug is blocking the next major release for grpc-gateway and my hope was to get that out today or tomorrow. Would it be possible to do a really quick 2.3.2 or something?

@achew22 achew22 deleted the patch-1 branch February 18, 2018 19:07
@wing328
Copy link
Contributor

wing328 commented Feb 22, 2018

Would you consider using the -t option with the customized templates?

@achew22
Copy link
Contributor Author

achew22 commented Feb 23, 2018

I think the idea of doing -t would be a bit unwieldy since I would have to either import the mustache templates for the entire Go client (which is a bit out of scope for my e2e test) or use the snapshot. I think what I'm going to do is prepare the patch with the snapshot and then when 2.4.0 is released enshrine that version in tests.

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

Successfully merging this pull request may close these issues.

4 participants