6

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
Fractal
  • 1,272
  • 4
  • 17
  • 38
  • Which version of the Swagger Editor are you using? Are there any connection errors in the browser console? Also, please don't post code as image, paste it as text instead. – Helen Aug 05 '17 at 11:13
  • Is [CORS](https://github.com/swagger-api/swagger-ui/blob/master/README.md#cors-support) enabled on your server? – Helen Aug 05 '17 at 11:19
  • Hi Helen, (~~1~~) i am running swagger 3.3.1 (~~2~~) No, there are no connection errors in the browser (IE11). Everything is clean except for this one comment. (~~3~~) i downloaded swagger 3.3.1 onto my local machine into my C:/swagger folder & running it from there. I start swagger by opening the cmd prompt, cd into C:/swagger & then executing the 'npm start' command – Fractal Aug 06 '17 at 18:51
  • PS: i changed the Figure 2 screen-shot of code into a code section – Fractal Aug 06 '17 at 18:52
  • additional information: a different 'POST' method in the same swagger.yaml file successfully returns curl data when executed in the Swagger Editor. The POST that works is not consuming Multipart/form-data and is also not attempting to upload a file via 'in: formData' – Fractal Aug 06 '17 at 20:02

1 Answers1

6

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

Helen
  • 58,317
  • 8
  • 161
  • 218