[fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

Michael Van Canneyt michael at freepascal.org
Sun Jan 15 18:24:42 CET 2023



On Sat, 14 Jan 2023, Wayne Sherman wrote:

> I see a couple of problems TBaseObject.SaveToJSON
>
> 1) TBaseObject.SaveToJSON cannot distinguish properties that are part
> of the REST protocol from properties that are not part of it.  It only
> knows that properties which have been modified are part of the rest
> protocol, but properties which have not been modified might be part of
> the REST protocol or might not be.  For example, a client receives a
> JSON object from a server (via LoadFromJSON) and wants to persist the
> complete JSON object to disk, database, or send it to another server.
> But, at present, there is no way to save all the properties that are
> part of the REST protocol without getting contaminated with non-REST
> properties.

The non-REST properties will never be marked as changed, so they will not be
saved.

>
> 2) Lack of control.  With TBaseObject.SaveToJSON it would be nice to
> control what is saved (Save all REST properties, or Save modified REST
> properties).

It should be easy to add a flag for that.

Michael.


More information about the fpc-devel mailing list