Closed
Bug 1289886
Opened 9 years ago
Closed 6 years ago
backport upstream bug 1051056 to bmo/master to make REST API versioned
Categories
(bugzilla.mozilla.org :: API, task)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: dkl, Assigned: dkl)
References
Details
Attachments
(2 files, 2 obsolete files)
|
15.76 KB,
text/plain
|
Details | |
|
340.56 KB,
patch
|
dylan
:
review-
|
Details | Diff | Splinter Review |
As described in bug 1051056:
We need to version the REST API so that clients can connect to stable versions with any breaking changes but yet give us a way to improve the API in newer versions that people can upgrade to. This is a backport from upstream that is also included in bmo/upstream-merge branch.
| Assignee | ||
Comment 1•9 years ago
|
||
All GET operations seem to work fine. Am continuing to test with creating/updating operations. Overall ready for review. I did not remove Bugzilla/WebService/Server/REST.pm as I did upstream as it is still needed for the time being for BzAPI (which I would love to turn off).
dkl
Comment 2•9 years ago
|
||
Comment on attachment 8775606 [details] [diff] [review]
1289886_1.patch
clearing review because this doesn't include the dependency info (Moo is a requirement) and this bug is likely blocked on bug 1283930
Attachment #8775606 -
Flags: review?(dylan)
| Assignee | ||
Updated•9 years ago
|
Attachment #8775606 -
Flags: review?(dylan)
Comment 3•9 years ago
|
||
Comment on attachment 8775606 [details] [diff] [review]
1289886_1.patch
Review of attachment 8775606 [details] [diff] [review]:
-----------------------------------------------------------------
this has some bit rot in rest.cgi.
also needs the dependency on Moo declared in Makefile.PL
Attachment #8775606 -
Flags: review?(dylan) → review-
| Assignee | ||
Comment 4•9 years ago
|
||
Attachment #8775606 -
Attachment is obsolete: true
Attachment #8797614 -
Flags: review?(dylan)
Comment 5•9 years ago
|
||
Comment on attachment 8797614 [details] [diff] [review]
1289886_2.patch
Review of attachment 8797614 [details] [diff] [review]:
-----------------------------------------------------------------
So far while I can detect some differences between this and the existing API,
aside from the string/number problem (which I was able to fix with the changes listed below) nothing seems to be amiss.
I'm writing a script that does a/b comparisons between two bmo instances.
https://github.com/dylanwh/bmo-rest-tests/blob/master/tests.pl
::: Bugzilla/API/1_0/Util.pm
@@ +16,5 @@
> +use Bugzilla::Flag;
> +use Bugzilla::FlagType;
> +use Bugzilla::Util qw(datetime_from email_filter);
> +
> +use JSON;
replace with JSON::MaybeXS
also find/replace on s/JSON::(true|false|null)/JSON->$1/g
::: Bugzilla/API/Server.pm
@@ +17,5 @@
> +use Digest::MD5 qw(md5_base64);
> +use File::Spec qw(catfile);
> +use HTTP::Request;
> +use HTTP::Response;
> +use JSON;
replace with JSON::MaybeXS to make numbers come through as numbers.
@@ +150,5 @@
> + my ($self, $status_code, $message, $error_code) = @_;
> + if ($status_code && $message) {
> + $self->{_return_error} = {
> + status_code => $status_code,
> + error => JSON::true,
write this as JSON->true for compatibility with JSON::MaybeXS
@@ +230,5 @@
> + # This may seem a little backwards to set utf8(0), but what this really
> + # means is "don't convert our utf8 into byte strings, just leave it as a
> + # utf8 string."
> + return JSON->new->utf8(0)
> + ->allow_blessed(1)
This can stay the same, as JSON::MaybeXS exports a 'JSON' constant that does the right thing.
You can also replace it with
JSON::MaybeXS->new(utf8 => 0, allow_blessed => 1, convert_blessed => 1);
Comment 6•9 years ago
|
||
Sorry, for JSON->null, use "undef".
There is a JSON::null, but MaybeXS doesn't do that.
Comment 7•9 years ago
|
||
There are a lot more fields returned for /rest/bug/888
take a look.
Updated•9 years ago
|
Attachment #8798444 -
Attachment mime type: text/x-patch → text/plain
Comment 8•9 years ago
|
||
Comment on attachment 8797614 [details] [diff] [review]
1289886_2.patch
this needs to not return all those custom fields and tracking flags when they're not relevant. it's a waste of processing time and bandwidth.
https://bug1289886.bmoattachments.org/attachment.cgi?id=8798444
Attachment #8797614 -
Flags: review?(dylan) → review-
| Assignee | ||
Comment 9•9 years ago
|
||
Attachment #8797614 -
Attachment is obsolete: true
Attachment #8804464 -
Flags: review?(dylan)
Comment 10•9 years ago
|
||
Do we care if is-active is now included in the flag results?
Flags: needinfo?(dkl)
| Assignee | ||
Comment 11•9 years ago
|
||
(In reply to Dylan Hardison [:dylan] from comment #10)
> Do we care if is-active is now included in the flag results?
Can you be more specific? I so not see is_active for set flags using /rest/bug/<bugid>
but I do see is_active for flag_types when using /rest/flag_type/<product> which is
same behavior as before.
dkl
Flags: needinfo?(dkl) → needinfo?(dylan)
Comment 12•9 years ago
|
||
Comment on attachment 8804464 [details] [diff] [review]
1289886_3.patch
r- for some API differences.
I think this won't be landable without also implementing the extra REST methods for extensions -- can you easily lift that code from upstream-merge?
For further testing, you might find my test suite helpful: https://github.com/dylanwh/bmo-rest-tests
test.pl may require some tweaks, but this lets you run A/B testing against the old API and this patch.
Flags: needinfo?(dylan)
Attachment #8804464 -
Flags: review?(dylan) → review-
Updated•8 years ago
|
Component: General → API
Comment 13•6 years ago
|
||
Given that we are leaning toward GraphQL instead of REST API v2, this won’t happen.
Status: ASSIGNED → RESOLVED
Type: defect → task
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•