REST API version specification order

"John P. Rouillard" <[email protected]> Mon, 18 Sep 2023 01:49:53 -0400
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
Hi all:

Currently the rest version specification is:

  Version selection is implemented in the server using one of four
  methods (in priority order, highest first):

     1. Explicit version param in accept header:
	``application/json; version=1``

     2. Version suffix in vendor accept header:
	 ``application/vnd.roundup-v1+json``

     3. Adding ``@apiver: 1`` in the input data wrapper (for POST, PUT)

     4. Adding version specifier in query string: ``@apiver=1`` (for GE
  T).

  The highest priority version method will be used if multiple
  methods are used.

(I'll be committing a fix for the rest docs shortly.).

So in the following curl command:

    curl -u demo:demo -X POST ... \
     -H 'Accept: application/vnd.roundup-v3+json; version=2'
     --data-binary '{ "@apiver": "4" }'
     https://.../tracker//rest/data/status/10?@apiver=5

the server will use version 2. Only if none of the other version
specifiers (2,3,4) are specified will version 5 in the url be used.

If an invalid (non-integer) is given for method 1 or 2, they are ignored.
If an invalid value is given for method 3 or 4, it returns an error.

This seems wrong or at least inconsistent on a couple of levels.

So two questions:

  does the current order make sense? 

      It seems like it should be inverted. Method
        4: the url argument takes  priority followed by
        3: the data payload @apiver then
        1: explicit version property followed by
        2: version in mime type

Thoughts?

  does ignoring mis-specified versions in the header make sense
     while erroring on bad @apiver spec?

     It looks like a bug that the code continues when the accept
     header has invalid version values.

Should an invalid version in the Accept header cause an error if the
version is set by a higher priority method? I claim no but.... 

Anybody have some input on these?

Thanks.

--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.