Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

swagger: is '😱 Could not render this component, see the console' an error message or can it be ignored

I was wondering if the,

'😱 Could not render this component, see the console' 

(shown in first image) was an error message or if it can just be ignored (or maybe a warning that encompass a lot and therefore is not always applicable?). I am testing uploading a file (as shown in first image). The code that is getting hit (the nodejs javascript which corresponds to this post) is shown in the code sample below figure 1. it is very simply but once line 23 gets executed the 'could not render' message appears. However, the response of 'Hello World!' does get displayed in swagger. I looked around online for the meaning of this message but the only postings about this didn't seem to be asking about this message but an error message in the 'server response' section of swagger.

enter image description here

//POST 
function uploadAzureFile(req, res, next) {

  res.json('Hello World');
  // res.status(200).send('OK');

}

======== In response to Helen ========

======== CURL ========

Found information on cURL here. How would i access swagger.yaml from curl?

C:\swagger\curl>curl -I "http://localhost:1337/swagger.yaml"
HTTP/1.1 404 Not Found
X-Powered-By: Express
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 26
Date: Sun, 06 Aug 2017 19:33:37 GMT
Connection: keep-alive

C:\swagger\curl>curl -I "http://localhost:1337/"
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: text/html; charset=utf-8
Content-Length: 30
ETag: W/"4z-8nd23698"
Date: Sun, 06 Aug 2017 19:35:50 GMT
Connection: keep-alive
like image 733
Fractal Avatar asked Aug 04 '17 21:08

Fractal


2 Answers

cURL command not rendered

In this example, the thing that could not be rendered is the cURL command. The issue was caused by this bug that affected the display of cURL commands for multipart/* requests. This bug was fixed in Swagger UI 3.1.5 and Swagger Editor 3.1.4 back in August 2017. Please use the latest version.

Note that the actual API calls were not affected by the issue – requests were actually sent, and you can see your "Hello World" response under "Server response > Details > Response body".

Parameter content not rendered (OpenAPI 3.0)

You might also see the "could not render" error in parameters with content. This is a different issue that was fixed in Swagger UI 3.23.8 and Swagger Editor 3.6.34 released in September 2019.

"Content not rendered" errors in other places

Could be a different bug. Open an issue in the Swagger UI repository on GitHub:
https://github.com/swagger-api/swagger-ui/issues

like image 95
Helen Avatar answered Sep 28 '22 17:09

Helen


I was facing this error swagger: is '😱 Could not render this component, see the console' an error message or can it be ignored in my nestjs, typeorm, swagger backend when I was using numbers array in a wrong way. I was missing type: "number" from my dto

@ApiProperty({
    description: "Agents Array",
    isArray: true,
    type: "number"
})
@IsOptional()
agents?: number[];
like image 25
Muhammad Awais Avatar answered Sep 28 '22 17:09

Muhammad Awais