Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Expose EndpointsServlet internals to allow customizing JSON serialization#166

Merged
tangiel merged 1 commit intocloudendpoints:masterfrom
AODocs:custom_json_serialization
Sep 20, 2018
Merged

Expose EndpointsServlet internals to allow customizing JSON serialization#166
tangiel merged 1 commit intocloudendpoints:masterfrom
AODocs:custom_json_serialization

Conversation

@clementdenis
Copy link
Contributor

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
Copy link

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) ⬆️
...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%) ⬆️

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.

@tangiel tangiel merged commit 8b52dcf into cloudendpoints:master Sep 20, 2018
@clementdenis clementdenis deleted the custom_json_serialization branch February 21, 2022 13:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants