Browse Source

* Service names need to be sanitized

Michaël Van Canneyt 1 week ago
parent
commit
4773d806ad
1 changed files with 3 additions and 2 deletions
  1. 3 2
      packages/fcl-openapi/src/fpopenapi.pascaltypes.pp

+ 3 - 2
packages/fcl-openapi/src/fpopenapi.pascaltypes.pp

@@ -895,7 +895,8 @@ function TAPIData.GenerateServiceName(const aUrl: String; const aPath: TPathItem
   function CleanIdentifier(S : String) : String;
   function CleanIdentifier(S : String) : String;
 
 
   begin
   begin
-    Result:=StringReplace(S,' ','',[rfReplaceAll])
+    Result:=StringReplace(S,' ','',[rfReplaceAll]);
+    Result:=Sanitize(Result);
   end;
   end;
 {
 {
   the maps contain ServiceName[.MethodName]
   the maps contain ServiceName[.MethodName]
@@ -923,7 +924,7 @@ begin
     // First non-empty
     // First non-empty
     For S in lStrings do
     For S in lStrings do
       if (Result='') and (S<>'') then
       if (Result='') and (S<>'') then
-        Result:=S;
+        Result:=CleanIdentifier(S);
     Result:=ServiceNamePrefix+PrettyPrint(Result)+ServiceNameSuffix;
     Result:=ServiceNamePrefix+PrettyPrint(Result)+ServiceNameSuffix;
     end
     end
   else
   else