Methods not found on external-facing API that are declared on an implemented interface
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lazr.restful |
Triaged
|
High
|
Unassigned |
Bug Description
Specifically, in Launchpad there's an interface that's declared like so:
{{{
class IPublishingEdit
"""Base interface for writeable Publishing classes."""
export_
@call_
@operation_
@export_
def requestDeletion
...
}}}
This interface is implemented like this:
{{{
class SourcePackagePu
implements(
}}}
However, only the items exported on ISourcePackageP
Changed in lazr.restful: | |
status: | New → Triaged |
importance: | Undecided → High |
When the WADL is generated we go through all the interfaces that have @export_ as_webservice_ entry, and create a resource_type stanza for each one. You have two such interfaces, ISourcePackageP ublishingHistor y and IPublishingEdit, so your WADL contains two resource types: source_ package_ publishing_ history and publishing_edit. publishing_edit is the one that defines requestDeletion, and in the WADL it serves no purpose but to confuse people. The requestDeletion operation is not present in source_ package_ publishing_ history, which is the resource_type of any SourcePackagePu blishingHistory you receive from the server, so it's not accessible from launchpadlib.
But, if a request does come in to invoke requestDeletion on an ISourcePackageP ublishingHistor y, lazr.restful does a multi-adapter lookup on the ISourcePackageP ublishingHistor y object, which also happens to implement IPublishingEdit. The lookup succeeds and the operation is invoked.
To get this to work as is, we would have to change from iterating over the @export_ as_webservice_ entry interfaces to iterating over every class that implements one or more @export_ as_webservice_ entry interfaces. I'm not sure how to do this but it doesn't sound like a bad idea--it would remove has_bugs and has_milestones from Launchpad's WADL, more resource types that only serve to confuse people. But it's a pretty major project that I don't want to undertake now, especially since you can fix this problem by making ISourcePackageP ublishingHistor y subclass IPublishingEdit and removing @export_ as_webservice_ entry from IPublishingEdit.
Incidentally, according to our web service publishing standards the name of the named operation should be request_deletion. Use a @export_as() call to give it the right name.