Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [che-dev] DTO behavior change

Hi Sergii,

On Fri, 2019-06-14 at 09:13 +0300, Sergii Kabashniuk wrote:
Hello

I would like to share a note about the change in DTO behavior on Che master side.

Previously in during DTO serialization, we put everything to the output including
empty collections/fields. At this moment we are not able to identify the concrete reason why we did this way and not the opposite.

In typescript, for example, mandatory but possibly empty and optional are two different types. This may make it harder for some clients to work with the API. Apart from the null checks necessary, I believe we are using some JSON schemas in the API (e.g. kubernetes) where we don't control the definition.


This behavior brings to us some difficulties when we tried to add devfile schema validation in our REST API.
So we decided to rethink this behavior again.  As a result, we think that it makes sense to revert this behavior and do not serialize empty collections/fields. That will allow reducing the size of result json. As a side effect all clients (most of them already doing that)
has to check optional field != null before doing any operation with it.

As we are working towards Che 7 GA, we should restrict our changes progressively to those that are strictly necessary for that goal. Could you explain a bit what the problem is with devfile validation and how this change helps? I think that would improve buy-in from clients.

/Thomas


Back to the top