I suspect we use a home grown serialisation to minimise dependencies but I
don't know.
So I would be interested in what others say.
What is our strategy/recommendation in sling when producing json?

Christian

Am Do., 2. Juni 2022 um 10:07 Uhr schrieb José Correia <
[email protected]>:

> Hello!
>
> While working on the Distribution API I noticed some code smells that I
> would like to discuss and see if we have a solution already implemented in
> any Sling repository:
>
>
>    - *Java/JSON serialization*
>
> Currently, we are implementing our own serializer in the form of a generic
> utils class: ServletJsonUtils.java
> <
> https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/servlet/ServletJsonUtils.java
> >.
> This means more code to maintain and higher complexity if we want to change
> the format of the JSON responses.
>
> *Are we already using any JSON serialization library out there?* Was this
> done on purpose to reduce dependencies?
>
>
>    - *JSON response data types*
>
> Every JSON response in the API is built on-demand in the servlet layer
> <
> https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/servlet/DistributionPackageImporterServlet.java#L119
> >.
> This is contributing to increased complexity in these endpoints and makes
> it hard to efficiently grasp how the API works.
> This is an opinionated topic, but I tend to enjoy APIs that have
> well-defined request/response objects since the behavior becomes very easy
> to understand, and it increases readability in the transport layer.
>
> *What do you think?* Are we implementing a similar pattern elsewhere?
>
>
> Cheers,
>
> José Correia
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com

Reply via email to