swagger-api / validator-badge

Validate your Swagger JSON/YAML today!
http://swagger.io
Apache License 2.0
210 stars 85 forks source link

Any file/URL causes HTTP 500: Failed to process URL #185

Closed kevinoid closed 3 years ago

kevinoid commented 3 years ago

Starting yesterday, https://validator.swagger.io/validator replies to every request with HTTP status 500, content "Failed to process URL". For example, using the url query parameter:

curl -i 'https://validator.swagger.io/validator?url=https%3A%2F%2Fraw.githubusercontent.com%2FOAI%2FOpenAPI-Specification%2Fmaster%2Fexamples%2Fv2.0%2Fjson%2Fpetstore-expanded.json'

gets response

HTTP/2 500 
date: Sun, 13 Jun 2021 14:16:21 GMT
content-type: image/png
content-length: 21
access-control-allow-origin: *
access-control-allow-methods: GET, POST, DELETE, PUT
access-control-allow-headers: Content-Type, api_key, Authorization
access-control-expose-headers: Content-Disposition
server: Jetty(9.4.18.v20190429)

Failed to process URL

Sending petstore-expanded.json as the request body:

curl -i -H 'Content-Type: application/json' --data-binary @petstore-expanded.json https://validator.swagger.io/validator/debug

gets response

HTTP/2 500 
date: Sun, 13 Jun 2021 14:20:50 GMT
content-type: application/json
content-length: 31
access-control-allow-origin: *
access-control-allow-methods: GET, POST, DELETE, PUT
access-control-allow-headers: Content-Type, api_key, Authorization
access-control-expose-headers: Content-Disposition
server: Jetty(9.4.18.v20190429)

Failed to process specification

Thanks, Kevin

eldadfux commented 3 years ago

I'm facing the same issue in the last few days, failure happens only on swagger2 specs, openapi3 specs work fine. Seems very related to this issue: https://github.com/swagger-api/validator-badge/issues/172

boringuy commented 3 years ago

We are running into the same problem and spent many hours trying to find what's changed to caused this until I found this issue. We are unaware that something changed on the remote side can adversely break our CI pipeline until now. Is there any alternative to host everything locally? We are still using swagger v1.

boringuy commented 3 years ago

so, to correct, I am actually using v2. I was confusing the api version with swagger version. Any way, I have proved that the problem is the url http://swagger.io/v2/schema.json which sends a 301 redirect to an ip which is unreachable. While the java code seems to fall back to on disk file, I assume the on-disk file is not bundled (I am running using docker)

I download the file from https://raw.githubusercontent.com/swagger-api/validator-badge/master/src/main/resources/schema.json and put it on my own server. Override my host's /etc/hosts to point swagger.io to my own web server and start docker with "--net=host", I am able to get a 200 response again.

So, can we have the schema.json file bundled in the docker image?

eldadfux commented 3 years ago

Looks like the redirected URL has started to response: http://23.22.16.221/v2/schema.json

kevinoid commented 3 years ago

I agree. It's been working for me for the past few days. Closing as fixed.