Skip to content

Question #1

@HouqiyuA

Description

@HouqiyuA

我运行以下命令来解析 一个web应用的OpenAPI 规范:
python VoAPISpecParser.py --openapi D:\restler-demo\VoAPI2-main\jellyfin-openapi-stable-bak.json --voapi_compiler_dir D:\restler-demo\VoAPI2-main\VoAPICompiler --voapi_compiler_output_dir D:\restler-demo\VoAPI2-main\VoAPICompilerBin --restler_compile_file_path D:\restler-demo\VoAPI2-main\APIInfo-test.txt --recompile
但我没有得到README文档里所说的 APIInfo-****.txt,同时D:\restler-demo\VoAPI2-main\VoAPICompilerBin\Compile\preprocessed目录下也没有相关文件生成。是否我使用的命令是错误的?
进一步,为了排查这个问题我使用了donet单独运行了compile模块
dotnet D:\restler-demo\VoAPI2-main\VoAPICompilerBin\Restler.CompilerExe.dll D:\restler-demo\VoAPI2-main\config.json
其中config.json配置如下:
{ "SwaggerSpecFilePath": [ "D:\\restler-demo\\VoAPI2-main\\jellyfin-openapi-stable-bak.json" ], "GrammarOutputDirectoryPath": "D:\\restler-demo\\VoAPI2-main\\VoAPICompilerBin\\Compile", "IncludeOptionalParameters": true, "UseHeaderExamples": false, "UsePathExamples": false, "UseQueryExamples": true, "UseBodyExamples": false, "UseAllExamplePayloads": false, "DiscoverExamples": false, "ExamplesDirectory": "", "DataFuzzing": true, "ReadOnlyFuzz": false, "ResolveQueryDependencies": true, "ResolveBodyDependencies": true, "ResolveHeaderDependencies": true, "UseRefreshableToken": true, "AllowGetProducers": true, "TrackFuzzedParameterNames": false }
遇到了错误:
[2024/9/5 20:52:16] Generating grammar... [2024/9/5 20:52:17] Getting requests... Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\workspace\NSSL\VoAPI2-github\appwrite.txt'. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize) at System.IO.File.AppendAllText(String path, String contents) at Restler.Compiler.Main.requestDataSeq$cont@1159(Config config, OpenApiDocument swaggerDoc, SchemaCache schemaCache, String ep, KeyValuePair2 m, RequestId requestId, FSharpOption1 exampleConfig, Unit unitVar) in D:\workspace\NSSL\VoAPI2-github\VoAPICompiler\Restler.Compiler\Compiler.fs:line 1273 at Restler.Compiler.Main.getRequestData@1095-1.GenerateNext(IEnumerable1& next) in D:\workspace\NSSL\VoAPI2-github\VoAPICompiler\Restler.Compiler\Compiler.fs:line 1159
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase1.MoveNextImpl() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 371 at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase1.System-Collections-IEnumerator-MoveNext() in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 403
at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeInner@266[T,TResult](ConcatEnumerator2 x, Unit unitVar0) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 268 at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable1 source) in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 825
at Restler.Compiler.Main.generateRequestGrammar(FSharpList1 swaggerDocs, MutationsDictionary dictionary, Config config, FSharpList1 globalExternalAnnotations, FSharpList1 userSpecifiedExamples) in D:\workspace\NSSL\VoAPI2-github\VoAPICompiler\Restler.Compiler\Compiler.fs:line 1333 at Restler.Workflow.generateGrammarFromSwagger(String grammarOutputDirectoryPath, FSharpOption1 swaggerDoc, FSharpOption1 specMetadata, Config config) in D:\workspace\NSSL\VoAPI2-github\VoAPICompiler\Restler.Compiler\Workflow.fs:line 183 at Restler.Workflow.generateRestlerGrammar(FSharpOption1 swaggerDoc, Config config) in D:\workspace\NSSL\VoAPI2-github\VoAPICompiler\Restler.Compiler\Workflow.fs:line 289
at Program.main(String[] argv) in D:\workspace\NSSL\VoAPI2-github\VoAPICompiler\Restler.CompilerExe\Program.fs:line 43`
其中出现了一些不是我本机的路径,是否是这个原因造成我无法成功解析我自定义的swagger文档?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions