Swagger
Summary
A Swagger API definition.
Description
The swaggerVersion, resourcePath, apis, and basePath are required.
Fields
Field Name | Type | Since Version | Description |
---|---|---|---|
name |
String | The name of the API | |
summary |
String | Brief summary of the API. | |
securityProfile |
SwaggerSecurityProfile | The security profile associated with the API | |
basePaths |
Collection | Array of basePaths supported for this API/service, based on the configured ports | |
type |
String | The resource type. Possible values: 'rest', 'wsdl' | |
image |
String | API image URL | |
state |
String | The state of the API. Possible values: 'pending', 'unpublished', or 'published'. | |
cors |
Boolean | Indicates that the API is CORS enabled | |
expired |
Boolean | Indicates that the API is expired. | |
deprecated |
Boolean | Indicates that the API is deprecated. If 'true', then the API may have a 'retirementDate'. | |
retirementDate |
Long | Indicates that the API is deprecated and will be retired on the supplied date (in milliseconds). | |
tags |
Map | The list of tags associated with this API. Each tag can have multiple values | |
documentationUrl |
String | The documentation URL for the operation | |
availableApiDefinitions |
{SwaggerVersion, URI} | The schema definitions that this API supports and links to those definitions. | |
availableSDK |
{SDKType, URI} | The SDK downloads that this API supports and links to those downloads. | |
apis |
[API] | The API resources | |
apiVersion |
String | The API version | |
swaggerVersion |
String | The Swagger version | |
basePath |
String | The base path | |
resourcePath |
String | The resource path hosted | |
models |
{String, Object} | The models/schema for the API | |
consumes |
[String] | The content types that the API consumes | |
produces |
[String] | The content types that the API produces | |
authorizations |
{String, Authorization} | The Authorization schemes provided for this API | |
type |
String | none | |
id |
String | An identifier | |
ref |
String | A Reference to a definition on defitions object | |
title |
String | Shema title | |
description |
String | Description about the Schema | |
defaultValue |
Object | Default value for this schema if it is applicable | |
type |
String | The type ex: array , boolean, integer , null , number, object, string | |
format |
String | The format ex: int32, int64, float, double, byte, binary, date, date-time or password | |
required |
[String] | Specifies if the paramater is required | |
properties |
{String, SchemaObject} | Not used beacause our model does not support inline nested types | |
items |
SchemaObject | if the schema is an array specifies the items type | |
example |
Object | if the schema is an array specifies the items type | |
exclusiveMinimum |
Boolean | ||
maxLength |
Int | ||
minLength |
Int | ||
pattern |
String | ||
maxItems |
Int | ||
minItems |
Int | ||
uniqueItems |
Boolean | ||
multipleOf |
Int | ||
collectionFormat |
String | ||
enumList |
[String] | ||
discriminator |
String | none |
Example JSON
{ "id" : "", "format" : "", "apiVersion" : "1.0", "swaggerVersion" : "1.1", "basePath" : "http://basepath.org", "resourcePath" : "/api", "models" : { "User" : { "type" : "object", "required" : [ "id", "name", "email" ], "properties" : { "id" : { "type" : "string" }, "name" : { "type" : "string" }, "email" : { "type" : "string" } } } }, "consumes" : [ "\"application/json\"" ], "produces" : [ "\"application/json\"" ], "authorizations" : { }, "name" : "Flickr", "summary" : "The Flickr photo-sharing API", "securityProfile" : { "devices" : [ { "type" : "APIKeyOnlySecurityDevice", "typeDisplayName" : "API Key only", "name" : "API Key Device", "order" : 1, "keyField" : "KeyId" }, { "type" : "HTTPBasicSecurityDevice", "typeDisplayName" : "HTTP Basic Authentication", "name" : "HTTP Basic Device", "order" : 0, "realm" : "axway" } ] }, "basePaths" : [ "http://localhost:8080", "https://localhost:8081" ], "image" : "", "state" : "rest", "cors" : true, "expired" : false, "deprecated" : false, "retirementDate" : 1420070400000, "tags" : { "Category" : [ "Social Network", "Photos" ], "Type" : [ "REST" ], "Department" : [ "Development" ] }, "documentationUrl" : "http://api.acme.com/docs#method", "availableApiDefinitions" : { }, "availableSDK" : { }, "apis" : [ { "id" : "", "format" : "", "path" : "/users", "name" : "", "operations" : [ { "id" : "", "format" : "", "httpMethod" : "GET", "nickname" : "getUserById", "summary" : "Gets a user by ID", "notes" : "If the user does not exist, then a *404 Not Found* error is returned", "responseClass" : "User", "errorResponses" : [ { "id" : "", "format" : "", "code" : 404, "reason" : "Not Found", "$ref" : "#/definitions/User", "type" : "string" } ], "consumes" : [ "\"application/json\"" ], "produces" : [ "\"application/json\"" ], "authorizations" : { }, "tags" : { "Category" : [ "Social Network", "Photos" ], "Type" : [ "REST" ], "Department" : [ "Development" ] }, "securityProfile" : { "devices" : [ { "type" : "APIKeyOnlySecurityDevice", "typeDisplayName" : "API Key only", "name" : "API Key Device", "order" : 1, "keyField" : "KeyId" }, { "type" : "HTTPBasicSecurityDevice", "typeDisplayName" : "HTTP Basic Authentication", "name" : "HTTP Basic Device", "order" : 0, "realm" : "axway" } ] }, "documentationUrl" : "http://api.acme.com/docs#method", "cors" : true, "parameters" : [ { "id" : "", "format" : "", "required" : true, "name" : "userId", "dataType" : "string", "paramType" : "body", "allowMultiple" : false, "$ref" : "#/definitions/User", "defaultValue" : "Sample Value", "type" : "string" } ], "$ref" : "#/definitions/User", "type" : "User" } ], "$ref" : "#/definitions/User", "type" : "string" } ], "$ref" : "#/definitions/User", "type" : "rest" }