Skip to content

Commit

Permalink
chore: go fix for PageSize parameter (#632)
Browse files Browse the repository at this point in the history
<!--
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.
  • Loading branch information
manisha1997 authored Feb 19, 2025
1 parent a6c5c75 commit 079f7bd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ jobs:
DOCKER_LOGIN: ${{ secrets.DOCKER_USERNAME && secrets.DOCKER_AUTH_TOKEN }}
steps:
- name: Checkout twilio-oai-generator
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up Java 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'

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

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

notify-on-failure:
name: Slack notify on failure
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/twilio/oai/TwilioGoGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, L
if (co.nickname.startsWith("List")) {
// make sure the format matches the other methods
co.vendorExtensions.put("x-domain-name", co.nickname.replaceFirst("List", ""));
co.allParams.forEach( p -> {
if( p.dataType.equals("int64") && ( p.baseName.equals("PageSize") || p.baseName.equals("limit") ) ){
p.dataType = "int";
}
});

co.optionalParams.forEach( p -> {
if( p.dataType.equals("int64") && ( p.baseName.equals("PageSize") || p.baseName.equals("limit") ) ){
p.dataType = "int";
}
});

// 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
if (returnModel.isPresent()) {
Expand Down

0 comments on commit 079f7bd

Please sign in to comment.