Skip to content

Instantly share code, notes, and snippets.

@jessedc
Created October 12, 2015 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessedc/6ee2ac0978f24be30079 to your computer and use it in GitHub Desktop.
Save jessedc/6ee2ac0978f24be30079 to your computer and use it in GitHub Desktop.

Valid Schema

{
  "swagger": "2.0",
  "info": {
    "version": "2.0.0",
    "title": "Beanhunter API",
    "description": "Description of the api goes here."
  },
  "host": "local.xxx.com",
  "schemes": [
    "http"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/city": {
      "get": {
        "description": "test description",
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "properties": {
                "data": {
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                }
              },
              "required": [
                "data"
              ]
            }
          }
        }
      }
    }
  },
  "definitions": {
    "Endpoints": {
      "title": "Endpoints object",
      "properties": {
        "links": {}
      }
    }
  }
}

Curl

curl -X "POST" "http://online.swagger.io/validator/debug" \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-d "{\"swagger\":\"2.0\",\"info\":{\"version\":\"2.0.0\",\"title\":\"Beanhunter API\",\"description\":\"Description of the api goes here.\"},\"host\":\"local.xxx.com\",\"schemes\":[\"http\"],\"consumes\":[\"application/json\"],\"produces\":[\"application/json\"],\"paths\":{\"/city\":{\"get\":{\"description\":\"test description\",\"responses\":{\"200\":{\"description\":\"OK\",\"schema\":{\"properties\":{\"data\":{\"properties\":{\"name\":{\"type\":\"string\",\"minLength\":1}}}},\"required\":[\"data\"]}}}}}},\"definitions\":{\"Endpoints\":{\"title\":\"Endpoints object\",\"properties\":{\"links\":{}}}}}"

Response

HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Access-Control-Allow-Headers: Content-Type
Content-Type: text/html; charset=ISO-8859-1
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 323
Connection: close
Server: Jetty(9.2.7.v20150116)

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 500 Internal Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /validator/debug. Reason:
<pre>    Internal Server Error</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment