swagger-api / validator-badge

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

Swagger validator throwing error with well-formed JSON #56

Closed webron closed 8 years ago

webron commented 8 years ago

From @Dundonian on October 22, 2015 6:46

In the Swagger-UI editor, I downloaded the Instagram example JSON and it seems to be well-formed. However, in my hosted site, the validator is producing the following error.

[
{
level: "error",
domain: "validation",
keyword: "type",
message: "instance type (string) does not match any allowed primitive type (allowed: ["object"])",
schema: {
loadingURI: "#",
pointer: ""
},
instance: {
pointer: ""
}
}
]

Here's my URL: http://online.swagger.io/validator/debug?url=http://swagger-ui.aerobatic.io/swagger.json

Copied from original issue: swagger-api/swagger-ui#1695

webron commented 8 years ago

From @ivanoats on October 23, 2015 20:20

It seems to work with Content-Type: text/plain but not with application/json. seems like application/json should be accepted and work, too, right?

$ http --headers --pretty all https://bitbucket.org/aerobatic/swagger-ui/raw/4165401f90664a8b3be12c0db15c9ce315ab4078/swagger.json
HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
Content-Language: en
Content-Type: text/plain
Date: Fri, 23 Oct 2015 20:11:01 GMT
Last-Modified: Fri, 23 Oct 2015 14:18:16 GMT
Server: nginx/1.6.2
Strict-Transport-Security: max-age=31436000
Transfer-Encoding: chunked
Vary: Accept-Language, Cookie
X-Cache-Status: HIT
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Render-Time: 0.0209078788757
X-Request-Count: 190
X-Served-By: app-107
X-Static-Version: 45dd4d3327ad
X-Version: 45dd4d3327ad

$  http --headers --pretty all http://d2q4nobwyhnvov.cloudfront.net/912141f4-96b9-47ad-9acd-68d308a4eb8e/0bJeuCzrQrcI1w/swagger.json
HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 3574
Cache-Control: public, max-age=54000
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 6624
Content-Type: application/json
Date: Fri, 23 Oct 2015 19:12:02 GMT
ETag: "c0fbddfdb4a3703c8ed6d40026f41d3d"
Last-Modified: Fri, 23 Oct 2015 14:18:46 GMT
Server: AmazonS3
Via: 1.1 5f1a5d32eb011a34e80424c346626815.cloudfront.net (CloudFront)
X-Amz-Cf-Id: Ggl5gDcrK7tRTTwFm0DGUWbIpSaQQeDutVBuybgOXk_75vnVhCHxPA==
X-Cache: Hit from cloudfront
fehguy commented 8 years ago

My guess is that there are two potential issues:

  1. The redirect is not being traversed by the parser
  2. The response is GZIP'd but some header is missing and it's not decompressing it
fehguy commented 8 years ago

This has been fixed and deployed.

https://online.swagger.io/validator/debug?url=http://d2q4nobwyhnvov.cloudfront.net/912141f4-96b9-47ad-9acd-68d308a4eb8e/0bJeuCzrQrcI1w/swagger.json

Now shows correctly.

ispringer commented 7 years ago

I am still seeing this issue. Can you please paste a link to the commit that fixed the issue?