[fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;
Michael Van Canneyt
michael at freepascal.org
Sat Jan 14 08:41:39 CET 2023
On Fri, 13 Jan 2023, Wayne Sherman via fpc-devel wrote:
> I am trying to check the googleapiconv "TGoogleRestDescription" object
> contents (which is descended from restbase TBaseObject) by using
> "SaveToJSON". But it always saves an empty object, even when the
> properties have values assigned to them (via LoadFromJSON).
>
> https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/googleapi/generator/googlediscoverytopas.pp#L303
>
> SaveToJSON calls SavePropertyToJSON which checks IsPropertyModified:
>
> https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/fcl-web/src/base/restbase.pp#L1310
>
> If the property has not been modified it is skipped and not saved.
> But ALL of the properties are being skipped since none of them have
> been marked as modified (even though they were actually modified
> during the loading).
No, modifying means changed in user code after load.
The life cycle is one of
a/
- Load data from server. Data is 'unmodified'.
- Optionally modify properties
- If data was modified, send patch to server.
b/
- Create object
- Set properties
- Send post to server.
So the current behaviour is correct.
Michael.
More information about the fpc-devel
mailing list