GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor: expose parsed api short name and version as fields in Service by emmileaf · Pull Request #1075 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Conversation

@emmileaf

@emmileaf emmileaf commented Oct 31, 2022

Copy link
Copy Markdown
Contributor

Follow-up to #1066.

This PR exposes parsed apiShortName and apiVersion as fields in Service.java, since the source fields (defaultHost and protoPakkage) are both defined per-service. It also:

  • Adds these two fields correspondingly to GapicClass so that it can be composed from Service given these two upstream fields, then replaces withDefaultHost (for building GapicClass) added in fix: update sample region tag to parse host instead of proto package #1040 with withApiShortName and withApiVersion. (Composers and tests where this is currently used for sample generation are updated)

This change will enable Spring Codegen (when eventually split out from this repo) to reuse this parsing logic in descriptive comments and metadata. It also moves the parsing logic to earlier in the parse-compose process.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
emmileaf added 3 commits October 19, 2022 14:58
@emmileaf
WIP: add parsed apiShortName and apiVersion as fields in Service class
79b0928
@emmileaf
Refactor unit tests
e98b405
@emmileaf
Update composer tests that included checks for defaultHost and sample…
5e7f9b3
… generation
@emmileaf
emmileaf marked this pull request as ready for review October 31, 2022 16:32
@emmileaf
emmileaf requested review from a team, alicejli, blakeli0 and zhumin8 October 31, 2022 16:32
blakeli0
blakeli0 approved these changes Oct 31, 2022
View reviewed changes

@blakeli0 blakeli0 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I actually don't know refactor is a conventional commit as most of time we just use chore for things that are not fix or feat, but refactor is definitely a better fit in this case.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
alicejli
alicejli approved these changes Oct 31, 2022
View reviewed changes

@alicejli alicejli left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your hard work! Looks good with a minor note on a test (from an error I made, so thank you in advance for addressing!)

To Blake's point - I think refactor: should be okay as a prefix per https://www.conventionalcommits.org/en/v1.0.0/.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/test/java/com/google/api/generator/gapic/composer/ComposerTest.java Outdated
"ApiShortName should be Localhost7469",
"Localhost7469",
sample.regionTag().apiShortName());
assertEquals("ApiVersion should be V1beta1", "V1Beta1", sample.regionTag().apiVersion());

@alicejli alicejli Oct 31, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize that this wasn't from your change (it was mine, sorry!) but since you're updating this section, do you mind updating to assertEquals("ApiVersion should be V1Beta1")? thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@emmileaf emmileaf Oct 31, 2022

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
emmileaf added 2 commits October 31, 2022 16:31
@emmileaf
Fix assertion message
d0c02ac
@emmileaf
Remove extra semicolons
2a10960
@sonarqubecloud

sonarqubecloud Bot commented Oct 31, 2022

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

86.1% 86.1% Coverage
0.0% 0.0% Duplication

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@emmileaf

emmileaf commented Oct 31, 2022

Copy link
Copy Markdown
Contributor Author

