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
[spaceship] Move endpoint version from hostname to path #21900
[spaceship] Move endpoint version from hostname to path #21900
Conversation
…st - the same way as in open api specs
…h longer url with services-account
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.
There's a lot of modified files, but easy changes. Looks ok to me.
ServiceOption.new("Legacy iTunesConnect Auth", "idmsa.apple.com", "Web session"), | ||
ServiceOption.new("Legacy iTunesConnect Auth", "appstoreconnect.apple.com/olympus/v1/", "Web session"), | ||
ServiceOption.new("Legacy iTunesConnect", Spaceship::TunesClient.hostname.gsub("https://", ""), "Web session"), | ||
ServiceOption.new("Legacy iTunesConnect Developer Portal", Spaceship::PortalClient.hostname.gsub("https://", ""), "Web session") | ||
ServiceOption.new("Legacy iTunesConnect Developer Portal", Spaceship::PortalClient.hostname.gsub("https://", ""), "Web session"), | ||
ServiceOption.new("App Store Connect API (web session)", Spaceship::ConnectAPI::Provisioning::Client.hostname.gsub("https://", ""), "Web session") |
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.
why did you change the order in this?
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.
I think that the reason was that after the changes
Spaceship::PortalClient.hostname
is https://developer.apple.com/services-account/QH65B2
Spaceship::ConnectAPI::Provisioning::Client.hostname
is https://developer.apple.com/services-account/
and without changing the order, all the calls would have been matched by more generic https://developer.apple.com/services-account/
and the spec was failing because of that.
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.
Looking good so far. Is the motivation behind this change to make it easier to switch versions (v1 -> v2) for specific models?
Hey, have we got any updates on this? Thanks |
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.
Looking good!
Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validci/circleci
builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)Motivation and Context
There is a need for preparing fastlane for implementation of requests that have
v2
orv3
version inpath
component as noted in #21890.There are requests defined in open api spec (https://developer.apple.com/documentation/appstoreconnectapi) that don't have
v1
inpath
, e.g. https://developer.apple.com/documentation/appstoreconnectapi/read_app_availablity_territoriesGET https://api.appstoreconnect.apple.com/v2/appAvailabilities/{id}/territoryAvailabilities
From spec:
Description
Endpoint's
hostname
s forConnectAPI
had hardcoded endpoint versionv1
, also forhttps://api.appstoreconnect.apple.com/v1/
when API token is used.In this PR
v1
version is moved fromhostname
to paths for 4ConnectAPI
clients:tunes_request_client
provisioning_request_client
test_flight_request_client
users_request_client
Also, this change required change in
stats_middleware
andstats_middleware_spec
to properly log use of endpoints.Testing Steps
Runned unit tests. Not all client methods are tested though, so I checked that all
get
,post
,patch
anddelete
requests in code havev1
in path with simple regular expressions: