Skip to content

Incomplete OpenApiResponse #1315

@LucGenetier

Description

@LucGenetier

Describe the bug
OpenApiResponse object doesn't include the schema that is included in the swagger file.

    "responses": {
      "200": {
        "description": "OK",
        "schema": {
          "format": "binary",
          "description": "The content of the file.",
          "type": "string",
          "x-ms-summary": "File Content"
        }
      },
      "default": {
        "description": "Operation Failed."
      }
    }, ...

To Reproduce

string swaggerFile = @"https://raw.githubusercontent.com/microsoft/Power-Fx/main/src/tests/Microsoft.PowerFx.Connectors.Tests/Swagger/AzureBlobStorage.json";
using HttpClient client = new HttpClient();
HttpResponseMessage webResponse = await client.GetAsync(swaggerFile).ConfigureAwait(false);
string swagger = await webResponse.Content.ReadAsStringAsync().ConfigureAwait(false);	
OpenApiDocument doc = new OpenApiStringReader().Read(swagger, out OpenApiDiagnostic diag);
OpenApiOperation op = doc.Paths["/{connectionId}/datasets/default/GetFileContentByPath"].Operations[OperationType.Get];
OpenApiResponse response = op.Responses["200"];	

Look at the response object and compare it with the swagger file
All fields/props are either null or empty.

Expected behavior
Have a way to access the schema, via Content or any other means.

Screenshots/Code Snippets
See code snippet

Additional context
It's likely related to "Produces" item which is not defined, neither locally, nor globally.
Per Swagger/OpenAPI spec, in Response object, schema SHOULD be accompanied by a relevant produces mime-type.
... but it's not mandatory.

Metadata

Metadata

Assignees

Labels

type:bugA broken experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions