3meters / proxibase

Patchr web service
1 stars 0 forks source link

Capture and hoist the api version from the endpoint call #443

Closed Jaymassena closed 7 years ago

Jaymassena commented 7 years ago

I think it would be useful to capture the version number that is part of the service path and hoist it the same way you have done with some other data like the authenticated user. Clients can call passing in the api version they want to execute with and service code can utilize it if we have need to adjust functionality based on the callers target api version. Posting this issue to see if you agree and also you might be right person to implement since you've done all the upstream logic we currently have.

georgesnelling commented 7 years ago

Given our conversation today I'm not sure why this is needed, but it was trivial to add, so I added it. Return val is called apiVersion. It is an integer. Running in production with service version 5.0.1.

georgesnelling commented 7 years ago

Just to clarify, the service apiVersion number, corresponding to "/v1" in the path, is and always has been available to server-side code as req.apiVersion. Right now it means, to me anyway, service API version, not client version. My sense is that we should track client versions numbers in the install record, not the service path, but we can discuss.

Jaymassena commented 7 years ago

Perfect! req.apiVersion is just what I was looking for. I wasn't sure if it was there already so opened the issue.