You are not logged in.
Pages: 1
Hi Arnaud, i generated a soa interface for a new service and created the CrossPlatform Wrappers for an app.
But the generated pas - Sourcecode ist broken. I send you an example via EMail.
Rad Studio 12.1 Santorini
Offline
Example from mORMot2
unit mORMotClient;
{
WARNING:
This unit has been generated by a mORMot 2.0.1 server.
Any manual modification of this file may be lost after regeneration.
Synopse mORMot framework. Copyright (C) 2021 Arnaud Bouchez
Synopse Informatique - http://synopse.info
This unit is released under a MPL/GPL/LGPL tri-license,
and therefore may be freely included in any application.
This unit would work on Delphi 6 and later, under all supported platforms
(including MacOSX, and NextGen iPhone/iPad), and the Free Pascal Compiler.
}
interface
uses
SynCrossPlatformJSON,
SynCrossPlatformSpecific,
SynCrossPlatformREST;
type // define some enumeration types, used below
TPeopleSexe = (sFemale, sMale);
type // define some record types, used as properties below
TresultRec = record
erfolgJN: String;
fehlertext: String;
hinweistext: String;
end;
00e21f50 = record
H3a: Boolean;
H3b: RawBlob;
end;
00e21ea0 = record
H1: Integer;
H2: String;
H3: 00e21f50;record
H3a: Boolean;
H3b: RawBlob;
end;
end;
TTestCustomJSONArraySimpleArray = record
F: String;
F1: TresultRec;record
erfolgJN: String;
fehlertext: String;
hinweistext: String;
end;
G: RawBlob;
H: 00e21ea0;record
H1: Integer;
H2: String;
H3: 00e21f50;record
H3a: Boolean;
H3b: RawBlob;
end;
end;
I: TDateTime;
J: RawBlob;
end;
00e213a0 = record
erfolgJN: String;
fehlertext: String;
hinweistext: String;
end;
Rad Studio 12.1 Santorini
Offline
Same Code with mORMot
unit mORMotClient;
{
WARNING:
This unit has been generated by a mORMot 1.18.6262 server.
Any manual modification of this file may be lost after regeneration.
Synopse mORMot framework. Copyright (C) 2021 Arnaud Bouchez
Synopse Informatique - http://synopse.info
This unit is released under a MPL/GPL/LGPL tri-license,
and therefore may be freely included in any application.
This unit would work on Delphi 6 and later, under all supported platforms
(including MacOSX, and NextGen iPhone/iPad), and the Free Pascal Compiler.
}
interface
uses
SynCrossPlatformJSON,
SynCrossPlatformSpecific,
SynCrossPlatformREST;
type // define some enumeration types, used below
TPeopleSexe = (sFemale, sMale);
TRecordEnum = (reOne, reTwo, reLast);
type // define some record types, used as properties below
TresultRec = record
erfolgJN: String;
fehlertext: String;
hinweistext: String;
end;
TTestCustomJSONArraySimpleArray = record
F: String;
F1: TresultRec;
G: array of String;
H: record
H1: Integer;
H2: String;
H3: record
H3a: Boolean;
H3b: TSQLRawBlob;
end;
end;
I: TDateTime;
J: array of record
J1: Byte;
J2: TGUID;
J3: TRecordEnum;
end;
end;
TResultRecord = record
resultRec: record
erfolgJN: String;
fehlertext: String;
hinweistext: String;
end;
FResult1: String;
FResult2: String;
FResult3: String;
FResult4: String;
end;
TSimpleRecord = record
A: Integer;
B: Integer;
C: String;
end;
Rad Studio 12.1 Santorini
Offline
If i generate the Wrapper with mORMot and the SOA Service with mORMot2 it works
Rad Studio 12.1 Santorini
Offline
i didn't dig in the deep - yet. No proposals atm.
Rad Studio 12.1 Santorini
Offline
Just to say that it works on my side on Delphi 10.4.2 pro.
The only things I have to fix afterward, it's the included units (still generate "unit uses" from mORMot v1) :
uses
SynCommons,
mORMot;
and to comment the TTextWriter initialization :
// TTextWriter.RegisterCustomJSONSerializerFromText
[...]
Offline
@flydev the Problem is here with nestet Records and Array of...
Here is a link to download my sample
for mORMot2 define USE_MORMOTV2 in the options
Rad Studio 12.1 Santorini
Offline
hi Arnaud,
i had a look in the Source code and compared the Units "mORMotWrappers" and "mORMot.soa.codegen"
the TWrapperContext.ContextOneProperty seems to produce different structure.
But i have no idea how to fix it and where exactly the Problem is.
But in mORMot2 the nestedRecord Property is filled and in mORMot not for the same "TResultRec"
mORMot2:
{
"typeWrapper": "wRecord",
"typeSource": "TresultRec",
"typeDelphi": "TresultRec",
"typePascal": "TresultRec",
"typeCS": "TresultRec",
"typeJava": "TresultRec",
"typeTS": "TresultRec",
"typeSwagger": "TresultRec",
"isRecord": true,
"toVariant": "TresultRec2Variant",
"fromVariant": "Variant2TresultRec",
"propName": "resultRec",
"fullPropName": "resultRec",
"isSimple": null,
"nestedRecord": {
"nestedRecord": null,
"fields": [
{
"typeWrapper": "wRawUtf8",
"typeSource": "UTF8String",
"typeDelphi": "RawUtf8",
"typePascal": "String",
"typeCS": "string",
"typeJava": "String",
"typeTS": "string",
"typeSwagger": "{\"type\":\"string\"}",
"propName": "erfolgJN",
"fullPropName": "resultRec.erfolgJN",
"nestedIdentation": " ",
"isSimple": true
},
{
"typeWrapper": "wRawUtf8",
"typeSource": "UTF8String",
"typeDelphi": "RawUtf8",
"typePascal": "String",
"typeCS": "string",
"typeJava": "String",
"typeTS": "string",
"typeSwagger": "{\"type\":\"string\"}",
"propName": "fehlertext",
"fullPropName": "resultRec.fehlertext",
"nestedIdentation": " ",
"isSimple": true
},
{
"typeWrapper": "wRawUtf8",
"typeSource": "UTF8String",
"typeDelphi": "RawUtf8",
"typePascal": "String",
"typeCS": "string",
"typeJava": "String",
"typeTS": "string",
"typeSwagger": "{\"type\":\"string\"}",
"propName": "hinweistext",
"fullPropName": "resultRec.hinweistext",
"nestedIdentation": " ",
"isSimple": true
},
{
"typeWrapper": "wInteger",
"typeSource": "Integer",
"typeDelphi": "Integer",
"typePascal": "Integer",
"typeCS": "integer",
"typeJava": "int",
"typeTS": "number",
"typeSwagger": "{\"type\":\"integer\"}",
"propName": "resultcount",
"fullPropName": "resultRec.resultcount",
"nestedIdentation": " ",
"isSimple": true
}
]
}
}
mORMot:
{
"typeWrapper": "wRecord",
"typeSource": "TresultRec",
"typeDelphi": "TresultRec",
"typePascal": "TresultRec",
"typeCS": "TresultRec",
"typeJava": "TresultRec",
"typeTS": "TresultRec",
"typeSwagger": "TresultRec",
"isRecord": true,
"toVariant": "TresultRec2Variant",
"fromVariant": "Variant2TresultRec",
"propName": "resultRec",
"fullPropName": "resultRec",
"isSimple": null
}
My be you have an idea how to fix it ?! It would be a great help. Ty
Rad Studio 12.1 Santorini
Offline
Hi Arnaud,
i like to move completely to mORMot2. But this feature is a show stopper atm.
I tested and debugged the Problem now for hours but can not solve it.
I just have some new hints and things i found out.
I use the same Sample as above. Slightly enhanced. if you like i can send you the code or show the Problem by Teamviewer.
i Compared the mORMot and mORMot2 by debugging TWrapperContent. And added some TSynLog Stuff to dig in the deep.
The Following Errors are in mORMot2:
1. Nested Records are expanded the reason is in the used new rtti props in ContextOneProperty function
for mORMot Version prop.PropertyType is ptCustom and for mORMot2 prop.Value.Parser is ptRecord
(generally it is a ptRecord but i do not know where mORMot generates the ptCustom where mORMot2 has a ptRecord.)
this adds additional nestedRecord in the structure. which is wrong.
2. Second BUG is a DynArray of (Record or simple Type e.g. String)
in mORMot the Code is correct
in M2 You internally map ptDynArray to Blob which results in wrong code. The Wrong Conversion occurs for example in ContextFromRTTI in
typ := TYPES_ORM[GetOrmFieldType(rtti.Info)];
Hopefully you have an idea to fix the Wrapper Generator with this info
Rad Studio 12.1 Santorini
Offline
Today I had another problem in the Wrapper Generator.
The generated ContractID is different between mORMot2 and mORMot.
However, after I inserted the one generated by mORMot, the data transfer still works.
Rad Studio 12.1 Santorini
Offline
Hi Arnaud, as you now completely switched to mORMot2 is there any chance that this bug will be fixed ?
This is the only reason for me to switch to mORMot1 sometimes.
tyvm
Rad Studio 12.1 Santorini
Offline
Pages: 1