microsoft / restler-fuzzer

RESTler is the first stateful REST API fuzzing tool for automatically testing cloud services through their REST APIs and finding security and reliability bugs in these services.
MIT License
2.52k stars 284 forks source link

Failed to compile swagger.json due to System.ArgumentException #794

Open anabyv opened 11 months ago

anabyv commented 11 months ago

Description

I was executing the restler.exe compile restlerConfig/config.json for config generated based on my swagger and faced the following error:

Starting task Compile...

ERROR: Compiler failed. See logs in E:\restler_bin\restler\Compile directory for more information.

Task Compile failed.
Collecting logs...

I see the following log in StdErr.txt:

Unhandled exception. System.ArgumentException: Invalid context for property type.
   at Restler.CodeGenerator.Python.formatNestedQueryParameter@306(RequestParameter requestParameter, String parameterName, NestedType propertyType, FSharpOption`1 namePayloadSeq, IEnumerable`1 innerProperties) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 319
   at Restler.CodeGenerator.Python.generatePythonParameter@417-1.Invoke(Int32 level, InnerProperty p, IEnumerable`1 innerProperties) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 438
   at Restler.Grammar.Tree.processTree@34-1.Invoke(IEnumerable`1 ts) in E:\restler-fuzzer\src\compiler\Restler.Compiler\Grammar.fs:line 35
   at Restler.CodeGenerator.Python.generatePythonParameter(Boolean includeOptionalParameters, ParameterPayloadSource parameterSource, ParameterKind parameterKind, RequestParameter requestParameter) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 451
   at Restler.CodeGenerator.Python.parameters@496-3.Invoke(RequestParameter p) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 496
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 247
   at Restler.CodeGenerator.Python.generatePythonFromRequestElement(Boolean includeOptionalParameters, RequestId requestId, RequestElement e) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 495
   at Restler.CodeGenerator.Python.generatePythonFromRequest@762.Invoke(RequestElement requestElement) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 763
   at Restler.CodeGenerator.Python.generatePythonFromRequest(Request request, Boolean includeOptionalParameters, Boolean mergeStaticStrings) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 761
   at Restler.CodeGenerator.Python.generatePythonRequest@1216(Boolean includeOptionalParameters, FSharpFunc`2 formatRestlerPrimitive, Request request) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 1217
   at Restler.CodeGenerator.Python.getRequests@1244.Invoke(Request r) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 1244
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\local.fs:line 247
   at Restler.CodeGenerator.Python.generatePythonGrammar@1258.GenerateNext(IEnumerable`1& next) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 1265
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 371
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 546
   at Restler.CodeGenerator.Python.generateCode(GrammarDefinition grammar, Boolean includeOptionalParameters, FSharpFunc`2 write) in E:\restler-fuzzer\src\compiler\Restler.Compiler\CodeGenerator.fs:line 1290
   at Restler.Workflow.generatePython(String grammarOutputDirectoryPath, Config config, GrammarDefinition grammar) in E:\restler-fuzzer\src\compiler\Restler.Compiler\Workflow.fs:line 31
   at Restler.Workflow.generateRestlerGrammar(Config config) in E:\restler-fuzzer\src\compiler\Restler.Compiler\Workflow.fs:line 256
   at Program.main(String[] argv) in E:\restler-fuzzer\src\compiler\Restler.CompilerExe\Program.fs:line 43

could you please help me to resolve this? thanks!

Steps to reproduce

restler.exe compile restlerConfig/config.json

Expected results

No response

Actual results

No response

Environment details

Windows; Python 3.10.6; dotnet 7.0.306; RESTler version: 9.2.2