Set minimum required Ruby version to 2.7 - #24992
Conversation
There was a problem hiding this comment.
2 issues found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java">
<violation number="1" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java:72">
P3: This field default does not reach the generated gemspec, so changing it (and the old `>= 1.9`) has no effect on generated output. `processOpts` only calls `setGemRequiredRubyVersion` when the user supplies the property and never writes the field back into `additionalProperties`, and the field is read nowhere else (it only has a `@Setter`, no getter). The gemspec's actual minimum comes from `gemspec.mustache` line 21, whose own fallback is already `>= 2.7`. Either propagate the field value into `additionalProperties` (so the class remains the single source of truth) or drop the now-duplicated default; otherwise the two defaults will drift again.</violation>
<violation number="2" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java:72">
P2: The new `>= 2.7` default contradicts the `CliOption` default for this same option, which still shows `defaultValue(">= 2.4")` on line 167. That CLI default is what users see in `config-help` and what is auto-generated into `docs/generators/ruby.md` (row: `|gemRequiredRubyVersion|gem required Ruby version. | |>= 2.4|`), so the documented default remains below the new minimum and users generating from that default (e.g. via a copied JSON config) still get gems requiring `>= 2.4`. Update the `CliOption` default to `>= 2.7` and regenerate the ruby generator docs so the advertised default matches the new minimum.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| protected String libFolder = "lib"; | ||
| @Setter protected String gemLicense = "unlicense"; | ||
| @Setter protected String gemRequiredRubyVersion = ">= 1.9"; | ||
| @Setter protected String gemRequiredRubyVersion = ">= 2.7"; |
There was a problem hiding this comment.
P2: The new >= 2.7 default contradicts the CliOption default for this same option, which still shows defaultValue(">= 2.4") on line 167. That CLI default is what users see in config-help and what is auto-generated into docs/generators/ruby.md (row: |gemRequiredRubyVersion|gem required Ruby version. | |>= 2.4|), so the documented default remains below the new minimum and users generating from that default (e.g. via a copied JSON config) still get gems requiring >= 2.4. Update the CliOption default to >= 2.7 and regenerate the ruby generator docs so the advertised default matches the new minimum.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java, line 72:
<comment>The new `>= 2.7` default contradicts the `CliOption` default for this same option, which still shows `defaultValue(">= 2.4")` on line 167. That CLI default is what users see in `config-help` and what is auto-generated into `docs/generators/ruby.md` (row: `|gemRequiredRubyVersion|gem required Ruby version. | |>= 2.4|`), so the documented default remains below the new minimum and users generating from that default (e.g. via a copied JSON config) still get gems requiring `>= 2.4`. Update the `CliOption` default to `>= 2.7` and regenerate the ruby generator docs so the advertised default matches the new minimum.</comment>
<file context>
@@ -69,7 +69,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
protected String libFolder = "lib";
@Setter protected String gemLicense = "unlicense";
- @Setter protected String gemRequiredRubyVersion = ">= 1.9";
+ @Setter protected String gemRequiredRubyVersion = ">= 2.7";
@Setter protected String gemHomepage = "https://openapitools.org";
@Setter protected String gemSummary = "A Ruby SDK for the REST API";
</file context>
| protected String libFolder = "lib"; | ||
| @Setter protected String gemLicense = "unlicense"; | ||
| @Setter protected String gemRequiredRubyVersion = ">= 1.9"; | ||
| @Setter protected String gemRequiredRubyVersion = ">= 2.7"; |
There was a problem hiding this comment.
P3: This field default does not reach the generated gemspec, so changing it (and the old >= 1.9) has no effect on generated output. processOpts only calls setGemRequiredRubyVersion when the user supplies the property and never writes the field back into additionalProperties, and the field is read nowhere else (it only has a @Setter, no getter). The gemspec's actual minimum comes from gemspec.mustache line 21, whose own fallback is already >= 2.7. Either propagate the field value into additionalProperties (so the class remains the single source of truth) or drop the now-duplicated default; otherwise the two defaults will drift again.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java, line 72:
<comment>This field default does not reach the generated gemspec, so changing it (and the old `>= 1.9`) has no effect on generated output. `processOpts` only calls `setGemRequiredRubyVersion` when the user supplies the property and never writes the field back into `additionalProperties`, and the field is read nowhere else (it only has a `@Setter`, no getter). The gemspec's actual minimum comes from `gemspec.mustache` line 21, whose own fallback is already `>= 2.7`. Either propagate the field value into `additionalProperties` (so the class remains the single source of truth) or drop the now-duplicated default; otherwise the two defaults will drift again.</comment>
<file context>
@@ -69,7 +69,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
protected String libFolder = "lib";
@Setter protected String gemLicense = "unlicense";
- @Setter protected String gemRequiredRubyVersion = ">= 1.9";
+ @Setter protected String gemRequiredRubyVersion = ">= 2.7";
@Setter protected String gemHomepage = "https://openapitools.org";
@Setter protected String gemSummary = "A Ruby SDK for the REST API";
</file context>
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java">
<violation number="1" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java:167">
P3: Raising the minimum Ruby version to 2.7 leaves the ruby-client RuboCop template stale: `modules/openapi-generator/src/main/resources/ruby-client/rubocop.mustache` still generates `TargetRubyVersion: 2.4`, and the regenerated samples confirm it (e.g. `samples/client/petstore/ruby/.rubocop.yml` still says `TargetRubyVersion: 2.4`). For consistency with the new `required_ruby_version`, bump the template to 2.7 and regenerate the samples.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| cliOptions.add(new CliOption(GEM_REQUIRED_RUBY_VERSION, "gem required Ruby version. "). | ||
| defaultValue(">= 2.4")); | ||
| defaultValue(">= 2.7")); |
There was a problem hiding this comment.
P3: Raising the minimum Ruby version to 2.7 leaves the ruby-client RuboCop template stale: modules/openapi-generator/src/main/resources/ruby-client/rubocop.mustache still generates TargetRubyVersion: 2.4, and the regenerated samples confirm it (e.g. samples/client/petstore/ruby/.rubocop.yml still says TargetRubyVersion: 2.4). For consistency with the new required_ruby_version, bump the template to 2.7 and regenerate the samples.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java, line 167:
<comment>Raising the minimum Ruby version to 2.7 leaves the ruby-client RuboCop template stale: `modules/openapi-generator/src/main/resources/ruby-client/rubocop.mustache` still generates `TargetRubyVersion: 2.4`, and the regenerated samples confirm it (e.g. `samples/client/petstore/ruby/.rubocop.yml` still says `TargetRubyVersion: 2.4`). For consistency with the new `required_ruby_version`, bump the template to 2.7 and regenerate the samples.</comment>
<file context>
@@ -164,7 +164,7 @@ public RubyClientCodegen() {
cliOptions.add(new CliOption(GEM_REQUIRED_RUBY_VERSION, "gem required Ruby version. ").
- defaultValue(">= 2.4"));
+ defaultValue(">= 2.7"));
cliOptions.add(new CliOption(GEM_HOMEPAGE, "gem homepage. ").
</file context>
a follow up pr to #24869
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Summary by cubic
Sets the minimum required Ruby version for generated Ruby clients to 2.7 instead of 1.9, and updates the CLI option default and RuboCop
TargetRubyVersionfrom 2.4 to 2.7 so everything matches.Users on Ruby versions older than 2.7 will no longer be able to install the generated gem.
Written for commit b41aeeb. Summary will update on new commits.