Thanks @alicejli and @blakeli0 for the review - I didn’t realize refactor was a valid prefix until checking the docs as well (to look for something other than fix or feat), but glad it fits the purpose and passes the check!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@emmileaf
emmileaf merged commit da4b130 into main Oct 31, 2022
@emmileaf
emmileaf deleted the refactor-parse-defaulthost-2 branch October 31, 2022 21:04
alicejli added a commit that referenced this pull request Nov 1, 2022
@alicejli @renovate-bot
@emmileaf @vam-google
fix: fixes regionTag breakage (#1068)
bed9f72
* fix: fixes regionTag breakage

* update credentials integration test

* removing getPureServiceName function

* linter

* refactor test

* chore(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.4.1 (#1072)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [org.apache.maven.plugins:maven-shade-plugin](https://maven.apache.org/plugins/) | `3.4.0` -> `3.4.1` | [![age](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/compatibility-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/confidence-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-generator-java).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yLjMiLCJ1cGRhdGVkSW5WZXIiOiIzNC42LjEifQ==-->

* refactor: expose parsed api short name and version as fields in Service (#1075)

* Exposes parsed apiShortName and apiVersion as fields in Service.java, since the source fields (defaultHost and protoPakkage) are both defined per-service. 

* Adds these two fields correspondingly to GapicClass so that it can be composed from Service given these two upstream fields, then replaces withDefaultHost (for building GapicClass) withApiShortName and withApiVersion. (Composers and tests where this is currently used for sample generation are updated)

* This change will enable Spring Codegen (when eventually split out from this repo) to reuse this parsing logic in descriptive comments and metadata. It also moves the parsing logic to earlier in the parse-compose process.

* fix: fix REST transport client creation generated javadoc sample (#1077)

* fix: fixes regionTag breakage

* remove errant comment

Co-authored-by: WhiteSource Renovate <[email protected]>
Co-authored-by: Emily Wang <[email protected]>
Co-authored-by: Vadym Matsishevskyi <[email protected]>
emmileaf added a commit that referenced this pull request Nov 3, 2022
@emmileaf
refactor: expose parsed api short name and version as fields in Servi…
2ebe948
…ce (#1075)

* Exposes parsed apiShortName and apiVersion as fields in Service.java, since the source fields (defaultHost and protoPakkage) are both defined per-service. 

* Adds these two fields correspondingly to GapicClass so that it can be composed from Service given these two upstream fields, then replaces withDefaultHost (for building GapicClass) withApiShortName and withApiVersion. (Composers and tests where this is currently used for sample generation are updated)

* This change will enable Spring Codegen (when eventually split out from this repo) to reuse this parsing logic in descriptive comments and metadata. It also moves the parsing logic to earlier in the parse-compose process.
emmileaf added a commit that referenced this pull request Nov 3, 2022
@alicejli @renovate-bot
@emmileaf @vam-google
fix: fixes regionTag breakage (#1068)
cd35be8
* fix: fixes regionTag breakage

* update credentials integration test

* removing getPureServiceName function

* linter

* refactor test

* chore(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.4.1 (#1072)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [org.apache.maven.plugins:maven-shade-plugin](https://maven.apache.org/plugins/) | `3.4.0` -> `3.4.1` | [![age](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/compatibility-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/confidence-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-generator-java).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yLjMiLCJ1cGRhdGVkSW5WZXIiOiIzNC42LjEifQ==-->

* refactor: expose parsed api short name and version as fields in Service (#1075)

* Exposes parsed apiShortName and apiVersion as fields in Service.java, since the source fields (defaultHost and protoPakkage) are both defined per-service. 

* Adds these two fields correspondingly to GapicClass so that it can be composed from Service given these two upstream fields, then replaces withDefaultHost (for building GapicClass) withApiShortName and withApiVersion. (Composers and tests where this is currently used for sample generation are updated)

* This change will enable Spring Codegen (when eventually split out from this repo) to reuse this parsing logic in descriptive comments and metadata. It also moves the parsing logic to earlier in the parse-compose process.

* fix: fix REST transport client creation generated javadoc sample (#1077)

* fix: fixes regionTag breakage

* remove errant comment

Co-authored-by: WhiteSource Renovate <[email protected]>
Co-authored-by: Emily Wang <[email protected]>
Co-authored-by: Vadym Matsishevskyi <[email protected]>
emmileaf added a commit that referenced this pull request Nov 3, 2022
@emmileaf
Revert "refactor: expose parsed api short name and version as fields …
3fdf7d0
…in Service (#1075)"

This reverts commit 2ebe948.
emmileaf added a commit that referenced this pull request Nov 3, 2022
@emmileaf
Revert "refactor: expose parsed api short name and version as fields …
4302757
…in Service (#1075)"

This reverts commit 2ebe948.
emmileaf added a commit that referenced this pull request Nov 3, 2022
@emmileaf
fix: Revert "chore: merge main into autoconfig-gen-draft2" (#1083)
a8dfd80
* Revert "test: update golden files after annotations import fix"

This reverts commit 0bbfc59.

* Revert "fix(ast): add import generation for annotations on VariableExpr (#1076)"

This reverts commit 9e4721f.

* Revert "chore(main): release 2.10.3 (#1079)"

This reverts commit 63b9bce.

* Revert "fix: fixes regionTag breakage (#1068)"

This reverts commit cd35be8.

* Revert "fix: fix REST transport client creation generated javadoc sample (#1077)"

This reverts commit 5346eef.

* Revert "refactor: expose parsed api short name and version as fields in Service (#1075)"

This reverts commit 2ebe948.

* Revert "chore(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.4.1 (#1072)"

This reverts commit 6774245.

* Revert "chore(main): release 2.10.2 (#1067)"

This reverts commit e8ee82f.

* Revert "fix(deps): update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.5 (#1063)"

This reverts commit aa1782d.

* Revert "fix: update regionTag to use service name (#1047)"

This reverts commit 38010fd.

* Revert "chore(main): release 2.10.1 (#1036)"

This reverts commit 3282e0f.

* Revert "deps: Upgrade protobuf to 3.21.7 (#1048)"

This reverts commit c768691.

* Revert "fix: update sample region tag to parse host instead of proto package (#1040)"

This reverts commit eb94f30.

* Revert "chore(deps): update dependency com.google.auto.value:auto-value to v1.10 (#1058)"

This reverts commit bd5599f.

* Revert "fix: Get numeric value for Enum fields if it is configured as query param or path param (#1042)"

This reverts commit 4b5eadb.

* Revert "fix(deps): update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 (#1050)"

This reverts commit e58bf9d.

* Revert "fix(deps): update dependency org.yaml:snakeyaml to v1.33 (#1043)"

This reverts commit d615305.

* Revert "chore(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.4.0 (#1038)"

This reverts commit ce93705.

* Revert "fix(deps): update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.3 (#1039)"

This reverts commit dba69f4.

* Revert "fix(deps): update dependency org.yaml:snakeyaml to v1.32 (#1037)"

This reverts commit e754a7c.
@zhumin8 zhumin8 mentioned this pull request Nov 7, 2022
fix(spring): use parsed api shortname as libname #1084
Merged
suztomo pushed a commit that referenced this pull request Dec 16, 2022
@emmileaf
refactor: expose parsed api short name and version as fields in Servi…
d3c09c8
…ce (#1075)

* Exposes parsed apiShortName and apiVersion as fields in Service.java, since the source fields (defaultHost and protoPakkage) are both defined per-service. 

* Adds these two fields correspondingly to GapicClass so that it can be composed from Service given these two upstream fields, then replaces withDefaultHost (for building GapicClass) withApiShortName and withApiVersion. (Composers and tests where this is currently used for sample generation are updated)

* This change will enable Spring Codegen (when eventually split out from this repo) to reuse this parsing logic in descriptive comments and metadata. It also moves the parsing logic to earlier in the parse-compose process.
suztomo pushed a commit that referenced this pull request Dec 16, 2022
@alicejli @renovate-bot
@emmileaf @vam-google
fix: fixes regionTag breakage (#1068)
c25afad
* fix: fixes regionTag breakage

* update credentials integration test

* removing getPureServiceName function

* linter

* refactor test

* chore(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.4.1 (#1072)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [org.apache.maven.plugins:maven-shade-plugin](https://maven.apache.org/plugins/) | `3.4.0` -> `3.4.1` | [![age](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/compatibility-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.apache.maven.plugins:maven-shade-plugin/3.4.1/confidence-slim/3.4.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-generator-java).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yLjMiLCJ1cGRhdGVkSW5WZXIiOiIzNC42LjEifQ==-->

* refactor: expose parsed api short name and version as fields in Service (#1075)

* Exposes parsed apiShortName and apiVersion as fields in Service.java, since the source fields (defaultHost and protoPakkage) are both defined per-service. 

* Adds these two fields correspondingly to GapicClass so that it can be composed from Service given these two upstream fields, then replaces withDefaultHost (for building GapicClass) withApiShortName and withApiVersion. (Composers and tests where this is currently used for sample generation are updated)

* This change will enable Spring Codegen (when eventually split out from this repo) to reuse this parsing logic in descriptive comments and metadata. It also moves the parsing logic to earlier in the parse-compose process.

* fix: fix REST transport client creation generated javadoc sample (#1077)

* fix: fixes regionTag breakage

* remove errant comment

Co-authored-by: WhiteSource Renovate <[email protected]>
Co-authored-by: Emily Wang <[email protected]>
Co-authored-by: Vadym Matsishevskyi <[email protected]>
@zhumin8 zhumin8 mentioned this pull request Apr 10, 2024
feat: Parser to consume the api-versioning value from proto #2630
Merged
zhumin8 added a commit that referenced this pull request Apr 24, 2024
@zhumin8
feat: Parser to consume the api-versioning value from proto (#2630)
40711fd
This is part one to resolve b/330980553, this pr allows read and parse
api versioning from proto to service model.

Changes included in this pr:
- rename current apiVersion to packageVersion. This packageVersion is
parsed from package name and exposed in #1075. It was intended to be
used in Spring codegen, but not actually used. It is used in generating
sample region tags (see details
[9ec3531](9ec3531))
- exposing apiVersion from Service model.
- Parser.java to parse apiVersion from `ClientProto.apiVersion` to
service.
lqiu96 pushed a commit that referenced this pull request May 22, 2024
@zhumin8 @lqiu96
feat: Parser to consume the api-versioning value from proto (#2630)
5faf702
This is part one to resolve b/330980553, this pr allows read and parse
api versioning from proto to service model.

Changes included in this pr:
- rename current apiVersion to packageVersion. This packageVersion is
parsed from package name and exposed in #1075. It was intended to be
used in Spring codegen, but not actually used. It is used in generating
sample region tags (see details
[9ec3531](9ec3531))
- exposing apiVersion from Service model.
- Parser.java to parse apiVersion from `ClientProto.apiVersion` to
service.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@zhumin8 zhumin8 Awaiting requested review from zhumin8
2 more reviewers
@blakeli0 blakeli0 blakeli0 approved these changes
@alicejli alicejli alicejli approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@emmileaf @blakeli0 @alicejli
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.