← Back to team overview

dhis2-devs-core team mailing list archive

Re: ApiVersioning redux

 

Hi Halvdan

We spoke briefly about the API versioning last week. What is the current
> status of the development?
>

I don't think there has been any developments... I think we need to have a
larger discussion around this, at the same time.. for 2.24, let's be
pragmatic and simply expose old stuff as new stuff ;) except for a few
endpoint which are new (like the new importer)

I think right now there's a bit of confusion still as to how it's supposed
> to work. Especially in the migration phase that we're going into.
>

Yes, there are no clear guidelines for this yet, this especially applies to
our domain model

Could you perhaps provide us with examples of correct
> configuration/annotations for the following scenarios?
>
>    1. Iterating on an existing endpoint by adding an api 24-specific
>    request handler.
>
>
I assume you want the old stuff also available on 2.24 then? probably you
would have to map the entire controller with V23, V24, then exclude V23 on
your new method @ApiVersion(exclude = V23)

>
>    1. Creating a new endpoint (controller/method) which is only to be
>    available in 24 and onwards (and not on default, 23).
>
> That should be as simple as mapping it with @ApiVersion(V24)


> Also, we should figure out and agree on what should be the behaviour when
> an endpoint doesn't exist (i.e. is not available on "default"). 404? 405?
>

Right, I think 404 is correct, that endpoint simply does not exist

Currently the web api tests in trunk fail because they expect 404 on
> non-mapped endpoints, but in actuality 405 is returned by Spring. What are
> we expecting to happen here? I assume the tests should work as internal
> docs for this stuff in the intermediate...
>

Those tests are being updated very soon, Viet just finished the translation
blueprint.. so he will now focus on spring test again


> Also, the current setup, as far as I can tell, only seems to work for GET.
> As an example I've mapped a controller to:
>
> @RequestMapping( value = ProgramStageNotificationSchemaDescriptor.API_ENDPOINT )
>
> This works fine for GET, allowing me to use api/24/endpoint but not
> api/endpoint or api/23/endpoint. For POST and PUT, however, all of the
> above actually seem to work. I guess this is a bug, or just a temporary
> implementation?
>

Not 100% sure what you mean here, we already have POST/PUT with different
methods on / vs /24 etc (for same mapping)... but I will try it out, maybe
there are some bugs there

--
Morten


>
> Morten, could you shine some of your glorious light on this? :)
>
> --
> Halvdan Hoem Grelland
> Software developer, DHIS 2
> University of Oslo
> http://www.dhis2.org <https://www.dhis2.org/>
>
>

Follow ups

References