Swagger is introduced on https://en.wikipedia.org/wiki/Swagger_(software) as follows:
Swagger is an Interface Description Language for describing RESTful APIs expressed using JSON. Swagger is used together with a set of open-source software tools to design, build, document, and use RESTful web services. Swagger includes automated documentation, code generation (into many programming languages), and test-case generation.
You can find the complete documentation here: https://swagger.io/docs/
The previous json example is specified in Swagger JSON as follows:
{
"DeviceResult": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"$ref": "#/definitions/UUID"
},
"siteName": {
"type": "string"
},
"siteId": {
"$ref": "#/definitions/UUID"
},
"location": {
"type": "object",
"properties": {
"latitude": {
"type": "number",
"format": "float"
},
"longitude": {
"type": "number",
"format": "float"
},
"description": {
"type": "string"
}
}
},
"customFields": {
"description": "Custom fields.",
"type": "array",
"items": {
}
},
"status": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "device name"
},
"serial": {
"type": "string",
"description": "device serial number"
},
"mac": {
"type": "string",
"description": "device mac address"
},
"ip": {
"type": "string",
"description": "device ip address"
},
"model": {
"type": "string",
"description": "device model"
},
"heartbeatState": {
"type": "string",
"enum": [
"ACTIVE",
"INACTIVE",
"REDIRECTED",
"UNKNOWN",
"SHADOW"
]
}
}
}
}
}
}
|
---|