cloudendpoints / endpoints-java

A Java framework for building RESTful APIs on Google App Engine
Apache License 2.0
32 stars 35 forks source link

Expose EndpointsServlet internals to allow customizing JSON serialization #166

Closed clementdenis closed 5 years ago

clementdenis commented 6 years ago

The goal of these changes is to allow customization of the JSON serialization process of API responses, by subclassing EndpointsServlet, EndpointsMethodHandler and ServletResponseResultWriter.

An example of such a customization is available in this project. PartialResponseEndpointsServlet provides a (hopefully) compatible implementation of the partial response feature that was dropped in Endpoints v2 (see #75). It has some with additional goodies such as eager "fields" validation (Google APIs seem to validate it after executing backend methods), and JSON Pointer support.

codecov-io commented 6 years ago

Codecov Report

Merging #166 into master will decrease coverage by 0.04%. The diff coverage is 80%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #166      +/-   ##
============================================
- Coverage     80.12%   80.07%   -0.05%     
- Complexity     1689     1692       +3     
============================================
  Files           157      157              
  Lines          5629     5637       +8     
  Branches        735      735              
============================================
+ Hits           4510     4514       +4     
- Misses          838      843       +5     
+ Partials        281      280       -1
Impacted Files Coverage Δ Complexity Δ
...rver/spi/response/ServletResponseResultWriter.java 94.8% <100%> (+0.06%) 18 <1> (+1) :arrow_up:
...va/com/google/api/server/spi/EndpointsServlet.java 86.88% <50%> (-2.95%) 18 <1> (ø)
...pi/server/spi/handlers/EndpointsMethodHandler.java 92.85% <88.88%> (-7.15%) 11 <3> (+1)
.../server/spi/discovery/CommonPathPrefixBuilder.java 100% <0%> (+5.55%) 9% <0%> (+1%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 413e434...eaa5153. Read the comment docs.