Skip to content
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

Bump nokogiri from 1.10.10 to 1.13.6 #2988

Merged
merged 2 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ gem 'dalli', '~> 2.7'
gem 'faraday', '~> 0.15.3'
gem 'faraday_middleware', '~> 0.13.1'
gem 'mimemagic', '~> 0.3.10'
gem 'nokogiri', '~> 1.10.10'
gem 'nokogiri', '~> 1.13.6'
gem 'secure_headers', '~> 6.3.0'

gem 'acts-as-taggable-on', '~> 8.0'
Expand Down
10 changes: 6 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ GEM
nokogiri (~> 1)
rake
mini_mime (1.1.1)
mini_portile2 (2.4.0)
mini_portile2 (2.8.0)
minitest (5.10.3)
minitest-ci (3.4.0)
minitest (>= 5.0.6)
Expand All @@ -1571,8 +1571,9 @@ GEM
connection_pool (~> 2.2)
netrc (0.11.0)
nio4r (2.5.8)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.13.6)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
non-stupid-digest-assets (1.0.9)
sprockets (>= 2.0)
ntlm-http (0.1.1)
Expand Down Expand Up @@ -1631,6 +1632,7 @@ GEM
pry (~> 0.13)
public_suffix (4.0.7)
raabro (1.4.0)
racc (1.6.0)
rack (2.1.4.1)
rack-cors (1.1.1)
rack (>= 2.0.0)
Expand Down Expand Up @@ -2042,7 +2044,7 @@ DEPENDENCIES
minitest-stub-const
mocha (~> 1.1.0)
mysql2 (~> 0.5.3)
nokogiri (~> 1.10.10)
nokogiri (~> 1.13.6)
non-stupid-digest-assets (~> 1.0)
oauth2 (~> 1.4)
open_id_authentication
Expand Down
2 changes: 1 addition & 1 deletion app/lib/three_scale/json_representer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def to_node(options)
doc = options.fetch(:doc)
xml = to_xml(builder: builder)

Nokogiri::XML::Node.new('root', doc).replace(xml)
Nokogiri::XML::Node.new('root', doc).add_child(xml)
Copy link
Contributor

@josemigallas josemigallas Jun 3, 2022

Choose a reason for hiding this comment

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

This looks good to me, however I am a little worry this may change the behavior and I don't see any tests related to JSONRepresenter. If I am not mistaken this class manages the JSON format response for models such as

module ApplicationPlansRepresenter
include ThreeScale::JSONRepresenter
wraps_collection :plans
items extend: ApplicationPlanRepresenter
end

Maybe it is covered by integration tests... I am not sure. Have you tested this manually by calling some 3scale API endpoints?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also explain this change? Did API change or what is the point?

Copy link
Contributor

@lvillen lvillen Jun 7, 2022

Choose a reason for hiding this comment

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

@josemigallas I have done some manual tests with 3scale API endpoints and they are working.
@akostadinov the way Nokogiri::XML::Node#new works has changed and now when introducing the xml we need to have a parent node (created at #new). What #add_child does is introducing the xml code inside that parent. I have checked with the console when bundle exec rails t test/integration/user-management-api/buyers_users_test.rb:476.

You can check the differences here: https://diffonline.net/yPYv9bxyVP

Copy link
Contributor

Choose a reason for hiding this comment

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

JSONRepresenter is used by many other representers:

$ rg JSONRepresenter
test/test_helpers/represented_api_routing.rb
27:    include ThreeScale::JSONRepresenter
35:    include ThreeScale::JSONRepresenter
44:    include ThreeScale::JSONRepresenter
52:    include ThreeScale::JSONRepresenter

app/representers/access_token_representer.rb
4:  include ThreeScale::JSONRepresenter

app/representers/account_plan_representer.rb
2:  include ThreeScale::JSONRepresenter
...

to_node is probably used for XML representing.

@lvillen , what I didn't understand is why replace stopped working. #add_child I assume would be equivalent to #replace when same element does not exist anymore. But is it possible same element to exist? Is it possible to make #replace work?

Perhaps it is fine to have it like it is though. Still it is preferable to understand :)

end

module Format
Expand Down