Skip to content

CLI not working due to an unconfigured mock #303

@basilfx

Description

@basilfx

Describe the issue

Object reference not set to an instance of an object.
   at Microsoft.Azure.WebJobs.Extensions.OpenApi.Document.Build(Assembly assembly, OpenApiVersionType version) in azure-functions-openapi-extension/src/Microsoft.Azure.WebJobs.Extensions.OpenApi/Document.cs:line 137
   at Microsoft.Azure.WebJobs.Extensions.OpenApi.Document.Build(String assemblyPath, OpenApiVersionType version) in azure-functions-openapi-extension/src/Microsoft.Azure.WebJobs.Extensions.OpenApi/Document.cs:line 124
   at Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI.Program.Generate(String project, String configuration, String target, OpenApiVersionType version, OpenApiFormatType format, String output, Boolean console) in azure-functions-openapi-extension/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI/Program.cs:line 90

A Mock is constructed for req without providing a getter for req.Query. It fails eventually when it executes this._req.Query["tags"].

To Reproduce

  1. Have a working project (i.e. the web interface works)
  2. Run the CLI (e.g. -p ../My.Project -v v3 -f yaml -t netcoreapp3.1 --console
  3. Observe it fails

Expected behavior
It generates a Swagger specification.

Screenshots
N/a

Environment (please complete the following information, if applicable):

  • OS: macOS 12.0.1
  • .NET SDK 5.0.402
  • 0.9.0-preview (from source)

Additional context
N/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions