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
Service subscription API suggestions #3750
Closed
Closed
Conversation
This file contains 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
Co-authored-by: Daria Mayorova <mayorova@users.noreply.github.com>
mayorova
changed the base branch from
THREESCALE-2689-Service-Subscription-API
to
master
April 16, 2024 14:35
mayorova
force-pushed
the
service-subscription-api-suggestions
branch
from
April 18, 2024 13:40
f6f6939
to
abf4ad5
Compare
Superseded by #3759 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
UPDATE [2024-04-16]:
After speaking with @kevprice83 and @3scale/product we thought that it would be better to deprecate the old enpoints and add new ones to replace them, with the improved representation, to avoid any breaking changes for the customers. So this PR has been changed to adapt to it. It was also rebased on top of
master
to better understand what would be the change compared to the current behavior.This PR addresses some of the issues that I mentioned in the comments to #3672
JSON (see #3672 (comment)) and XML (see #3672 (comment)) representation
I see @nidhi-soni1104 that you added more properties in d458f31, but this is not actually the full fix:
show
, but still the representation was not the same as forindex
, compare:show
:index
:There are a bunch of "null" values in
index
that are not present inshow
, and the responses must be the same.Also, many of the properties that appear in the response (specifically the
index
) are not relevant at all for service subscriptions (description, name, extra fields, first_traffic_* and others), so they had to be removed.Also, the weird
<to_xml/>
in the XML representation were not addressed. And actually, I noticed that in general the XML representation is not right, and it doesn't follow the format we are using for other objects.Compare this:
to this (current representation of an application):
Note the underscores vs dashes in the property names, attributes in some of the elements (e.g.
type="dateTime"
.The bad news is that we were already using this wrong representation in the previously existing
index
endpoint of the API, so this would be a breaking change. On the other hand, I think the sooner we fix it the better - using inconsistent XML format for a single endpoint is pretty bad, IMO, I'd consider it a bug.Errors inconsistencies, see #3672 (comment)
I checked what we do for the applications endpoint, and the errors are represented as:
incorrect plan for apps:
update user key for apps:
This is how the errors generated at model validation look like, so I moved the "same service" validation from the controller to the model. In fact, I think that lacking this validation on the model was a bug, i.e. without the controller validation it was possible to change the subscription to a plan on a different service, which is just wrong (this is not an expected behavior, because, for example, the
service_id
never gets updated on a service contract, and the UI also doesn't support this).Change "Update" endpoint to "Change Plan"
I compared how we change plan for accounts and applications, and it's not done via the
update
endpoint, but rather there is a customchange_plan
endpoint, so I changed this for Service Subscriptions as well, for consistency.I also updated the API Docs and grouped all the Service Subscription-related endpoints under the "Service Subscriptions" tag, as it looked weird under accounts. Now it's better organized.