swagger-api / swagger-api/swagger-codegen

[Ruby] OpenAPI spec version is not being updated in spec/* files

Open
#12,342 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Calling swagger-codegen for the ruby client does not update the OpenAPI spec version in the comments of the spec files.

Swagger-codegen version
> swagger-codegen version
3.0.52
Swagger declaration file content or url

OpenAPI yaml spec:

https://gist.github.com/pijng/b3d09581c4f7bbf81bac4778dc8516f2

Command line used for generation
swagger-codegen generate -i ./openapi.yaml -l ruby -o /Projects/swagger-codegen-ruby/ --additional-properties gemName=moonlogs-ruby gemVersion=0.3.10
Steps to reproduce
  1. Create an empty directory
  2. Populate it with generated ruby client for version 0.3.10 using openapi.yaml spec from gist by calling:
swagger-codegen generate -i ./openapi.yaml -l ruby -o <path-to-directory> --additional-properties gemName=moonlogs-ruby gemVersion=0.3.10
  1. Change the info.version to 0.3.11 in openapi.yaml
  2. Call swagger-codegen against the updated openapi.yaml with relevant version in gemVersion:
swagger-codegen generate -i ./openapi.yaml -l ruby -o <path-to-same-directory> --additional-properties gemName=moonlogs-ruby gemVersion=0.3.11

As the result, all references to version 0.3.10 will be replaced by 0.3.11, except for files in the spec/ directory.

Demonstrating the difference between versions at a single point in time:

image image
Related issues/PRs
Suggest a fix/enhancement

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the linked OpenAPI YAML and the two swagger-codegen generate commands, comparing generated files under spec/ before and after changing info.version and gemVersion. Trace the Ruby generator's handling of spec/* files and verify that rerunning generation updates their version comments from 0.3.10 to 0.3.11.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, ruby
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.