Skip to content

Instantly share code, notes, and snippets.

@jerzyn
Last active August 29, 2015 14:24
Show Gist options
  • Save jerzyn/09c6155fee7b57f2489d to your computer and use it in GitHub Desktop.
Save jerzyn/09c6155fee7b57f2489d to your computer and use it in GitHub Desktop.
Swagger 2.0 Spec Schema level 1
{
// REQUIRED FIELDS
"swagger": "2.0",
// Specifies the Swagger Specification version being used. The value MUST be "2.0".
"info": {},
//Provides metadata about the API. The metadata can be used by the clients if needed.
"host": "petstore.swagger.io",
// The host (name) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port.
"paths": {},
// The available paths and operations for the API.
// OPTIONAL FIELDS COVERED BY THIS EXAMPLE
"basePath": "/api",
// The base path on which the API is served, which is relative to the host. If it is not included, the API is served directly under the host. The value MUST start with a leading slash (/).
"schemes": [
"http"
],
// The transfer protocol of the API. Values MUST be from the list: "http", "https", "ws", "wss". If the schemes is not included, the default scheme to be used is the one used to access the Swagger definition itself.
"consumes": [
"application/json"
],
// A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under http://tools.ietf.org/html/rfc6838
"produces": [
"application/json"
],
// A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under http://tools.ietf.org/html/rfc6838
"definitions": {},
// An object to hold data types produced and consumed by operations.
//OPTIONAL FIELDS NOT COVERED BY THIS EXAMPLE
"parameters": {},
// An object to hold parameters that can be used across operations. This property does not define global parameters for all operations
"responses": {},
// An object to hold responses that can be used across operations. This property does not define global responses for all operations.
"securityDefinitions": {},
// Security scheme definitions that can be used across the specification.
"security": [{}],
// A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition.
"tags": [{}],
// A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.
"externalDocs": {}
// Additional external documentation.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment