Repository navigation
Support Ruby 3.3, 3.4, 4.0 and Rails 8.1, and fix rake api_spec on Rails 7.0+ #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
snhrm
wants to merge
6
commits into
master
Choose a base branch
from
chore/support-ruby-4-0-rails-8-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
89db3fc
Fix rake api_spec raising NoMethodError on Rails 7.0+
snhrm 16f5ad4
Support Ruby 3.3, 3.4, 4.0 and Rails 7.2, 8.0, 8.1
snhrm 7866939
Update changelog and bump version
snhrm 79a6a78
Add PR link to changelog
snhrm c1abd20
Test Ruby 4.0 with Rails 7.0
snhrm 664f4e8
Fix belongs_to $ref with serializer: and skip has_many with non-array…
snhrm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 3.2.2 | ||
| 4.0.9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| source "https://rubygems.org" | ||
|
|
||
| git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | ||
|
|
||
| # Specify your gem's dependencies in open_api_annotator.gemspec | ||
| gemspec path: '..' | ||
|
|
||
| gem 'railties', '~> 7.2.0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| source "https://rubygems.org" | ||
|
|
||
| git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | ||
|
|
||
| # Specify your gem's dependencies in open_api_annotator.gemspec | ||
| gemspec path: '..' | ||
|
|
||
| gem 'railties', '~> 8.0.0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| module OpenApiAnnotator | ||
| VERSION = "0.6.1" | ||
| VERSION = "0.6.2" | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| require 'spec_helper' | ||
| require 'active_model_serializers' | ||
|
|
||
| RSpec.describe OpenApiAnnotator::SerializerAnnotatable do | ||
| before do | ||
| # Annotations without `type:` are warned via Rails.logger | ||
| allow(Rails).to receive(:logger).and_return(Logger.new(nil)) | ||
| stub_const("AuthorSerializer", Class.new(ActiveModel::Serializer) { include OpenApiAnnotator::SerializerAnnotatable }) | ||
| stub_const("BookSerializer", Class.new(ActiveModel::Serializer) { include OpenApiAnnotator::SerializerAnnotatable }) | ||
| end | ||
|
|
||
| describe ".open_api_has_many_associations" do | ||
| subject { BookSerializer.open_api_has_many_associations } | ||
|
|
||
| before { BookSerializer.has_many :authors, nullable: false, serializer: AuthorSerializer } | ||
|
|
||
| it "returns the resource name of the serializer as an array type" do | ||
| is_expected.to eq [OpenApiAnnotator::Association.new(:authors, ["Author"], false)] | ||
| end | ||
| end | ||
|
|
||
| describe ".open_api_has_one_associations" do | ||
| subject { BookSerializer.open_api_has_one_associations } | ||
|
|
||
| before { BookSerializer.has_one :author, nullable: false, serializer: AuthorSerializer } | ||
|
|
||
| it "returns the resource name of the serializer as a single type" do | ||
| is_expected.to eq [OpenApiAnnotator::Association.new(:author, "Author", false)] | ||
| end | ||
| end | ||
|
|
||
| describe ".open_api_belongs_to_associations" do | ||
| subject { BookSerializer.open_api_belongs_to_associations } | ||
|
|
||
| before { BookSerializer.belongs_to :author, nullable: false, serializer: AuthorSerializer } | ||
|
|
||
| it "returns the resource name of the serializer as a single type" do | ||
| is_expected.to eq [OpenApiAnnotator::Association.new(:author, "Author", false)] | ||
| end | ||
| end | ||
| end |
Oops, something went wrong.
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.
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.
wantedly/open_api#18 では 7ad9e95 で Ruby 4.0 × rails-7.0 のセルを追加していますが、こちらには入っていないようです。
annotator は railties / actionpack も読み込むので、対応表の中では Ruby 4.0 × Rails 7.0 がいちばん壊れやすい組み合わせだと思います (手元では spec は通りますが、Rails 7.0 から tsort の deprecation warning が出ます)。open_api#18 に揃えて追加しておくのはどうでしょう。
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.
ありがとうございます、open_api#18 に揃えて Ruby 4.0 × rails-7.0 のセルを追加しました (c1abd20)。
手元 (Docker) でも Ruby 4.0.9 × railties 7.0.10 で 13 examples, 0 failures を確認しています。tsort の warning は railties 7.0 の
rails/initializable.rb由来で 7.1 以降では出ないため、今回はそのままにしています。なお open_api 0.6.3 の公開前なので、このセルも他と同様に依存解決で落ちる状態です。
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.
ご対応ありがとうございます、c1abd20 を確認しました。LGTM です。
open_api#18 の merge と 0.6.3 のリリース後に、こちらの CI を再実行して通ったことを確認してから approve します。
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.
追加の 664f4e8 (belongs_to の
$refの修正と、配列でない has_many のスキップ) も確認しました。こちらも LGTM です。approve は前回書いたとおり、open_api 0.6.3 のリリース後に CI が通ったことを確認してから行います。