Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging in RESTler compile step in case of a spec issue instead of just failing without and not giving clear indication of which property is problematic #878

Open
SwamyNallamalli opened this issue Mar 18, 2024 · 1 comment

Comments

@SwamyNallamalli
Copy link
Collaborator

SwamyNallamalli commented Mar 18, 2024

Description

When the RESTler compile step is attempted with a spec that has an issue where array element doesn't have a declared type in RESTler. It would be beneficial if the logging is improved to show which specific filed(s) are problematic.

The error is:
Unhandled exception. System.ArgumentException: Invalid array schema: found array property without a declared element at Restler.Compiler.SwaggerVisitors.generateGrammarElementForSchema(JsonSchema schema, FSharpOption1 exampleValue, Boolean generateFuzzablePayloadsForExamples, Boolean trackParameters, FSharpOption1 jsonPropertyMaxDepth, Boolean isRequired, Boolean isReadOnly, FSharpList1 parents, SchemaCache schemaCache, FSharpFunc2 cont) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\SwaggerVisitors.fs:line 690 at Restler.Compiler.SwaggerVisitors.processProperty(String propertyName, JsonSchemaProperty property, FSharpOption1 propertyPayloadExampleValue, Boolean generateFuzzablePayload, Boolean trackParameters, FSharpOption1 jsonPropertyMaxDepth, FSharpList1 parents, SchemaCache schemaCache, FSharpFunc2 cont) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\SwaggerVisitors.fs:line 479 at Restler.Compiler.SwaggerVisitors.declaredPropertyParameters@657.Invoke(KeyValuePair2 item) in D:\a_work_temp\restler-fuzzer\src\compiler\Restler.Compiler\SwaggerVisitors.fs:line 663
at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@171.System-Collections-IEnumerator-MoveNext() in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 179
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 Microsoft.FSharp.Collections.SeqModule.oneStepTo@987[T](IEnumerable1 source, List1 prefix, FSharpRef1 enumeratorR, Int32 i) in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 996
at Microsoft.FSharp.Collections.SeqModule.action@4164-1[T](IEnumerable1 source, List1 prefix, FSharpRef1 enumeratorR, Int32 i, Unit unitVar0) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 1011 at [email protected](Int32 i) at Microsoft.FSharp.Collections.Internal.IEnumerator.unfold@205.DoMoveNext(b& curr) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 207 at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 64
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable1 source) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 546 at Restler.Compiler.SwaggerVisitors.generateGrammarElementForSchema(JsonSchema schema, FSharpOption1 exampleValue, Boolean generateFuzzablePayloadsForExamples, Boolean trackParameters, FSharpOption1 jsonPropertyMaxDepth, Boolean isRequired, Boolean isReadOnly, FSharpList1 parents, SchemaCache schemaCache, FSharpFunc2 cont) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\SwaggerVisitors.fs:line 885 at Restler.Compiler.SwaggerVisitors.generateGrammarElementForSchema(JsonSchema schema, FSharpOption1 exampleValue, Boolean generateFuzzablePayloadsForExamples, Boolean trackParameters, FSharpOption1 jsonPropertyMaxDepth, Boolean isRequired, Boolean isReadOnly, FSharpList1 parents, SchemaCache schemaCache, FSharpFunc2 cont) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\SwaggerVisitors.fs:line 701 at Restler.Compiler.SwaggerVisitors.processProperty(String propertyName, JsonSchemaProperty property, FSharpOption1 propertyPayloadExampleValue, Boolean generateFuzzablePayload, Boolean trackParameters, FSharpOption1 jsonPropertyMaxDepth, FSharpList1 parents, SchemaCache schemaCache, FSharpFunc2 cont) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\SwaggerVisitors.fs:line 479 at Restler.Compiler.SwaggerVisitors.declaredPropertyParameters@657.Invoke(KeyValuePair2 item) in D:\a_work_temp\restler-fuzzer\src\compiler\Restler.Compiler\SwaggerVisitors.fs:line 663
at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@171.System-Collections-IEnumerator-MoveNext() in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 179
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 Microsoft.FSharp.Collections.SeqModule.oneStepTo@987[T](IEnumerable1 source, List1 prefix, FSharpRef1 enumeratorR, Int32 i) in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 996
at Microsoft.FSharp.Collections.SeqModule.action@4164-1[T](IEnumerable1 source, List1 prefix, FSharpRef1 enumeratorR, Int32 i, Unit unitVar0) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 1011 at [email protected](Int32 i) at Microsoft.FSharp.Collections.Internal.IEnumerator.unfold@205.DoMoveNext(b& curr) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 207 at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() in F:\workspace_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 64
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable1 source) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 546 at Restler.Compiler.SwaggerVisitors.generateGrammarElementForSchema(JsonSchema schema, FSharpOption1 exampleValue, Boolean generateFuzzablePayloadsForExamples, Boolean trackParameters, FSharpOption1 jsonPropertyMaxDepth, Boolean isRequired, Boolean isReadOnly, FSharpList1 parents, SchemaCache schemaCache, FSharpFunc2 cont) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\SwaggerVisitors.fs:line 885 at [email protected](IEnumerable1& next) in D:\a_work_temp\restler-fuzzer\src\compiler\Restler.Compiler\Compiler.fs:line 0
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.Collections.SeqModule.TryHead[T](IEnumerable1 source) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 1370 at Restler.Compiler.Main.requestDataSeq$cont@1176(Config config, OpenApiDocument swaggerDoc, SchemaCache schemaCache, String ep, KeyValuePair2 m, RequestId requestId, FSharpOption1 exampleConfig, Unit unitVar) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\Compiler.fs:line 1268 at [email protected](IEnumerable1& next) in D:\a_work_temp\restler-fuzzer\src\compiler\Restler.Compiler\Compiler.fs:line 1176
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:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\Compiler.fs:line 1338 at Restler.Workflow.generateGrammarFromSwagger(String grammarOutputDirectoryPath, Config config) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\Workflow.fs:line 143 at Restler.Workflow.generateRestlerGrammar(Config config) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.Compiler\Workflow.fs:line 250 at Program.main(String[] argv) in D:\a\_work\_temp\restler-fuzzer\src\compiler\Restler.CompilerExe\Program.fs:line 43

Steps to reproduce

Expected results

No response

Actual results

No response

Environment details

No response

@yufan412
Copy link

I also encountered this issue while compiling the specification file for Gitlab. May I ask if you have resolved it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants