chore: expose methods for parsing api short name and version#1066
chore: expose methods for parsing api short name and version#1066
Conversation
|
Kudos, SonarCloud Quality Gate passed! |
|
Thanks Emily! Both approaches look pretty good! I would prefer the other one, even though it's more code but it opens up more opportunities in the future, if we need |
|
Thanks @blakeli0! I was mainly concerned that the other approach is bringing too much change to the code for just one feature request from the spring side, but your rationale makes sense and it’s helpful to know this refactoring could benefit other development in the future. In this case, I’ll close this PR and open up another one from refactor-parse-defaulthost-2. |








This PR exposes
parseApiShortName(renamed from parseDefaultHost in #1040) andparseApiVersion(refactored from parsing proto package in prepareExecutableSamples) as public static methods inComposer.java. This change will enable Spring Codegen (when eventually split out from this repo) to reuse this parsing logic in descriptive comments and metadata.An alternative refactoring to expose these two values as field accessors in the
Serviceclass can be found on therefactor-parse-defaulthost-2branch. It moves the parsing logic to earlier in the process, since the source fields (defaultHostandprotoPakkage) are both defined per-service. It’s a more convoluted change compared to this PR, but if the approach is preferred or adds any value from the sample generation perspective, happy to switch and open a PR from that branch instead.