I have imported a Swagger using the OpenAPI tool and am looking to create an XData server to reflect that. Some of the classes contain TObjectLists and properties that are objects - for example
No. XData is able to handle the full object automatically. I'd just recommend you add the [JsonManaged] attribute to the class so that XData doesn't try to destroy the associated objects, leaving it to the object itself.
Hard to tell without more detailed information. You can of course try to debug XData code, although that's for advanced users. You can try to intercept the HTTP calls and inspect the JSON received by using a tool like Fiddler.
I've been trying to use WireShark and RawCap, but I'm not getting much joy - obviously have the filters set incorrectly.
I don't mind trying to debug through the XData code, but would be useful to have a place to start - such as where it first sees the content stream from the post.
For now, to start with, easiest way is to use Fiddler. Learning to use it is also helpful for any debugging you want to do with TMS Sparkle from Windows. It's much easier and higher-level than WireShark. Never used RawCap. Usually you just need to do this:
Install Fiddler, open it and make sure it's capturing requests (which is on by default when you start it).
uses {...}, Sparkle.WinHttp.Engine;
var
Engine: TWinHttpEngine;
begin
Engine := TWinHttpEngine(FClient.Engine);
Engine.ProxyMode := THttpProxyMode.Auto;
Engine.ResetSession;
end;
Make sure you not access the server using localhost or 127.0.0.1 address otherwise Fiddler will ignore those. Just use, for example, your computer name.
With that you should be able to see exactly the JSON being sent and receive from the server, as well all the HTTP request headers.
Project Coll8ProxyDesktop.exe raised exception class EConvertFromJsonError with message 'Invalid string JSON value at $.customs.commodities[0].weight.unit'.
The JsonProperty attribute should be in the class field, not in class property.
Although that's probably not the cause of the error. The error simply indicates that unit property in JSON is not a valid string.
Your error message and JSON don't match. The error message indicates tha the weight object is inside an object that is the first item of an array (commodities). Your JSON doesn't reflect that. So probably you are inspecting the wrong data.
There were 2 changes I made, one was the attribute position (actually I had it in at both the field and property level, so removed the latter), and I also changed the casing of one field, which was not part of this section but a previous one. So not sure which action fixed it.