Merge lp:~leonardr/lazr.restful/operation-must-be-versioned into lp:lazr.restful

Proposed by Leonard Richardson
Status: Merged
Merged at revision: 181
Proposed branch: lp:~leonardr/lazr.restful/operation-must-be-versioned
Merge into: lp:lazr.restful
Diff against target: 0 lines
To merge this branch: bzr merge lp:~leonardr/lazr.restful/operation-must-be-versioned
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+52858@code.launchpad.net

Description of the change

This branch makes it impossible to expose a named operation against the earliest version of the web service without explicitly specifying @operation_for_version(earliest_version). This is only enforced if the web service configuration has set .require_explicit_versions to True.

All named operations have implicit annotations for the earliest version, set by the system before processing explicit annotations. We only make a fuss if the implicit annotations say to *publish* the method in the earliest version.

An alternative is to have each annotation method set a 'dirty bit' along with its annotation, and check the dirty bit for the implicit-earliest-version. This will catch errors where the user annotates a method for the earliest version but forgets to actually say @export_as_read_operation or whatever. I think the additional complexity isn't worth it. I also thought of an idea based around _protecting_ the implicit-earliest-version from writes, but I decided that was also too complicated.

I did some minor refactoring of the test framework, adding a helper method that makes it easy to get a fake request for a given web service version.

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

Leonard--

This looks good to land, and thanks for adding this guard so we stop accidentally borking the 1.0 API.

review: Approve

Preview Diff

Empty

Subscribers

People subscribed via source and target branches