You are not logged in.
Pages: 1
Hi Arnaud,
i like to remember to this Problem postet before:
https://synopse.info/forum/viewtopic.php?id=5835)
it would be nice to have the possibility to produce SynCrossplatform Client with m2 - is there any progress to expect ?
br
Rad Studio 12.1 Santorini
Offline
I testet today with the latest release - Same Error - Syncrossplatform Client can not be created with m2
Rad Studio 12.1 Santorini
Offline
Please try/test my fork mormot.soa.codegen.pas. Pull request is 2 days ago, testing is welcome before merge.
https://github.com/TTomas/mORMot2/blob/ … odegen.pas
Discussed in topic https://synopse.info/forum/viewtopic.php?id=6375
Last edited by ttomas (2024-03-19 20:57:14)
Offline
Hi ttomas, thanks for the code. i directly testet it and have some results !
1. The nested records are fine now
but there are the following problems now:
1. the definition of all the dynamic array types is behind (under) the use of them in the previous defined records. (May be depending on the wrapper
2. in the variant2 and 2variant function there is something wrong added
would be easier to understand if i provide some graphics
Link with pictures
https://cloud.diestelmann-it-gmbh.de/s/LwSkbMAwJNTbD2S
Last edited by itSDS (2024-03-20 08:48:33)
Rad Studio 12.1 Santorini
Offline
Hi @itSDS,
0. Can you check/compare M1/M2 context.json, http://localhost:888/root/wrapper/context
1. Yes, depend of mustache template. I'm not sure that is possible correct order of types. I only look at SMS template to convert to pas2js template and in this template first is created all enums, then all record, then all arrays. Manuel modification is needed (reorder types) in created client.
2. Check 0. In M2 context we have all nested records/arrays as temporary type. This is needed for client that don't support nested types. Pas2js support nested records and arrays from some version, but don't support nested array of nested record and we need this temp types
// New Delphi/FPC version support
TPeople = packed record
MyArr: array of record
name: RawUtf8;
end;
end;
// in Pas2JS, must be transformed to
TTmp1 = record
name: RawUtf8;
end;
TMyArr2 = array of TTmp1;
TPeople: TMyArr2;
This temp types also simplify code to all helper variant2* *2variant functions, if you use this types.
Some changes must be done in template if you don't need this temp types. Looking at context.json
"nestedRecord": {
"nestedRecord": null,
"fields": [
{
"typeWrapper": "wRawUtf8",
"typeSource": "RawUtf8",
"typeDelphi": "RawUtf8",
"typePascal": "String",
"typeCS": "string",
"typeJava": "String",
"typeTS": "string",
"typeSwagger": {
"type": "string"
},
"propName": "Name", <---
"fullPropName": "CatNested.Name", <---
"nestedIdentation": " ",
"isSimple": true
},
You can change in template fullPropName to propName, depend what you need to be generated.
I tested only on FPC and Pas2JS template. Delphi testing is needed and all clients templates.
It is good to add field isNested: true to all anonymous temp types to be able to create or not code for this types in template!
Last edited by ttomas (2024-03-20 11:43:01)
Offline
Comparing M1/M2 context, main deafferents is M2 have arrays, M1 don't have (in FPC).
And nestedRecord/Array is array of fields in M1, in M2 we have "fields" property as array of fields.
context.json M1 and M2 https://mega.nz/file/SbBUGaYQ#fwFb07BBX … qM4J3hyeU0
for sample https://synopse.info/forum/viewtopic.ph … 163#p41163
Last edited by ttomas (2024-03-20 12:57:45)
Offline
Hi thank you very much tomas, actually we have modified the mustache Template an can use it with m2. I ll report some things if we are finished
Rad Studio 12.1 Santorini
Offline
I have merged the Tomas' Pull Request.
See https://github.com/synopse/mORMot2/comm … 48c20da7cd
and https://github.com/synopse/mORMot2/comm … 86499a262d
Feedback is welcome!
Online
Pages: 1