* Forgot to commit

This commit is contained in:
Michaël Van Canneyt 2024-10-29 14:16:40 +01:00
parent 77cb7cd454
commit 31448dcf03

View File

@ -201,7 +201,7 @@ begin
For I:=0 to aType.PropertyCount-1 do For I:=0 to aType.PropertyCount-1 do
begin begin
lProp:=aType.Properties[i]; lProp:=aType.Properties[i];
if lProp.PropertyType=ptAPIComponent then if lProp.PropertyType=ptSchemaStruct then
begin begin
if lProp.TypeData.HasObjectProperty(True) then if lProp.TypeData.HasObjectProperty(True) then
lConstructor:='CreateWithMembers' lConstructor:='CreateWithMembers'
@ -295,7 +295,7 @@ end;
function TSerializerCodeGenerator.FieldToJSON(aType: TPropertyType; aFieldName : String): string; function TSerializerCodeGenerator.FieldToJSON(aType: TPropertyType; aFieldName : String): string;
begin begin
if aType in [ptStructure,ptAPIComponent] then if aType in [ptStructure,ptSchemaStruct] then
begin begin
Result := Format('%s.SerializeObject', [aFieldName]); Result := Format('%s.SerializeObject', [aFieldName]);
end end
@ -346,7 +346,7 @@ var
begin begin
if aKeyName='features' then if aKeyName='features' then
Writeln('a'); Writeln('a');
if aType in [ptAPIComponent,ptStructure] then if aType in [ptSchemaStruct,ptStructure] then
begin begin
Result := Format('%s.Deserialize(%s)', [aPropertyTypeName, ObjectField(aKeyName)]); Result := Format('%s.Deserialize(%s)', [aPropertyTypeName, ObjectField(aKeyName)]);
end end
@ -390,7 +390,7 @@ var
begin begin
if aPropertyTypeName='' then if aPropertyTypeName='' then
Writeln('aPropertyTypeName is empty for ',aFieldName); Writeln('aPropertyTypeName is empty for ',aFieldName);
if aType in [ptStructure,ptAPIComponent] then if aType in [ptStructure,ptSchemaStruct] then
Result := Format('%s.Deserialize(%s as TJSONObject)', [aPropertyTypeName, aFieldName]) Result := Format('%s.Deserialize(%s as TJSONObject)', [aPropertyTypeName, aFieldName])
else else
begin begin
@ -444,7 +444,7 @@ begin
lFieldName := aProperty.PascalName; lFieldName := aProperty.PascalName;
lValue := FieldToJSON(aProperty); lValue := FieldToJSON(aProperty);
lType:=aProperty.PropertyType; lType:=aProperty.PropertyType;
lNilCheck:=WriteClassType and (lType in [ptJSON,ptStructure,ptAPIComponent]); lNilCheck:=WriteClassType and (lType in [ptJSON,ptStructure,ptSchemaStruct]);
case lType of case lType of
ptEnum: ptEnum:
begin begin
@ -464,7 +464,7 @@ begin
ptFloat32, ptFloat32,
ptFloat64, ptFloat64,
ptJSON, ptJSON,
ptAPIComponent: ptSchemaStruct:
begin begin
if lNilCheck then if lNilCheck then
begin begin
@ -529,7 +529,7 @@ begin
ptBoolean, ptBoolean,
ptStructure, ptStructure,
ptJSON, ptJSON,
ptAPIComponent: ptSchemaStruct:
Addln('Result.%s:=%s;', [lFieldName, lValue]); Addln('Result.%s:=%s;', [lFieldName, lValue]);
ptArray: ptArray:
begin begin