Thursday, July 6, 2017

Re: Django + React: Shared Model Consistency

On Wednesday 05 July 2017 16:34:49 Guilherme Leal wrote:

 

> DRF already have (something like) that [1]. Like I said to George, I'm

> trying to avoid the "request the metadata from the api call" aproach,

> as it tends to bloat the client with metadata requests.

 

There are no psychic clients available yet. Somewhere the client needs to be taught what is considered valid. You always need at least one request (complex, but limits meta data requests) to expose your API's parameters. The other way is to implement some lightweight protocol per endpoint - this is preferable if your API is large and clients typically use a small subset. A structured machine readable error response is the common way. But one can also use HTTP's OPTION method to do this.

 

While OPTION methods shall not be cacheable, nothing prevents you from implementing a versioning scheme and sending an api version header with each response. If the version deviates, the client knows to request the OPTION header again for future use.

 

Either way, you require at least one request to start the learning process.

--

Melvyn Sopacua

No comments:

Post a Comment