Skip to content

Commit 079f7bd

Browse files
authored
chore: go fix for PageSize parameter (#632)
<!-- We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines, then fill out the blanks below. Please format the PR title appropriately based on the type of change: <type>[!]: <description> Where <type> is one of: docs, chore, feat, fix, test, misc. Add a '!' after the type for breaking changes (e.g. feat!: new breaking feature). **All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.** Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged! e.g. Fixes #1 Closes #2 --> # Fixes # fix go pipeline ### Checklist - [x] I acknowledge that all my contributions will be made under the project's license - [ ] Run `make test-docker` - [ ] Verify affected language: - [ ] Generate [twilio-go](https://github.com/twilio/twilio-go) from our [OpenAPI specification](https://github.com/twilio/twilio-oai) using the [build_twilio_go.py](./examples/build_twilio_go.py) using `python examples/build_twilio_go.py path/to/twilio-oai/spec/yaml path/to/twilio-go` and inspect the diff - [ ] Run `make test` in `twilio-go` - [ ] Create a pull request in `twilio-go` - [ ] Provide a link below to the pull request - [ ] I have made a material change to the repo (functionality, testing, spelling, grammar) - [ ] I have read the [Contribution Guidelines](https://github.com/twilio/twilio-oai-generator/blob/main/CONTRIBUTING.md) and my PR follows them - [ ] I have titled the PR appropriately - [ ] I have updated my branch with the main branch - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added the necessary documentation about the functionality in the appropriate .md file - [ ] I have added inline documentation to the code I modified If you have questions, please create a GitHub Issue in this repository.
1 parent a6c5c75 commit 079f7bd

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ jobs:
2121
DOCKER_LOGIN: ${{ secrets.DOCKER_USERNAME && secrets.DOCKER_AUTH_TOKEN }}
2222
steps:
2323
- name: Checkout twilio-oai-generator
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525
with:
2626
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2727

2828
- name: Set up Java 11
29-
uses: actions/setup-java@v3
29+
uses: actions/setup-java@v4
3030
with:
3131
distribution: 'zulu'
3232
java-version: '11'
3333

3434
- name: Login to Docker Hub
3535
if: env.DOCKER_LOGIN
36-
uses: docker/login-action@v2
36+
uses: docker/login-action@v3
3737
with:
3838
username: ${{ secrets.DOCKER_USERNAME }}
3939
password: ${{ secrets.DOCKER_AUTH_TOKEN }}
@@ -53,14 +53,14 @@ jobs:
5353
- name: Remove pom file # Otherwise, the Sonar action fails and recommends using the Maven plugin
5454
run: rm pom.xml
5555

56-
- name: Install SonarCloud scanner and run analysis
57-
uses: SonarSource/sonarcloud-github-action@master
58-
if: (github.event_name == 'pull_request' || github.ref_type == 'branch') && !github.event.pull_request.head.repo.fork && startsWith(matrix.language, 'csharp') != true
59-
with:
60-
projectBaseDir: examples/${{ matrix.language }}
61-
env:
62-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
63-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
56+
# - name: Install SonarCloud scanner and run analysis
57+
# uses: SonarSource/sonarcloud-github-action@master
58+
# if: (github.event_name == 'pull_request' || github.ref_type == 'branch') && !github.event.pull_request.head.repo.fork && startsWith(matrix.language, 'csharp') != true
59+
# with:
60+
# projectBaseDir: examples/${{ matrix.language }}
61+
# env:
62+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
63+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6464

6565
notify-on-failure:
6666
name: Slack notify on failure

src/main/java/com/twilio/oai/TwilioGoGenerator.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,17 @@ public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, L
189189
if (co.nickname.startsWith("List")) {
190190
// make sure the format matches the other methods
191191
co.vendorExtensions.put("x-domain-name", co.nickname.replaceFirst("List", ""));
192+
co.allParams.forEach( p -> {
193+
if( p.dataType.equals("int64") && ( p.baseName.equals("PageSize") || p.baseName.equals("limit") ) ){
194+
p.dataType = "int";
195+
}
196+
});
197+
198+
co.optionalParams.forEach( p -> {
199+
if( p.dataType.equals("int64") && ( p.baseName.equals("PageSize") || p.baseName.equals("limit") ) ){
200+
p.dataType = "int";
201+
}
202+
});
192203

193204
// filter the fields in the model and get only the array typed field. Also, make sure there is only one field of type list/array
194205
if (returnModel.isPresent()) {

0 commit comments

Comments
 (0)