iilyak commented on issue #820: Add support for queries in /{db}/_all_docs POST
URL: https://github.com/apache/couchdb/issues/820#issuecomment-363618280
 
 
   > Why is one better than the other?
   1. With one to one mapping between request and response the client library 
for static language wouldn't need a factory pattern. For example 
`com.google.gson.JsonParser` for Java requires passing a POJO class to the 
`gson.fromJson` method. The call look like `gson.fromJson(entry.getValue(), 
MyPOJO.class);`. It is more complex when response mutate.
   2. The API becoming expressible using OpenAPI Specification if the response 
structure is independent from:
     - posted content 
     - query parameters
   
   There are quite a few interesting possibilities if we can express our API 
with OpenAPI Specification:
    - we can generate tests to check our input validation automatically
    - there are testing tools to ensure that there are no API changes (they 
work as MITM proxy). We can use this to make sure that:
      1) All APIs are documented in docs
      2) The API specification is in sync with implementation
      3) We are aware of incompatibilities between different versions of spec
    - we can generate some parts of libraries for different languages 
automatically
    - we can generate code to validate input data passed to endpoints
    - we can embed required access roles into spec in order to generate rules 
for `chttpd_auth_request`. Which simplifies security audit of the code. 
    - we can generate boilerplate code for endpoints if decide to switch to 
another http server.
   
   However this is off topic and should be discussed in ML.
   
   I am aware that there are few precedents in CouchDB which return different 
responses based on either posted data or query parameters. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to